[TYPO3-core] Suggestion about use statement

Jigal van Hemert jigal.van.hemert at typo3.org
Fri Feb 7 11:34:53 CET 2014


On 7-2-2014 10:48, Stephan Schuler wrote:

> And on top of that: There's a reason why we call a thing not just
> File
> or \File but \TYPO3\CMS\Extbase\Domain\Model\File.
> It's not to have a complete description of something right inside of
> its class name. I's to have a chance to identify different things that
> both are "Files" in some ways. Current example is FAL. When dealing with
> FAL, you pretty often need to decide if it's a
> \TYPO3\CMS\Extbase\Domain\Model\File or a \TYPO3\CMS\Core\Resource\File
> -- and both have no common parent at all.

You can define suitable aliases.
use \TYPO3\CMS\Extbase\Domain\Model\File as falFileModel;

Don't be tempted to
use \TYPO3\CMS\Core\Utility\GeneralUtility as t3lib_div;

Although it adds to the confusion, it will certainly make shorter code 
lines which are just easier to read.

So far, limited use of "use" makes code much more readable. If we stick 
to often-used classes it's not hard to read.

Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org

More information about the TYPO3-team-core mailing list