[dev] Horde_Core_Factory_Base and E_STRICT
Michael M Slusarz
slusarz at horde.org
Wed Jul 6 16:03:07 UTC 2011
Quoting Chuck Hagenbuch <chuck at horde.org>:
> Quoting Michael M Slusarz <slusarz at horde.org>:
>
>> Quoting Gunnar Wrobel <wrobel at horde.org>:
>>
>>> Hi!
>>>
>>> The class "Horde_Core_Factory_Base" implements the method
>>> "create()" but nearly all derived factories use a method with
>>> additional parameters ($driver, $params, etc) which is not
>>> E_STRICT. What is the idea of "Horde_Core_Factory_Base" and the
>>> base "create()" method? Can it simply be removed? Or is just a
>>> problem on my side?
>>
>> This is super-annoying on PHP's part. By removing the create()
>> definition in Horde_Core_Factory_Base, there is now NO indication
>> that a subclass needs to implement a create() method by looking at
>> the generated documentation for HCF_Base.
>>
>> Not sure if there is a way to indicate this via phpdoc, but at a
>> minimum I think we need to at least implement the class in HCF_Base
>> and then comment it out.
>
> What is the point of Horde_Core_Factory_Base? I'd be inclined to remove it.
No. This has already been discussed at length previously on the list.
The problem is that we call injectors two different ways:
$injector->getInstance('Foo')
$injector->getInstance('Foo2')->create($param1, $param2)
They are NOT interchangable. In the second instance, the constructor
will store a copy of the injector in a private variable ($_injector).
Previously, EVERY injector factory that used that pattern had to
define both the private variable and the constructor. Now it is done
by the base class (as it should be).
On a non-technical level, it gives a quick indication which injector
format to use (by looking at the class name). This is what I use to
determine how to call injectors.
michael
___________________________________
Michael Slusarz [slusarz at horde.org]
More information about the dev
mailing list