Open
Conversation
- phpstan/phpstan: ^1.12 -> ^2.1 - phpstan/phpstan-strict-rules: ^1.6 -> ^2.0 - symplify/phpstan-rules: ^13.0 -> ^14.9 - Removed deprecated symplify regex rules (dropped in 14.x) - Updated strictRules config: strictCalls -> strictFunctionCalls - Regenerated phpstan-baseline.neon for stricter 2.x rules
There was a problem hiding this comment.
Pull request overview
Upgrades the project’s PHP static analysis toolchain to PHPStan 2.x, updating configuration and baseline to match the new rule/parameter set while keeping CI coverage current.
Changes:
- Bumped PHPStan + related rule packages to 2.x-compatible versions (and updated
composer.lockaccordingly). - Updated
phpstan.neonfor PHPStan 2.x config changes and removed deprecated Symplify regex rules. - Regenerated
phpstan-baseline.neonto reflect the new/stricter rule set. - Expanded CI test matrix to include PHP 8.5.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
phpstan.neon |
Adjusts PHPStan 2.x config (strictFunctionCalls) and removes rules no longer available in Symplify 14.x. |
phpstan-baseline.neon |
Updates baseline to the new set of reported issues under PHPStan 2.x. |
composer.json |
Upgrades PHPStan ecosystem dependencies to 2.x-compatible versions. |
composer.lock |
Locks upgraded dependency graph for the PHPStan ecosystem and transitive updates. |
.github/workflows/main.yaml |
Adds PHP 8.5 to the CI matrix to keep runtime coverage current. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reduce PHPStan baseline from 102 to 55 errors (46% reduction) across 31 files by applying targeted fixes: - Fix @param type on Typo3DocsThemeExtension::load() (15 errors) - Add array_values() wrappers where list<> expected (12 errors) - Add @phpstan-ignore return.unusedType on NodeTransformers (9 errors) - Cast $input->getArgument() to (string) in CLI commands (7 errors) - Fix dead code bug: missing $guides in operateOnXmlGuides() (4 errors) - Remove unnecessary @var in TwigExtension (2 errors) - Add @return list<string> to collectUnmigratedLegacySettings() (1 error) - Cast $errno to (string) in XmlValidator (1 error) - Fix nullsafe ?->textContent to -> in SiteSetSettingsDirective (1 error) - Cast $answer to (string) in InitCommand validators (3 errors) - Add type annotations for return.type entries (3 errors) - Type-hint RunDecorator process callback parameters (3 errors) - Cast $_SERVER['argv'] to array in AddThemeSettingsToProjectNode (1 error)
d5a955e to
278e21b
Compare
…ssions Replace inline @phpstan-ignore annotations with genuine code fixes: - Narrow return types from Node|null to Node (valid PHP covariance) - Add is_string()/is_array() guards for mixed Symfony Console inputs - Type-safe extraction of JSON/YAML parsed data with step-by-step validation - Fix array type annotations (array<string, mixed> instead of array<mixed>) - Properly handle DOMNodeList access in SiteSetSettingsDirective Baseline reduced from 41 to 9 entries (vs 13 on main). Remaining 9 are unfixable external library constraints (phpDocumentor interfaces returning mixed, Symfony ExtensionInterface contravariance).
… tests The previous commit incorrectly replaced getValue() with getChildren() in ViewHelperDirective. These access different properties on CompoundNode (value vs children), causing the ViewHelper description/examples/sections to be empty in rendered output. Restore getValue() with proper is_array() type narrowing to satisfy PHPStan without changing runtime behavior.
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
Coordinated upgrade of the PHPStan ecosystem to major version 2:
phpstan/phpstan: ^1.12 -> ^2.1phpstan/phpstan-strict-rules: ^1.6 -> ^2.0symplify/phpstan-rules: ^13.0 -> ^14.9phpstan.neonconfig:strictCalls->strictFunctionCalls(renamed in 2.x)phpstan-baseline.neon— reduced from 13 entries (main) to 9 entriesBaseline reduction approach
All PHPStan errors were fixed with genuine code changes (no
@phpstan-ignoresuppressions):Node|null→Nodeon NodeTransformer implementations (valid PHP covariance)is_string()/is_array()guards for mixed Symfony Console inputsjson_decode()/Yaml::parse()resultsarray<string, mixed>instead ofarray<mixed>)DOMNodeListaccess inSiteSetSettingsDirectiveRemaining 9 baseline entries are unfixable external library constraints:
mixedfromgetId(),getAdditionalIds(), etc.ExtensionInterface::load()parameter contravariancePHPStan 2.x works on PHP ^7.4|^8.0, no PHP minimum bump needed.
Test plan