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
Create a file called test.php with the code sample above...
Run phpcs test.php ...
See error message displayed
-------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-------------------------------------------------------------------------------
40 | ERROR | [x] There must be one blank line after the namespace declaration
-------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-------------------------------------------------------------------------------
Expected behavior
No issues.
Versions (please complete the following information):
OS: irrelevant
PHP: 7.4, 8.0
PHPCS: 3.5.8
Additional context
using namespace\count to call a function is different than using count() and \count().
namespace\count(): use count() from the current namespace, don't try to fallback to global count
count(): use count() from current namespace, if not found, fallback to global namespace
Describe the bug
A clear and concise description of what the bug is.
Code sample
Custom ruleset
To reproduce
Steps to reproduce the behavior:
test.php
with the code sample above...phpcs test.php ...
Expected behavior
No issues.
Versions (please complete the following information):
Additional context
using
namespace\count
to call a function is different than usingcount()
and\count()
.namespace\count()
: usecount()
from the current namespace, don't try to fallback to globalcount
count()
: usecount()
from current namespace, if not found, fallback to global namespace\count()
: usecount()
from global namespacesee: https://3v4l.org/enMgi
The text was updated successfully, but these errors were encountered: