eloquent / typhoon

Simple, flexible type-checking for PHP.
MIT License
5 stars 0 forks source link

typhoon generates empty validation classes when using a trait with renamed methods #113

Open jmalloc opened 11 years ago

jmalloc commented 11 years ago

The following code does not generate any actual validation code for the RootNode class.

class RootNode implements ParentNodeInterface
{
    use ParentNodeTrait {
        destroy as destroyChildren;
    }

    /**
     * @param EngineInterface $engine The engine to which this node belongs.
     */
    public function __construct(EngineInterface $engine)
    {
        $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());

        $this->engine = $engine;
    }

If I change the use statement to (note the protected keyword):

use ParentNodeTrait {
   destroy as protected destroyChildren;
}

It works.

No error is displayed.

jmalloc commented 11 years ago

To clarify, it does generate the RootNodeTypeCheck class, but it is empty.