-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
PHP 8.1 support incomplete #3799
Comments
If you add a blank* line between lines 4 & 5 in your sample, do you still get an error? I expect not. This seems like an alignment issue, not a (lack of) PHP version support. * Not an completely blank line, as this is in a docblock, so you will need the correct indentation and an asterisk, but nothing else. |
PHPCS doesn't understand the required spacing when using intersection types. |
@fredden Instead of looking at my problem and help me to solve it, you wanted to belittle me. |
I have now been able to find time to answer my own questions/suggestions. (I was away from my machines at the time, and I wanted to get you a quick response to your support query.)
The following code snippet does not show any error for me from <?php
/**
* @param One&Two $param
*
* @return void
*/
function doThing(One&Two $param): void
{
}
The following code snippet does get a complaint from <?php
/**
* @param bool $param
* @return void
*/
function doThing(bool $param): void
{
}
This is not true. Perhaps I was influenced by the language that you used in the bug report. There was no malice in my intention. I thought I'd provided some suggestions to triage/refine the bug report. From the information provided, I don't understand what the problem is that you're trying to report. @SharkMachine, please can you provide some more details to help me understand why this is a PHP 8.1/union type support problem? Is there another code sample that demonstrates the issue you're facing? |
Another case (+ PHP 8.2)
Show
If remove readonly OR put final - all will work. |
@mrVrAlex that sounds like #3727 and not what @SharkMachine was trying to highlight. Can you confirm? |
As reported in squizlabs#3799 (comment), the `FileHeader` sniff did not take the new PHP 8.2+ `readonly` OO modifier keyword into account. Fixed now. Includes test.
As reported in #3799 (comment), the `FileHeader` sniff did not take the new PHP 8.2+ `readonly` OO modifier keyword into account. Fixed now. Includes test.
@jrfnl Apologies, that bother you. But could you please tell us when is the next release that will include these modifications? PS: PHP8.1 exited in November 2021, my team has been using it for more than 1 year, and we are still avoiding using read-only classes because our pipelines run code sniffer |
@jrfnl we are facing the same issue as @vladimir-borduja, any news about the next release? Thank you! |
@vladimir-borduja @Fahani Unfortunately no, we all (including me), will just have to wait until @gsherwood has some availability again... Also see #3861 |
Another slightly weird way to fix this is to add a docblock between |
FYI: A fix for the issue reported by @mrVrAlex (PSR12/FileHeader sniff) is included in today's PHP_CodeSniffer 3.8.0 release. As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo). |
This still being open doesn't look good for https://wiki.php.net/rfc/dnf_types :< |
Code sample
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
Expected behavior
No error
Versions (please complete the following information):
The text was updated successfully, but these errors were encountered: