[TYPO3-core] Wrapper methods around globals?

Markus Klein klein.t3 at mfc-linz.at
Thu Apr 3 16:34:15 CEST 2014


Hi,

I'd appreciate it much more to not have any global stuff remaining. So no need for PhpStorm to support this.
Imagine we have getters for all global objects and pass these objects via constructors / setters.
Then you have perfectly modularized code which further eases testing.
Let's do the same with all the static classes. (eg. GeneralUtility::syslog() can't be mocked currently, but will be replaced by Logger anyway ;-))

Just my2cents

Kind regards
Markus

------------------------------------------------------------
Markus Klein
TYPO3 CMS Active Contributors Team Member

> -----Original Message-----
> From: typo3-team-core-bounces at lists.typo3.org [mailto:typo3-team-core-
> bounces at lists.typo3.org] On Behalf Of Nicole Cordes
> Sent: Thursday, April 03, 2014 4:00 PM
> To: 'TYPO3 core team'
> Subject: Re: [TYPO3-core] Wrapper methods around globals?
> 
> Hi,
> 
> I can't say anything about the performance but we used to do this for unit
> testing as this ist he only way tob e able to mock certain global variables.
> 
> Hopefully there will be some other solutions for GLOBALS in IDE asap.
> 
> BTW: I was thinking about an core PhpStorm meta data file which we could
> provide as well?
> 
> 
> Best regards,
> Nicole
> 
> --
> Nicole Cordes
> TYPO3 CMS Active Contributor
> 
> TYPO3 .... inspiring people to share!
> Get involved: typo3.org
> 
> -----Ursprüngliche Nachricht-----
> Von: typo3-team-core-bounces at lists.typo3.org
> [mailto:typo3-team-core-bounces at lists.typo3.org] Im Auftrag von Dmitry
> Dulepov
> Gesendet: Donnerstag, 3. April 2014 08:54
> An: typo3-team-core at lists.typo3.org
> Betreff: Re: [TYPO3-core] Wrapper methods around globals?
> 
> Hi!
> 
> François Suter wrote:
> > In a patch I submitted this morning [1], I added a wrapper method
> > around $GLOBALS['BE_USER'], because it makes it much easier to work
> > with such globals in an IDE, having type hinting and code completion.
> > I did it because I saw other places in the Core using this way of
> > doing
> this.
> >
> > Now Kay Strobach thinks this should not be done for performance reasons.
> 
> I do not think that a function call to return a variable vs access the variable
> directly would be comparable in performance impact to any of hundreds
> useless database calls we do during user auth for each request.
> So, I say, go for your change. It is useful.
> 
> --
> Dmitry Dulepov
> 
> Today is a good day to have a good day.
> _______________________________________________
> Before posting to this list, please have a look to the posting rules on the
> following websites:
> 
> http://typo3.org/teams/core/core-mailinglist-rules/
> http://typo3.org/development/bug-fixing/diff-and-patch/
> _______________________________________________
> TYPO3-team-core mailing list
> TYPO3-team-core at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-team-core
> 
> _______________________________________________
> Before posting to this list, please have a look to the posting rules on the
> following websites:
> 
> http://typo3.org/teams/core/core-mailinglist-rules/
> http://typo3.org/development/bug-fixing/diff-and-patch/
> _______________________________________________
> TYPO3-team-core mailing list
> TYPO3-team-core at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-team-core



More information about the TYPO3-team-core mailing list