[TYPO3-core] Suggestion about use statement
Markus Klein
klein.t3 at mfc-linz.at
Thu Feb 6 10:31:48 CET 2014
Hi!
I’d like to bring a topic out for discussion that regularly causes problems for us.
The ‘use’ statement.
Our current procedure is to make use of the ‘use’ statement when we use a class more than 10 times in one file.
This has the disadvantages that we have inconsistent code from file to file where the usage numbers varies and we always have troubles with backports where the ‘use’ statement is not present in the other branches.
Therefore I propose to use the 'use' EVERYWHERE and ALWAYS in ALL branches.
e.g. 'use' a class already when it's first used
This has the following benefits for us:
- One can see all used classes being used in one file already at the top of the file
- No troubles on backports anymore, because we have it in all branches
- Much shorter and thereby readable code
- PHPStorm and other IDEs automatically take care of the 'use' statement when using a class
My suggestion on how to implement this change:
When touching a line in a file that still has a full namespace specified, simply let the IDE do the work and let it add the 'use' statement and convert all other places which still use the full namespace.
What do you think?
Kind regards
Markus
------------------------------------------------------------
Markus Klein
TYPO3 CMS Active Contributors Team Member
More information about the TYPO3-team-core
mailing list