Re: Class and interface location

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

 



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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux