You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this amazing tool and your continued support. I have noticed some strange behavior with phpcs --standard=PSR1,PSR2,PSR12 and files that define multiple namespaces in them.
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
161 | ERROR | [x] Header blocks must not contain blank lines
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
If I "fixed" this issue by removing the space on line 162, but then I am greeted with a new issue in the same file that was not previously detected.
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
3 | ERROR | [x] There must be one blank line after the namespace
| | declaration
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
None of the PSR code style specifications make mention of multiple namespaces in a file and don't appear to account for the specific case where one would need to mock a built in php function. I am aware of a couple of tools like runkit that maybe able to work around this, but it seems like a lot of effort to produce a less desirable result. CBF could not fix the file in question so I was wondering if this was the intended behavior of this sniff or an undefined case / side effect.
gsherwood
changed the title
Couple of interesting observations with multiple namespaces in one file
PSR12.Files.FileHeader blank line error with multiple namespaces in one file
Jun 22, 2020
This has been fixed by assuming the file header is complete when a bracketed statement is found. The fix will be in 3.5.6. Thanks for reporting the bug.
Hi,
Thanks for this amazing tool and your continued support. I have noticed some strange behavior with
phpcs --standard=PSR1,PSR2,PSR12
and files that define multiple namespaces in them.FILE: /home/kwhat/projects/requestful/tests/Unit/Http/ClientTest.php
If I "fixed" this issue by removing the space on line 162, but then I am greeted with a new issue in the same file that was not previously detected.
None of the PSR code style specifications make mention of multiple namespaces in a file and don't appear to account for the specific case where one would need to mock a built in php function. I am aware of a couple of tools like runkit that maybe able to work around this, but it seems like a lot of effort to produce a less desirable result. CBF could not fix the file in question so I was wondering if this was the intended behavior of this sniff or an undefined case / side effect.
This maybe related to #2608
The text was updated successfully, but these errors were encountered: