I'm working on a code quality automation with phpmd
, phpcs
and phpcpd
tools. The code sniffer has been set to --standard=PSR12
.
I was unable to find any details or recommendations in terms of the way how namespace imports and aliases should be defined:
- grouping with curly brackets or defining each one in a separate way (which at the moment is my biased suggestion)
- A-Z sorting
Eg:
use Foo\Bar\{ Lorem, Ipsum, Dolor };
vs:
use Foo\Bar\Dolor;
use Foo\Bar\Ipsum;
use Foo\Bar\Lorem;
If there's no standard recommendation I'm going to establish internal rule within my team, but if there is any, I'm happy to obey it.