Conversation
This allows Laravel to handle deprecated constant introduced in PHP 8.5 Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
| } | ||
|
|
||
| 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.
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.
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.
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