chore: upgrade PHPStan 2.x + Rector 2.x#110
Merged
Merged
Conversation
PHPStan 2.x is version-locked to Rector 2.x (Rector 1.x pins phpstan ^1.12.5), so both move together: - composer.json: phpstan/phpstan ^1.12 -> ^2.1, rector/rector ^1.2 -> ^2.0. - Apply Rector 2.x across src/ and tests/ (~94 files): mostly cosmetic modernizations from the expanded rule sets — SafeDeclareStrictTypes, first-class-callable syntax, explicit closure/array param types, ThrowWithPreviousException, removal of no-op ReflectionProperty::setAccessible(), redundant-cast removal, etc. Behaviour-preserving; full test suite still green. - regenerate phpstan-baseline.neon under 2.x: level 6 is stricter in 2.x, so the grandfathered count rises (51 -> 80 errors) to be burned down later under #96. Manual corrections to Rector output: - Pair::__get / PriorityNode::__get: Rector added `: mixed` but left a bare `return;`, which is a fatal with a typed return. Completed to `return null;` (faithful to the prior null-returning behaviour and the `@return mixed|null`). - Skip RemoveParentDelegatingConstructorRector globally: it removed Cookie::__construct(), which is NOT dead — it widens AbstractCookie's protected constructor to public. Restored the constructor and documented the skip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the PHPStan-2.x part of #96. PHPStan 2.x is version-locked to Rector 2.x (Rector 1.x pins
phpstan ^1.12.5), so both are upgraded together.composer.json:phpstan/phpstan^1.12 → ^2.1,rector/rector^1.2 → ^2.0.SafeDeclareStrictTypes(34), first-class-callable syntax (strlen(...)), explicit closure/array param types,ThrowWithPreviousException, removal of no-opReflectionProperty::setAccessible()calls, redundant-cast removal, etc.Manual corrections to Rector output
Pair::__get/PriorityNode::__get: Rector added: mixedbut left a barereturn;(a fatal with a typed return). Completed toreturn null;— faithful to the prior null-returning behaviour and the@return mixed|nulldocblock.RemoveParentDelegatingConstructorRectorglobally: it removedCookie::__construct(), which is not dead — it widensAbstractCookie'sprotectedconstructor topublic. Restored the constructor and documented the skip inrector.php.Test plan
composer cs— cleancomposer stan(PHPStan 2.1) —[OK] No errorsvendor/bin/rector process --dry-run(Rector 2.4, full codebase) — clean and stable with cs-fixer (no tug-of-war)composer test— 5555 tests; only the pre-existing localMongoSessionHandlerTestenv errors (CI loads ext-mongodb)composer validate --strict— valid