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
Yeah, I've been thinking about this for some good time, and I'd say that there are a few cases related also worth being considered:
"use" uses straight under a namespace:
namespace mod_forum
use mod_forum\foo;
Complete class-path uses of things declared as "use"
use mod_forum\foo;
$example = new \mod_forum\foo();
I think that there are a few more around that I've seen and should have annotated in some of my namespaces notes.
In fact I've here a very basic shell script (from where we did the Epic adding namespaces to all test files), that was able to detect some of the cases. Maybe we should consider this within the "namespaces" epic, now that we have the apix.json in core and other things and start enforcing that area globally.
I'd say that "namespaces" and "phpdoc" should be our 2 very next areas in moodle-cs.
The
bar
class import is unused and should be:Drupal have a sniff for this:
https://packagist.org/packages/drupal/coder
https://git.drupalcode.org/project/coder/-/blob/8.3.x/coder_sniffer/Drupal/Sniffs/Classes/UnusedUseStatementSniff.php
It's been proposed for import into SquizLabs here:
squizlabs/PHP_CodeSniffer#1106
It's also part of the SlevoMat sniffs:
https://github.com/slevomat/coding-standard/blob/master/doc/namespaces.md#slevomatcodingstandardnamespacesunuseduses-
The text was updated successfully, but these errors were encountered: