-
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 support #3182
Comments
I do ;-) |
But without kidding, there are different levels of PHP 8 "readiness" for a library like PHPCS, see the answer I left to a similar question here for a more extensive explanation: PHPCompatibility/PHPCompatibility#1236 (comment) As things stand at this moment:
As for external PHPCS standards - the status of those will vary widely. Does this answer your question sufficiently ? |
@Ilyes512 Just checking: did my answer help ? |
Yes. Thank you! |
@jrfnl Are attributes supported in master too? I may be blind but I've not found any issue with the support. |
@kukulich As per above:
|
@jrfnl Ok, I'm blind :) |
@gsherwood May I suggest leaving this ticket open & making it a pinned issue ? I imagine more people will have this question and can benefit from the answer being easy to find. This will hopefully reduce the number of duplicate issues being opened. Current status summary: As of PHPCS 3.5.7, PHPCS has runtime support for PHP 8.0. At this time, there are still two PHP 8.0 syntaxes not yet supported in PHPCS
Support for all other PHP 8.0 specific syntaxes has been added, though not all released yet. The upcoming PHPCS 3.6.0 release will contain the latest fixes. While an effort has been made to verify that sniffs will function correctly with the PHP 8.0 syntaxes for which support has been added, it is always possible that something has been missed. |
Good idea. Have reopened and pinned. |
For the record/for anyone coming upon this issue: |
please keep this pinned, and thanks for the very detailed explanation @jrfnl |
Similar to #3255, there is a conflict with 'Constructor property promotion' indenting: Given: public function __construct(
private Type $param
) {} Result:
From Given: public function __construct(
private Type $param
) {} Result:
From Is this actually a bug or should I change some configuration? Couldn't find an existing GitHub issue for this yet. |
I am not sure if this was already reported. There is a bug/not-covered-case similar to the one above, but it is related to the The following code: public function method(string $arg)
{
return match ($arg) {
null => 1,
default => 2,
};
} generates the following error message: 34 | ERROR | [x] Line indented incorrectly; expected 8 spaces, found 12 (Generic.WhiteSpace.ScopeIndent.IncorrectExact) and the fix from public function method(string $arg)
{
return match ($arg) {
null => 1,
default => 2,
};
} So, it does not recognize that the |
This is fixed in master.
This is also fixed in master. Both of these fixes will be in the 3.6.0 release, which is just waiting for attribute support to be merged in now. |
I've just merged the attribute MR, which was the last for PHP8 language feature support. There are still some sniffs that need reviewing for attribute support, but a release is close now. All testing help on master very much appreciated. |
There's a [bug in its processing of constructor property promotion][1] that is purportedly fixed in 3.6 (not released yet, so fallback to 3.x dev head). [1]:squizlabs/PHP_CodeSniffer#3182 (comment)
Hi, i've been watching this issue and here is a small test result: phpcs 3.5.8 reported ~ 160 issues on our PHP 8 codebase. Ran phpcbf on dev-master and it fixed all issues without errors. |
🎉 phpcs 3.6.0 was released today with PHP 8 Language Feature Support: https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.6.0 |
Good catch @caugner. I think this issue can now be closed (but should probably stay pinned for a while longer). If anyone finds any PHP 8 related bugs in the PHPCS 3.6.0 release, please check if there is an open issue for it and if not, open one for each bug you find. |
Thank you for release!!! Running it on Drupal's core on PHP 8.1RC3 produces 2 deprecations for me
|
Does anyone have an overview of tasks to be done before this library supports (as in, it does not break) PHP 8?
The text was updated successfully, but these errors were encountered: