Closed morozov closed 6 years ago
Hmm, the sniff does not check any doccomment but it should be possible very easy. I hope :)
@morozov Could you please try https://github.com/slevomat/coding-standard/commit/c73280903ece590687d0d9abdddb8e8efdb017ca ?
Thanks @kukulich. I checked out the commit above and enabled searchAnnotations
for SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly
in our ruleset.xml
. Still same output.
Most likely, I'm just doing something wrong. @Majkl578 could you please check this?
Testing on ORM, seems to work, or at least report errors like:
FILE: lib/Doctrine/ORM/Query/Exec/AbstractSqlExecutor.php
--------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------------------------------------------------------------
56 | ERROR | [x] Class \Doctrine\DBAL\Driver\Statement should not be referenced via a fully qualified name, but via a use statement.
For @return here
.
To enable, require slevomat/coding-standard: dev-master as 4.3.99
and just add:
<property name="searchAnnotations" type="boolean" value="true"/>
and delete cache file .phpcs-cache
.
Clearing cache worked for me:
------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
------------------------------------------------------------------------------------------------
8 | ERROR | [x] Class \Doctrine\DBAL\Connection should not be referenced via a fully
| | qualified name, but via a use statement.
13 | ERROR | [x] Class \Doctrine\DBAL\Connection should not be referenced via a fully
| | qualified name, but via a use statement.
------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
------------------------------------------------------------------------------------------------
Thank you @Majkl578.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Example script:
Actual output:
Expected output: line 8 should be reported as containing FQN as well.
Please see https://github.com/doctrine/dbal/pull/3002#discussion_r165686652 for the reference.