[TYPO3-mvc] RFC #8718: throw exception if a class to be reflected does not exist

Bastian Waidelich bastian at typo3.org
Fri Jul 9 18:11:17 CEST 2010


Felix Oertel wrote:

Hi Felix,

 > just for me to get your point: why should the reflectionService return
 > NULL if you try to reflect a class which does not exist? in my eyes an
 > exception would perfectly do the job to tell something goes wrong ...

Because it's backwards compatible then.
I got you wrong - I thought you were talking about changing 
getClassSchema(), sorry.
But still - throwing an exception here for non-existing classes will 
change the behaviour of getClassSchema() even though buildClassSchema() 
is protected:
$reflectionService->getClassSchema('NonExistingClass');
returns NULL in FLOW3 and would throw an exception in v4, right?

But you're right. Maybe it _does_ make more sense to throw an exception 
here. But then we'll have to check the implications (e.g. does any of 
the core classes depend on getClassSchema() to return NULL for 
nonexisting classes).


 > if it's just about the sync: this will not bring us into sync anyway.
 > ;-) in FLOW3 it's plural buildClassSchemata(array $classes) in extbase
 > singular buildClassSchema(string $className).

True, and the class name in extbase is different as well (*_Service 
instead of *_ReflectionService)..
But it seems that the public functions are similar - and that's what is 
important for consistency and migrations.

Best
Bastian


More information about the TYPO3-project-typo3v4mvc mailing list