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
Summary of ChangesHello @CybotTM, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request coordinates a significant upgrade of the PHPStan static analysis ecosystem to its major version 2. This update brings the project in line with the latest static analysis capabilities, ensuring more robust code quality checks and adherence to stricter coding standards. The changes involve updating core PHPStan packages and related rulesets, leading to a regenerated error baseline and adjustments in the PHPStan configuration. Highlights
Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request successfully upgrades the PHPStan ecosystem to version 2.x. The changes include updating the versions of phpstan/phpstan, phpstan/phpstan-strict-rules, and symplify/phpstan-rules in composer.json. The phpstan.neon configuration file has been correctly updated to reflect changes in the new versions, such as renaming strictCalls to strictFunctionCalls and removing rules that are no longer available. The phpstan-baseline.neon has been regenerated to account for the stricter analysis, which is a good strategy for managing the new findings. The changes are consistent with the goal of the pull request and look correct. Well done.
There was a problem hiding this comment.
Pull request overview
This PR upgrades the repository’s static-analysis toolchain to PHPStan 2.x and updates related extensions/configuration so analysis continues to pass under the new major versions.
Changes:
- Upgraded
phpstan/phpstan,phpstan/phpstan-strict-rules, andsymplify/phpstan-rulesto their PHPStan 2-compatible major versions. - Updated PHPStan config to reflect renamed strict-rules option (
strictCalls→strictFunctionCalls) and removed dropped Symplify rules. - Regenerated
phpstan-baseline.neonfor PHPStan 2.x and expanded CI PHP 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 |
Removes dropped Symplify rules and updates strict-rules parameter naming for PHPStan 2.x. |
phpstan-baseline.neon |
Regenerated baseline to match new PHPStan 2.x diagnostics/identifiers. |
composer.json |
Bumps PHPStan ecosystem dependencies to 2.x-compatible versions. |
composer.lock |
Locks the upgraded dependency graph for the PHPStan ecosystem and related packages. |
.github/workflows/main.yaml |
Adds PHP 8.5 to the CI test matrix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 34 out of 35 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/typo3-docs-theme/src/Directives/SiteSetSettingsDirective.php
Outdated
Show resolved
Hide resolved
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.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 36 out of 37 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
packages/typo3-version-handling/src/Packagist/PackagistService.php:123
- In fetchPackageData(), curl_errno() is read before curl_exec(), so $errorNumber will almost always be 0 and the timeout detection (CURLE_OPERATION_TIMEOUTED) won’t work. Capture curl_errno (and optionally curl_error) after curl_exec() (and before curl_close()), and consider guarding against curl_init($url) returning false to avoid warnings from curl_setopt().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** @param array<int, mixed> $configs */ | ||
| public function load(array $configs, ContainerBuilder $container): void |
There was a problem hiding this comment.
The new phpdoc for $configs uses array<int, mixed>, which is narrower than Symfony’s ExtensionInterface expectation (array<array> / array<array-key, array>). This mismatch is now being suppressed via the PHPStan baseline. Adjust the phpdoc to use array<array-key, mixed> (or array<array-key, array<string, mixed>> if you want to reflect the real structure) so the method is contravariant with the interface and the baseline entry can be removed.
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