-
Notifications
You must be signed in to change notification settings - Fork 356
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 PHP 8.2 warning: Use [static::class, '…']
instead of 'static::…
for callbacks
#570
Conversation
…(PHP 8.2 warning)
I guess the |
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.
Can you also apply this diff?
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 1c521356..37222a4f 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -13,7 +13,7 @@
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
<php>
- <env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=404"/>
+ <env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
</php>
<testsuites>
<testsuite name="Faker Test Suite">
@@ -363,7 +363,7 @@ public static function shuffleString($string = '', $encoding = 'UTF-8') | |||
return implode('', static::shuffleArray($array)); | |||
} | |||
|
|||
private static function replaceWildcard($string, $wildcard = '#', $callback = 'static::randomDigit') | |||
private static function replaceWildcard($string, $wildcard, $callback) |
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.
Method is private
and always invoked with arguments for all parameters - no need for default values.
Also see #571.
[static::class, '…']
instead of 'static::…
for callbacks
I guess the changes should be squashed on merge? |
Problems have been resolved
Thank you, @GrahamCampbell and @MyIgel! |
What is the reason for this PR?
This implements remaining changes for #479 (Use of "static" in callables is deprecated in PHP 8.2) and is an extension of #528 (Ensure php 8.2 compatibility)
Author's checklist
Summary of changes
Use self::class . '::[…]' instead of 'static::[…]' on callbacks which triggered a PHP 8.2 warning. Implementation analogous to php.watch.
The phpstan "errors" can be ignored as that functionality still works for PHP 7.4 and is thus added to ignoreErrors.
Review checklist