[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TYPO3-dev] Hooks with interface

Hi Steffen,

you could create a second interface, which is extended by the old one.

So you just have to check in the code, if the interface is an instanceOf 
  second interface.


interface MyHook {
   some functions...

interface MyBetterHook extends MyHook {
   additional functions...

class MyClass {

   1. load functions with instanceOf MyHook... (there is a PHP-function 
for getting the classes, without reflection)
   2. run MyHook things
      run MyBetterHook things, checking the instanceOf MyBetterHook before.



Steffen Kamper schrieb:
> Hi,
> now we have the rule that new hooks has to come with an interface. That 
> is good as everyone see in interface which hooks are present and how to 
> implement them.
> But - If we extend the interface with a new method, all extensions using 
> the interface won't work any more as they don't have the new method in 
> the hook, which i think is a big problem.
> See as example t3lib_tceformsInlineHook where it will needed one day to 
> implement a new method as the interface is for the complete class.
> How to prevent such future errors?
> vg Steffen
TYPO3-dev mailing list
[email protected]