-
Notifications
You must be signed in to change notification settings - Fork 10
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
phpcbf crashes where there are 2 blank lines after the last use statement #212
Labels
Comments
xalopp
changed the title
phpcbf crashes where there are 2 blank lines after the last use statement
phcbf crashes where there are 2 blank lines after the last use statement
Dec 14, 2024
xalopp
changed the title
phcbf crashes where there are 2 blank lines after the last use statement
phpcbf crashes where there are 2 blank lines after the last use statement
Dec 14, 2024
xalopp
added a commit
to xalopp/mo4-coding-standard
that referenced
this issue
Dec 14, 2024
xalopp
added a commit
to xalopp/mo4-coding-standard
that referenced
this issue
Dec 14, 2024
4 tasks
xalopp
added a commit
to xalopp/mo4-coding-standard
that referenced
this issue
Dec 15, 2024
xalopp
added a commit
to xalopp/mo4-coding-standard
that referenced
this issue
Dec 15, 2024
I was able to identify the root cause of the issue. When the <?php
namespace T;
use A;class B
{
/**
* B's constructor
*/
public function __construct()
{
$a = new A();
$a->b();
}
} $ vendor/bin/phpcs -s --standard=MO4 integrationtests/C.php
FILE: /home/x/Projekte/PHP/mo4-coding-standard/integrationtests/C.php
-----------------------------------------------------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------
1 | ERROR | [ ] An error occurred during processing; checking has been aborted. The error message was: Uninitialized string offset 0 in
| | /home/x/mo4-coding-standard/MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php on line 313
| | The error originated in the MO4.Formatting.UnnecessaryNamespaceUsage sniff on line 313. (Internal.Exception)
5 | ERROR | [x] Expected 1 line after last use statement, found -1.
| | (SlevomatCodingStandard.Namespaces.UseSpacing.IncorrectLinesCountAfterLastUse)
5 | ERROR | [x] There must be one blank line after the last USE statement; 0 found;
| | (MO4.Formatting.AlphabeticalUseStatements.SpaceAfterLastUse)
5 | ERROR | [x] Header blocks must be separated by a single blank line (PSR12.Files.FileHeader.SpacingAfterBlock)
-----------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 3 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------
PR #213 will solve this |
xalopp
added a commit
to xalopp/mo4-coding-standard
that referenced
this issue
Dec 15, 2024
xalopp
added a commit
to xalopp/mo4-coding-standard
that referenced
this issue
Dec 15, 2024
xalopp
added a commit
that referenced
this issue
Dec 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Type of issue
Description
The file
integrationtests/B.php
contains following codeThe style violation consists of 2 blank lines between the last
use
statement and theclass
declaration.We see, that more than on sniff are complaining.
Using the autofixer fails, with an exception in a non relevant sniff
MO4.Formatting.UnnecessaryNamespaceUsage
works.
Technical details
The text was updated successfully, but these errors were encountered: