You could very well argue that this is what relative syntax is for:
use PhpParser\NodeVisitorAbstract;
use PhpParser\Error;
use PhpParser\Node;
use PhpParser\Node\Stmt;
use PhpParser\Node\Expr;
then foo(Expr\New_ $expr)
That is even more readable and cleaner to read.
+1
The current namespace implementation is there to group code, which is
already does fairly successfully.
I have to wonder if it is PHPStorm, IDE's and the like that have
"encouraged" people to only _use_ class names instead of a particular
part of a namespace (even if it is up to the last fragment of the
namespace name). That is a behavior I'd like to see curtailed in the PHP
community, b/c as Benjamin points out above, syntax that uses up to the
last NS fragment is far more succinct.
Question:
If curly braces are used to mimic block syntax, is the semicolon also
allowed? i.e:
use PhpParser:
NodeVisitorAbstract, Error, Node;
use PhpParser\Node:
Name, Name\FullyQualified;
use PhpParser\Node\Stmt:
Namespace_, Use_, Class_, Interface_, Trait_, Function_,
Const_, Catch_, TraitUse, TraitUseAdaptation\Precedence;
use PhpParser\Node\Expr:
StaticCall, StaticPropertyFetch, ClassConstFetch, New_,
Instanceof_, FuncCall, ConstFetch;
Is this something that should be considered?
-ralph
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php