Bump to PHPStan ^2.2.6 and Fix its Container compatibility in RichParser - #8208
Conversation
|
Fixed 🎉 /cc @magicsunday @TomasVotruba this needs merge and release to fix test compat and test packages on I don't have merge access when CI is required.
|
|
Independent reproduction, plus a diagnosis of why the 5 red checks are not the patch's fault. ReproductionDownstream project (
All 11 failures are Rector rule tests ( We are currently capped at Why the 5 failing checks cannot pass yetNone of them exercise this PR's
So the failure is the very bug this PR fixes, arriving through the published artifact. It is circular: those jobs can only go green once a release carrying the fix exists, which cannot happen until this merges. Two ways to break the cycle
Happy to open a PR for either if it helps. |
|
@michaelmeneses this just need merge and new release :) |
|
Thank you 👌 |
|
Released 2.5.8 for it 👍 https://github.com/rectorphp/rector/releases/tag/2.5.8 |
phpstan/phpstan 2.2.6 removed the private $container property on RichParser that Rector's PHPStanContainerMemento accessed via reflection, crashing every rector run. Fixed upstream in rectorphp/rector-src#8208 and released as rector/rector 2.5.8.
phpstan/phpstan 2.2.6 removed the private $container property on RichParser that Rector's PHPStanContainerMemento accessed via reflection, crashing every rector run. Fixed upstream in rectorphp/rector-src#8208 and released as rector/rector 2.5.8.
rector 2.5.7 は phpstan 2.2 で削除された `PHPStan\Parser\RichParser` の private プロパティ `$container` を PrivatesAccessor 経由で参照するため, DI コンテナ構築時に MissingPrivatePropertyException で fatal error になり Rector ジョブが失敗していた. composer の制約上は矛盾がない (rector 2.5.7 の要求は phpstan ^2.2.2) ため dependabot が壊れた組み合わせの lock を生成していた. rector 2.5.8 (rectorphp/rector-src#8208 "Bump to PHPStan ^2.2.6 and Fix its Container compatibility in RichParser") で `$nodeVisitors` を参照する実装に 修正されているため 2.5.8 へ更新する. rector 2.3.9 への据え置きは phpstan を ^2.1.40 に固定する意味になり本 PR の phpstan 2.2 更新と両立しない. あわせて 2.3.9 → 2.5.8 で追加された新ルールの指摘に追従する. RemoveDefaultValueFromAssignedPropertyRector は以下の理由でスキップする. - Entity (Order::$delivery_fee_total, Customer::$buy_times 等) の初期化子は `#[ORM\Column(options: ['default' => 0])]` と対になる初期値の表明である - LoggerFacade / TranslatorFacade の static プロパティは init() 前にも参照され得るため, 初期化子を消すと nullable 型なのに未初期化アクセスの Error になる TwigInitializeListener では `@var Page $Page` の削除により `$Page->getPageLayouts()` の native 型が解決されるようになり, 不正確な `@var PageLayout[]` が PHPStan で検出されたため削除した (`Page::getPageLayouts()` は `@return Collection<int, PageLayout>` を持つ). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Fixes rectorphp/rector#9824
Currently update to use phpstan 2.2.6 cause crash:
This PR try bump to PHPStan ^2.2.6 and Fix its Container compatibility in RichParser.
See crash
https://github.com/rectorphp/rector-src/actions/runs/30224923562/job/89853439240#step:6:9