On 1/19/11 3:44 PM, David Harkness wrote:
What about creating your own docblock tag such as @plugin-interface? While
it still requires each plugin to explicitly define the interface(s) it
implements, it won't be in the class declaration. This would be very easy to
nab for a tree of files using grep, removing the need to do any static
analysis or parse PHP code.

David

I'm not sure I see the advantage of that over specifying the interface in the code:

/**
 * Bob does stuff.
 *
 * @implements Foo
 */
class Bob implements Foo {

}

Either way developers need to explicitly define which interfaces (of those we care about) the class implements, and we'll have to string parse the file to find the string "Foo". As far as I know the extra implements in the class declaration doesn't hurt PHP, it's just redundant.

And actually, thinking about it, I wonder if requiring the explicit declaration is a good thing anyway because then it's immediately obvious and greppable what the class does. :-)

--Larry Garfield

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to