-
-
Notifications
You must be signed in to change notification settings - Fork 190
Use short nullable for PHP<8 since union types are not supported #1776
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: master
Are you sure you want to change the base?
Use short nullable for PHP<8 since union types are not supported #1776
Conversation
|
Quick question before I fix the test: the test fails on 7.4, however this test should not ever have passed on 7.4, since this test is a fatal error in PHP 7.4 Any plans to add a |
|
PHPCS is parser so it does not run code. PHPCS on PHP 7.4 can parse and fix code with PHP 8.4 syntax. |
|
No, you misunderstood me: PHPCS on PHP 7.4 with config php_version 80400 can fix code with PHP 8.4 syntax - but "php84 -l file.php" should pass without errors Therefore:
using PHP_VERSION_ID would be wrong, I'd need to check the php_version of phpcs config for that case and skip the test in that case. It seems there are no other tests that are version specific? Does this mean I can just remove the failing test, since it's only failing in PHP 7.4? |
| return; | ||
| } | ||
|
|
||
| if ($this->shortNullable !== self::YES && SniffSettingsHelper::isEnabledByPhpVersion(null, 80000) === false) { |
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.
You should not set the value, when user set it. Only null value should be rewritten.
|
I don't usually test default values - only specific values of the options ( See other tests data for the lint check for specific PHP versions. |
Fix #1775