-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
@@ -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()) ?: ''))) { |
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.
extensions might not provide version info and this line can return false
6024a62
to
9e96bff
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
src/Metadata/Version/Requirement.php
Outdated
@@ -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"; |
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.
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 |
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.
Named args cannot be a list
fixing low hanging fruits. not all errors are resolved yet
Some more are fixed with phpstan/phpstan-src#3731