Coder recently added a sniff to check if root namespace classes (or interfaces or traits) are fully namespaced. As a consequence, the following code does not pass the sniff.
use Twig_Extension;
use Twig_SimpleFilter;
new Twig_Extension();
The new sniffs check that the code references classes in the root namespace use the full name and not get imported.
new \Twig_Extension();
However, this causes an issue with phpmd: the above example will not pass phpmd's cleancode rules.
There is no workaround to this situation except bypassing checks (git commit -n).
We should adhere to Drupal's coding standards, or at least, coder's interpretation of Drupal's coding standards in this case. The fix would be to exclude this specific rule from phpmd.
Coder recently added a sniff to check if root namespace classes (or interfaces or traits) are fully namespaced. As a consequence, the following code does not pass the sniff.
The new sniffs check that the code references classes in the root namespace use the full name and not get imported.
However, this causes an issue with phpmd: the above example will not pass phpmd's
cleancode
rules.There is no workaround to this situation except bypassing checks (
git commit -n
).We should adhere to Drupal's coding standards, or at least, coder's interpretation of Drupal's coding standards in this case. The fix would be to exclude this specific rule from phpmd.