-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to PHPStan 2.0 #15
Conversation
📝 WalkthroughWalkthroughThe changes involve updates to the Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant Composer
participant PHPStan
Developer->>Composer: Update dependencies
Composer->>PHPStan: Check compatibility with phpstan/phpstan
PHPStan-->>Composer: Compatibility OK
Composer-->>Developer: Dependencies updated
Developer->>PHPStan: Run analysis
PHPStan->>Developer: Analyze code at level 10
Possibly related PRs
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (5)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
f3e90c1
to
d29f83b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
phpstan.neon.dist (1)
Update composer.json to Require PHPStan 2.0 Exclusively
The current
composer.json
allows multiple versions of PHPStan (^0.12 || ^1.0 || ^2.0
), which may lead to inconsistencies with the updatedphpstan.neon.dist
configuration tailored for PHPStan 2.0.Action Items:
- Modify the PHPStan version constraint in
composer.json
to"phpstan/phpstan": "^2.0"
to ensure only PHPStan 2.0 is used.- Remove older PHPStan versions to prevent compatibility issues.
🔗 Analysis chain
Line range hint
1-41
: Verify completeness of PHPStan 2.0 preparation.The changes in this file, including increasing the PHPStan level and potentially removing the
grifart/phpstan-oneline
configuration, align with the PR objective of preparing for PHPStan 2.0. However, it's important to ensure that these changes are sufficient for the transition.Please confirm:
- Are there any other configuration changes required for PHPStan 2.0 compatibility?
- Have you reviewed the PHPStan 2.0 changelog or migration guide to ensure all necessary updates have been made?
- Are there any deprecated features or settings in this configuration that should be updated for PHPStan 2.0?
To check for any PHPStan 2.0 related changes or mentions in the project:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for PHPStan 2.0 related changes or mentions rg "PHPStan 2\.0|phpstan.*2\.0"Length of output: 98
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- composer.json (1 hunks)
- phpstan.neon.dist (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
phpstan.neon.dist (2)
7-7
: Verify the validity and implications of PHPStan level 10.The PHPStan level has been increased from 9 to 10. Traditionally, PHPStan levels range from 0 to 9, with 9 being the strictest. This change to level 10 might be related to new features in the upcoming PHPStan 2.0 release.
Please confirm:
- Is level 10 a valid option in PHPStan 2.0?
- What additional checks or stricter rules does level 10 introduce compared to level 9?
- Have you tested the codebase against this new level to ensure it doesn't introduce an excessive number of new errors?
To check if level 10 is mentioned in the PHPStan documentation or changelog:
1-5
: Verify the removal of grifart/phpstan-oneline configuration.The AI summary mentions the removal of an include statement for
vendor/grifart/phpstan-oneline/config.neon
, which is not visible in the provided code snippet. This aligns with the PR objective of removing thegrifart/phpstan-oneline
dependency.Please confirm:
- Has the include statement for
vendor/grifart/phpstan-oneline/config.neon
been removed from this file?- Are there any implications for the project's error reporting format due to this removal?
- Does PHPStan 2.0 provide a built-in alternative for the functionality previously provided by
grifart/phpstan-oneline
?To check for any remaining references to
grifart/phpstan-oneline
:composer.json (1)
16-16
: Version constraint updated for phpstan/phpstanThe version constraint for phpstan/phpstan has been updated to include version 2.0. This change aligns with the PR objective of preparing for the PHPStan 2.0 update.
Let's verify if this is the only occurrence of the phpstan/phpstan dependency in the project:
d29f83b
to
f95a5b7
Compare
f95a5b7
to
ac2f07d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues flagged.
Standard Input can make mistakes. Check important info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
composer.json
(1 hunks)phpstan.neon.dist
(1 hunks)tests/CodeHighlight/CodeHighlighterTest.php
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- phpstan.neon.dist
🔇 Additional comments (4)
composer.json (3)
16-16
: LGTM! Good approach for version constraints
The version constraint "^0.12 || ^1.0 || ^2.0"
maintains backward compatibility while preparing for PHPStan 2.0. This allows for a smooth transition and gives users flexibility in upgrading.
Line range hint 1-67
: Verify impact of removing phpstan-oneline
The removal of grifart/phpstan-oneline
and its related script needs verification to ensure no users depend on this functionality.
#!/bin/bash
# Description: Check for any references to oneline formatter in the codebase
# and documentation
# Search for oneline formatter references in markdown files and PHP files
rg -t md -t php "oneline"
# Check if the formatter is mentioned in any GitHub issues or discussions
gh search issues "oneline formatter" --repo yamadashy/phpstan-friendly-formatter
14-14
: Verify PHP 7.4 requirement for PHPStan 2.0
The minimum PHP version has been increased from 7.2 to 7.4. This is a breaking change that could affect users.
tests/CodeHighlight/CodeHighlighterTest.php (1)
12-12
: LGTM! Namespace in annotation matches the import.
The updated @coversDefaultClass
annotation correctly reflects the namespace of the imported class.
Let's verify the class exists in the new namespace location:
✅ Verification successful
Verified! The CodeHighlighter
class exists in the new CodeHighlight
namespace as expected.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify the CodeHighlighter class exists in the new namespace location
# Expected: Find the class file in the CodeHighlight subdirectory
# Search for the class file
fd --type f --glob '**/CodeHighlight/CodeHighlighter.php'
# Verify namespace declaration in the found file
if [ $? -eq 0 ]; then
rg --type php "^namespace.*CodeHighlight;" --files-with-matches
fi
Length of output: 267
a9fc46c
to
0ff0422
Compare
0ff0422
to
d042412
Compare
This PR updates our project to use PHPStan 2.0, which includes several improvements and changes to the static analysis tool.