Re: [RFC][VOTE] Group Use Declarations

From: Date: Fri, 13 Feb 2015 22:42:32 +0000
Subject: Re: [RFC][VOTE] Group Use Declarations
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message

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

Thread (45 messages)

« previous php.internals (#82646) next »