-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Migrate to PHP 8.4 #256
base: main
Are you sure you want to change the base?
Migrate to PHP 8.4 #256
Conversation
This removes the deprecations introduced in PHP 8.4
PHP 8.4 makes not doing so a deprecation.
PHP 8.4 deprecates the use of E_USER_ERROR. This can mangle the exception thrown. So, skip the test in PHP 8.4. It may be possible to fix up what's being thrown, but I haven't found anything. Since using trigger_error for user errors is now deprecated, error_to_exception() should probably be deprecated as well. But that's a greater decision than making sure tests work correctly.
PHP 8.4 has changed the format of __FUNCTION__ for closures, at least.
PHP 8.4 deprecates the implicit conversion from doubles to ints when doing so would lose precision. However, disallowing doubles as array keys in Functional would be a BC break.
Incidentally, I made these changes against the 1.17.0 release rather than main. I'll be maintaining my fork until PHP 8.4 support is merged, as I will be going to production with 8.3 (at least) soon. |
Looks good! Care to extend the build matrix for CI as well? |
@@ -32,6 +32,11 @@ function group($collection, callable $callback) | |||
|
|||
InvalidArgumentException::assertValidArrayKey($groupKey, __FUNCTION__); | |||
|
|||
// Avoid implicit precision-loss from doubles (which cannot be keys) | |||
if (is_numeric($groupKey)) { |
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 add a testcase for this so that we have the behavior explicitly pinned down?
// See https://3v4l.org/MmFA6. | ||
self::markTestSkipped('Only works with PHP <8.4 due to deprecated E_USER_ERROR'); | ||
} | ||
|
||
$origFn = function () { | ||
\trigger_error('Some error', E_USER_ERROR); |
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.
How about using E_DEPRECATED instead
Please merge with my pull request. This is the first PR, it will help me a lot |
This is in response to my bug report, #254 . However, it technically also "competes" with:
I believe this is more thorough than either of the other two PRs. And it answers Several parameters are implicitly nullable, triggering deprecation warnings in PHP 8.4 #254 and then some.
I made these changes before I knew about the other two. But I'm tired and want to get this PR in. If desired, I'm happy to do the work of merging the other PRs together so everyone gets credit.