Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Death by Exception when processing aliased Trait methods #141

Closed
crussell52 opened this issue May 2, 2012 · 0 comments
Closed

Death by Exception when processing aliased Trait methods #141

crussell52 opened this issue May 2, 2012 · 0 comments
Assignees
Labels
Milestone

Comments

@crussell52
Copy link

If APIGen tries to parse a class which uses a Trait and aliases a method, then it dies with the following error:

Argument 1 passed to ApiGen\Template::getMethodUrl() must be an instance of ApiGen\ReflectionMethod, null given

Here is the relevant portion of the debug output (some directories are masked since this is on a work server):

 <table class="summary used">
        <caption>Methods used from <a href="class-MyTrait.html#methods">MyTrait</a></caption>
        <tr>
                <td><code>
                        <a href="exception 'Nette\FatalErrorException' with message 'Undefined index: method' in **masked**/apigen/tmp/_Nette.FileTemplate/_default.class.latte-bf9a3b2bc36ac0e2d3288ca7da180b0e.php:279
Stack trace:
#0 /**masked**/apigen/tmp/_Nette.FileTemplate/_default.class.latte-bf9a3b2bc36ac0e2d3288ca7da180b0e.php(279): Nette\Diagnostics\Debugger::_errorHandler(8, 'Undefined index...', '/**masked**/...', 279, Array)
#1 /**masked**/lib/php/Nette/Latte/Macros/UIMacros.php(468): _lba55ed11aa9_content(Object(stdClass), Array)
#2 /**masked**/apigen/tmp/_Nette.FileTemplate/_default._layout.latte-42e64b94e3d7900db6647b9f4e80b34f.php(226): Nette\Latte\Macros\UIMacros::callBlock(Object(stdClass), 'content', Array)
#3 /**masked**/lib/php/Nette/Utils/LimitedScope.php(73): include('/**masked**/...')
#4 /**masked**/lib/php/Nette/Templating/FileTemplate.php(119): Nette\Utils\LimitedScope::load('/**masked**/...', Array)
#5 /**masked**/apigen/tmp/_Nette.FileTemplate/_default.class.latte-bf9a3b2bc36ac0e2d3288ca7da180b0e.php(513): Nette\Templating\FileTemplate->render()
#6 /**masked**/lib/php/Nette/Utils/LimitedScope.php(73): include('/**masked**/...')
#7 /**masked**/lib/php/Nette/Templating/FileTemplate.php(119): Nette\Utils\LimitedScope::load('/**masked**/...', Array)
#8 /**masked**/lib/php/Nette/Templating/Template.php(125): Nette\Templating\FileTemplate->render()
#9 /**masked**/lib/php/Nette/Templating/Template.php(108): Nette\Templating\Template->__toString(true)
#10 /**masked**/lib/php/ApiGen/Generator.php(1284): Nette\Templating\Template->save('/**masked**/...')
#11 /**masked**/lib/php/ApiGen/Generator.php(449): ApiGen\Generator->generateElements(Object(ApiGen\Template))
#12 /**masked**/bin/apigen(207): ApiGen\Generator->generate()
#13 {main}

To reproduce, create a file with the following code and attempt to run apigen against it:

<?php

trait MyTrait
{
  public $myVar;

  public function myMethod()
  {
    // Do something.
  }
}

class Foo
{
  use MyTrait
  {
    MyTrait::myMethod as myAliasedMethod;
  }

  function myMethod()
  {
    // Do local stuff.
    // Run trait method.
    $this->myAliasedMethod();
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants