-
Notifications
You must be signed in to change notification settings - Fork 11.6k
[12.x] PHP 8.5 Compatibilities #57464
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
base: 12.x
Are you sure you want to change the base?
Conversation
This allows Laravel to handle deprecated constant introduced in PHP 8.5 Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
Signed-off-by: Mior Muhammad Zaki <[email protected]>
| } | ||
|
|
||
| return (new Collection($features)) | ||
| ->mapWithKeys(fn ($value, $feature) => [(string) Str::of($feature)->prepend(PHP_VERSION_ID < 80400 ? 'PDO::MYSQL_' : 'Pdo\Mysql::') => $value]) |
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.
Where does the constant name as a string get converted to a constant value?
Shouldn't we call constant() after prefixing the constant names to convert them to their values?
Otherwise this would result in something like this:
[
// constant name as a string value
'PDO::MYSQL_ATTR_SSL_CA' => env('MYSQL_ATTR_SSL_CA'),
]Instead of
[
// PDO::MYSQL_ATTR_SSL_CA = 1009 in my local PHP binary
1009 => env('MYSQL_ATTR_SSL_CA'),
]reference: https://www.php.net/manual/en/function.constant.php
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.
Unfortunately, Stringable@pipe() returns a new Stringable instance and not the result of the callback.
Otherwise, this could be fixed by adding a ->pipe('constant') call to the Str::of() chain when mapping the keys.
If the constant's value is an integer, I guess the key might also be an integer.
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.
This PR will remain as a draft and wait for symfony/polyfill#549
- I'm not sure using
ATTR_SSL_CA, for example, as key is good for DX, This means we need to include the usage documentation. - Only
mysqlandsqlitehas the deprecation at the moment. This meansConnector::features()is only available for some drivers.
Redisclass in PHP 8.5