Hi.

Within the current PSR-5 and PSR-19 standards, there is no mechanism to 
document which method are handled by __call() and __callStatic() that 
return an instance of the subclass.

<?php

/**
 * Class HandlingClass
 *
 * Current design of PSR-5/PSR-19
 * @method static RickRollMe() Am I statically called? Or do I return an 
instance of the subclass
 * @method static RickRollYou() Am I statically called? Or do I return an 
instance of the subclass
 *
 * Proposed design
 * @method RickRollMe():static I am an instance method that returns an 
instance of the subclass
 * @method static RickRollYou():static I am a statically called method that 
returns an instance of the subclass
 */
abstract class HandlingClass
{
    public function __call($name, $arguments)
    {
        // I'll handle RickRollMe(): static
    }

    public static function __callStatic($name, $arguments)
    {
        // I'll handle RickRollYou(): static
    }
}


Also, now that PHP's documentation correctly places the return type in the 
same location as how a new developer would write it if they were to copy 
the signature to their code, shouldn't the standard for `@method` be the 
same?

Yes. I know. Not how it has been before. But we didn't have parameter type 
hints, return type, magic methods ... how far back do we need to go?

So, moving FORWARD to match the actual experience of a new PHP developer, 
not having to question why things don't match up ... a far better goal 
methinks.

Regards,

Richard Quadling.

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/39b9fa76-989c-489f-a894-2895a9cdff87%40googlegroups.com.

Reply via email to