Aliasing a namespace name
| Aliasing a class name
|
While both options are useful developers will probably prefer to use the one over the other in different cases. For example if your script imports many classes declared in one namespace, only one namespace can be imported avoiding the need to import each class separately.
Option A:
use \ns1\ns11\ns111\c1;
use \ns1\ns11\ns111\c2;
use \ns1\ns11\ns111\c3;
use \ns1\ns11\ns111\c4;
use \ns1\ns11\ns111\c5;
$v = new c1(new c2(new c3(new c4(new c5()))))
Option B:
use \ns1\ns11\ns111;
$v = new ns111\c1(new ns111\c2(new ns111\c3(new ns111\c4(new ns111\c5()))))
How Eclipse PDT should complete your "use" statement?
A real cool feature in Eclipse PDT is that use statements are completed automatically for you. The question is what method should be considered:
1. Aliasing a class name
2. Aliasing a namespace name
3. Depends on the case, what are the different cases?
Vote here: http://twtpoll.com/omuaqn
1 comment:
option A is much more readable and faster to write.
Post a Comment