Feature #19

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

Added by Robert Lemke over 12 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Object
Target version:
-
Start date:
Due date:
% Done:

0%

PHP Version:
Has patch:
Complexity:

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 - over 12 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 over 12 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 almost 12 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 almost 12 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 over 11 years ago

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

#6 Updated by Robert Lemke over 11 years ago

  • Target version deleted (1)

#7 Updated by Robert Lemke about 11 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