Skip to content
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

Fix PHPStan level 7 errors #6084

Merged
merged 6 commits into from
Dec 24, 2024
Merged

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Dec 14, 2024

fixing low hanging fruits. not all errors are resolved yet

Some more are fixed with phpstan/phpstan-src#3731

@@ -72,7 +72,7 @@ public function requirementsNotSatisfiedFor(string $className, string $methodNam

if (!extension_loaded($metadata->extension()) ||
($metadata->hasVersionRequirement() &&
!$metadata->versionRequirement()->isSatisfiedBy(phpversion($metadata->extension())))) {
!$metadata->versionRequirement()->isSatisfiedBy(phpversion($metadata->extension()) ?: ''))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extensions might not provide version info and this line can return false

@staabm staabm force-pushed the fix branch 2 times, most recently from 6024a62 to 9e96bff Compare December 14, 2024 09:52
Copy link

codecov bot commented Dec 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.64%. Comparing base (3299957) to head (d196dee).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #6084   +/-   ##
=========================================
  Coverage     94.64%   94.64%           
- Complexity     6645     6649    +4     
=========================================
  Files           713      713           
  Lines         20911    20911           
=========================================
  Hits          19791    19791           
  Misses         1120     1120           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@staabm staabm marked this pull request as ready for review December 14, 2024 10:06
@@ -23,7 +23,7 @@
*/
abstract readonly class Requirement
{
private const VERSION_COMPARISON = '/(?P<operator>[<>=!]{0,2})\s*(?P<version>[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m';
private const VERSION_COMPARISON = "/(?P<operator>!=|<|<=|<>|=|==|>|>=)?\s*(?P<version>[\d\.-]+(dev|(RC|alpha|beta)[\d\.])?)[ \t]*\r?$/m";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operators copied from ComparisonRequirement constructor

@@ -89,7 +89,7 @@ final class Generator
*
* @param class-string $type
* @param ?list<non-empty-string> $methods
* @param list<mixed> $arguments
* @param array<mixed> $arguments
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named args cannot be a list

@sebastianbergmann sebastianbergmann merged commit 9c46531 into sebastianbergmann:main Dec 24, 2024
25 checks passed
@staabm staabm deleted the fix branch December 24, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants