[TYPO3-core] Suggestion about use statement

Markus Klein klein.t3 at mfc-linz.at
Thu Feb 6 10:41:52 CET 2014


> 
> On 02/06/2014 10:31 AM, Markus Klein wrote:
> >
> > 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
> 
> [...]
> 
> Personally I think that doing it for "every" class and on first occurence would
> be a bit too much. But I'm not against it.
It is actually more work to not do it everywhere since autocompletion of PHPStorm will take care of everything automatically.

Just start typing GeneralUti and hit CTRL+Space. You end up with the line GeneralUtility and a use statement on top.

> 
> What I suggested a while back was to at least backport the one large patch
> that added "use"-statements in various places. This would have saved us
> some trouble on backports in the past at least.
> 
> 
> Kind regards,
>  Stefan

~Markus



More information about the TYPO3-team-core mailing list