Feature #19

Add a feature for replacing "new" with "getComponent" in php source files

Added by Robert Lemke over 8 years ago. Updated almost 5 years ago.

Status:Closed Start date:
Priority:Should have Due date:
Assigned To:Robert Lemke % Done:

0%

Category:Object
Target version:-
PHP Version: Complexity:
Has patch:

Description

The AOP Framework should have a feature (which can be enabled through the Component configuration) which results in parsing the php source files and replace the new operator with a getComponent call. These modified files should be written into the FileCache and the modified classes used as the parent class for AOP proxies or, if no such proxy exists, registered as the implementation class of the component with that class name.

History

#1 Updated by Sudara Williams - about 8 years ago

I'm excited by this feature, especially as the default.

It is these kinds of features that really make a framework powerful - doing the heavy lifting in the background and providing a simple and intuitive API for the developers.

#2 Updated by Robert Lemke about 8 years ago

I implemented this feature but after a discussion with Karsten removed it again - at least disabled it by default. I suggest we make it configurable in the Components configuration so it's easy to integrate legacy PHP code.

source:/Packages/Framework/Classes/Component/T3P_Framework_Component_ClassFileManipulator.php#257

#3 Updated by Robert Lemke over 7 years ago

  • Status changed from New to Accepted

Currently this feature does not work and is disabled. Don't forget to either fix or remove it ...

#4 Updated by Malte Jansen over 7 years ago

Note:
The TYPO3CGL validates the Code in the main folder 'Classes' for 'new'.
'new' will be only allowed, if a component is not registered (e.g. PHPUnit or PHP_CodeSniffer).
The folder 'Resources/PHP/' will be ignored.

It's still needs to be discussed, if a Package can be released/published on the TER.
So everybody could be forced to use to CM.

#5 Updated by Malte Jansen about 7 years ago

Notice:
The ComponentManager does not know the classes provided by PHP.
e.g. ArrayObject()

#6 Updated by Robert Lemke about 7 years ago

  • Target version deleted (1)

#7 Updated by Robert Lemke almost 7 years ago

  • Status changed from Accepted to Closed

This feature is postponed for now as we probably find a better solution with spl_factory_register()

Also available in: Atom PDF