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

Runtime issue #2

Closed
remicollet opened this Issue Mar 31, 2015 · 22 comments

Comments

Projects
None yet
2 participants
@remicollet

remicollet commented Mar 31, 2015

 $ umlwriter diagram:render --processor reflect --processor graphviz .

 Fatal error: Call to undefined method Bartlett\Reflect\Model\FunctionModel::isTrait() in /usr/share/php/Bartlett/UmlWriter/Processor/AbstractProcessor.php on line 163

 Call Stack:
     0.0001     500376   1. {main}() /usr/bin/umlwriter:0
     0.0057    1993488   2. Symfony\Component\Console\Application->run() /usr/bin/umlwriter:36
     0.0074    2379256   3. Symfony\Component\Console\Application->doRun() /usr/share/php/Symfony/Component/Console/Application.php:124
     0.0074    2380144   4. Symfony\Component\Console\Application->doRunCommand() /usr/share/php/Symfony/Component/Console/Application.php:193
     0.0074    2380616   5. Symfony\Component\Console\Command\Command->run() /usr/share/php/Symfony/Component/Console/Application.php:889
     0.0076    2385296   6. Bartlett\UmlWriter\Console\Command\DiagramRender->execute() /usr/share/php/Symfony/Component/Console/Command/Command.php:253
     0.0496    7610352   7. Bartlett\UmlWriter\Processor\AbstractProcessor->render() /usr/share/php/Bartlett/UmlWriter/Console/Command/DiagramRender.php:99
     0.0497    7613888   8. Bartlett\UmlWriter\Processor\AbstractProcessor->writeObjectElement() /usr/share/php/Bartlett/UmlWriter/Processor/AbstractProcessor.php:113
@remicollet

This comment has been minimized.

Show comment
Hide comment
@remicollet

remicollet Mar 31, 2015

Tested with phpreflect 3.0.0dev revison 2c88d1a

remicollet commented Mar 31, 2015

Tested with phpreflect 3.0.0dev revison 2c88d1a

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Remi,
Can you specify what source you analyze. I got no error on my side !

Owner

llaville commented Mar 31, 2015

Remi,
Can you specify what source you analyze. I got no error on my side !

@remicollet

This comment has been minimized.

Show comment
Hide comment
@remicollet

remicollet Mar 31, 2015

Can you specify what source you analyze.

doctrine/instantiator 1.0.4
symfony/console 2.5.10

remicollet commented Mar 31, 2015

Can you specify what source you analyze.

doctrine/instantiator 1.0.4
symfony/console 2.5.10

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Found notice errors produced by php-reflect on symfony/console 2.5.10 (so a fix is required), but I got no error on doctrine/instantiator 1.0.4 (strange for this last case)

Owner

llaville commented Mar 31, 2015

Found notice errors produced by php-reflect on symfony/console 2.5.10 (so a fix is required), but I got no error on doctrine/instantiator 1.0.4 (strange for this last case)

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Symfony/Console produced error when analysing source code but found unit tests. This is of course a bad practice to mixed source code and unit test cases ( but it's not my fault here ).

So when php-reflect analyse source test ( I did not test it myself since a long time, so it's my fault here ), it raise a notice error

Notice: Undefined property: PhpParser\Node\Name\FullyQualified::$name in php-reflect\src\Bartlett\Reflect\Analyser\AbstractAnalyser.php on line 159

I'll push a fix on php-reflect right away !

Owner

llaville commented Mar 31, 2015

Symfony/Console produced error when analysing source code but found unit tests. This is of course a bad practice to mixed source code and unit test cases ( but it's not my fault here ).

So when php-reflect analyse source test ( I did not test it myself since a long time, so it's my fault here ), it raise a notice error

Notice: Undefined property: PhpParser\Node\Name\FullyQualified::$name in php-reflect\src\Bartlett\Reflect\Analyser\AbstractAnalyser.php on line 159

I'll push a fix on php-reflect right away !

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Update your copy. With php-reflect commit llaville/php-reflect@8ca26b0, all should be fine now.

Thanks Remi for your feedback

Owner

llaville commented Mar 31, 2015

Update your copy. With php-reflect commit llaville/php-reflect@8ca26b0, all should be fine now.

Thanks Remi for your feedback

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

And I understand now, probably, why I'm not error on doctrine/instantiator. In this case I've analysed only source code, and not full package that include unit tests (but distinct from source : good practice)

Owner

llaville commented Mar 31, 2015

And I understand now, probably, why I'm not error on doctrine/instantiator. In this case I've analysed only source code, and not full package that include unit tests (but distinct from source : good practice)

@remicollet

This comment has been minimized.

Show comment
Hide comment
@remicollet

remicollet Mar 31, 2015

Notice: I run the test in the sources tree without the tests.

Update

   - Updating bartlett/php-reflect 3.0.x-dev (342c12f => 8ca26b0)
     The package has modified files:
     M bin/phpreflect
     Discard changes [y,n,v,s,?]? y
     Checking out 8ca26b0c84316648d5f3c1924059580109be0e9f

Test, same error:

 $ php /tmp/umlwriter/bin/umlwriter diagram:render --reflector=reflect --processor=graphviz .

 Fatal error: Call to undefined method Bartlett\Reflect\Model\FunctionModel::isTrait() in /tmp/umlwriter/src/Bartlett/UmlWriter/Processor/AbstractProcessor.php on line 163

remicollet commented Mar 31, 2015

Notice: I run the test in the sources tree without the tests.

Update

   - Updating bartlett/php-reflect 3.0.x-dev (342c12f => 8ca26b0)
     The package has modified files:
     M bin/phpreflect
     Discard changes [y,n,v,s,?]? y
     Checking out 8ca26b0c84316648d5f3c1924059580109be0e9f

Test, same error:

 $ php /tmp/umlwriter/bin/umlwriter diagram:render --reflector=reflect --processor=graphviz .

 Fatal error: Call to undefined method Bartlett\Reflect\Model\FunctionModel::isTrait() in /tmp/umlwriter/src/Bartlett/UmlWriter/Processor/AbstractProcessor.php on line 163
@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Strange behavior: I've got no such error, but a more readable (that tell me something)

PHP Notice: Undefined property: PhpParser\Node\Stmt\Trait_::$extends in umlwriter\vendor\bartlett\php-reflect\src\Bartlett\Reflect\Model\ClassModel.php on line 104

Another cas to fix in php-reflect. Migration to nikic/php-parser 1.2.1 (+patch), let me discover some new bugs, that I won't see before. Of course it's on my side !

Owner

llaville commented Mar 31, 2015

Strange behavior: I've got no such error, but a more readable (that tell me something)

PHP Notice: Undefined property: PhpParser\Node\Stmt\Trait_::$extends in umlwriter\vendor\bartlett\php-reflect\src\Bartlett\Reflect\Model\ClassModel.php on line 104

Another cas to fix in php-reflect. Migration to nikic/php-parser 1.2.1 (+patch), let me discover some new bugs, that I won't see before. Of course it's on my side !

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Use php-reflect with new commit llaville/php-reflect@7efd1d0

Owner

llaville commented Mar 31, 2015

Use php-reflect with new commit llaville/php-reflect@7efd1d0

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

I've invoke umlwriter diagram:render command on full contents of doctrine/instantiator 1.0.4 (that have Trait), and symfony/console 2.5.10 (that have unit tests inside source code), and don't see any other notice errors.

Owner

llaville commented Mar 31, 2015

I've invoke umlwriter diagram:render command on full contents of doctrine/instantiator 1.0.4 (that have Trait), and symfony/console 2.5.10 (that have unit tests inside source code), and don't see any other notice errors.

@remicollet

This comment has been minimized.

Show comment
Hide comment
@remicollet

remicollet Mar 31, 2015

 Updating bartlett/php-reflect 3.0.x-dev (8ca26b0 => 7efd1d0)

Same issue.

remicollet commented Mar 31, 2015

 Updating bartlett/php-reflect 3.0.x-dev (8ca26b0 => 7efd1d0)

Same issue.

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Same source code analysed ?

Owner

llaville commented Mar 31, 2015

Same source code analysed ?

@remicollet

This comment has been minimized.

Show comment
Hide comment
@remicollet

remicollet Mar 31, 2015

Yes, doctrine/instantiator

remicollet commented Mar 31, 2015

Yes, doctrine/instantiator

@remicollet

This comment has been minimized.

Show comment
Hide comment
@remicollet

remicollet Mar 31, 2015

It seems the error comes from the generated autoloader in the doctrine/instantor code which is a closure (removing this file solves the issue)

$ phpab --output sources/autoload.php sources

This file contains:

 <?php
 // @codingStandardsIgnoreFile
 // @codeCoverageIgnoreStart
 // this is an autogenerated file - do not edit
 spl_autoload_register(
     function($class) {
         static $classes = null;
         if ($classes === null) {
             $classes = array(
                 'doctrine\\instantiator\\exception\\exceptioninterface' => '/Exception/ExceptionInterface.php',
                 'doctrine\\instantiator\\exception\\invalidargumentexception' => '/Exception/InvalidArgumentException.php',
                 'doctrine\\instantiator\\exception\\unexpectedvalueexception' => '/Exception/UnexpectedValueException.php',
                 'doctrine\\instantiator\\instantiator' => '/Instantiator.php',
                 'doctrine\\instantiator\\instantiatorinterface' => '/InstantiatorInterface.php'
             );
         }
         $cn = strtolower($class);
         if (isset($classes[$cn])) {
             require __DIR__ . $classes[$cn];
         }
     }
 );
 // @codeCoverageIgnoreEnd

remicollet commented Mar 31, 2015

It seems the error comes from the generated autoloader in the doctrine/instantor code which is a closure (removing this file solves the issue)

$ phpab --output sources/autoload.php sources

This file contains:

 <?php
 // @codingStandardsIgnoreFile
 // @codeCoverageIgnoreStart
 // this is an autogenerated file - do not edit
 spl_autoload_register(
     function($class) {
         static $classes = null;
         if ($classes === null) {
             $classes = array(
                 'doctrine\\instantiator\\exception\\exceptioninterface' => '/Exception/ExceptionInterface.php',
                 'doctrine\\instantiator\\exception\\invalidargumentexception' => '/Exception/InvalidArgumentException.php',
                 'doctrine\\instantiator\\exception\\unexpectedvalueexception' => '/Exception/UnexpectedValueException.php',
                 'doctrine\\instantiator\\instantiator' => '/Instantiator.php',
                 'doctrine\\instantiator\\instantiatorinterface' => '/InstantiatorInterface.php'
             );
         }
         $cn = strtolower($class);
         if (isset($classes[$cn])) {
             require __DIR__ . $classes[$cn];
         }
     }
 );
 // @codeCoverageIgnoreEnd
@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Well, as this code is not include in source code distrib, this is the reason I can't reproduce issue.

With this snippet code, I got this time the

PHP Fatal error: Call to undefined method Bartlett\Reflect\Model\FunctionModel::isTrait()

Owner

llaville commented Mar 31, 2015

Well, as this code is not include in source code distrib, this is the reason I can't reproduce issue.

With this snippet code, I got this time the

PHP Fatal error: Call to undefined method Bartlett\Reflect\Model\FunctionModel::isTrait()

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Ok found origin of issue !
In AbstractProcessor, and common render() method, when we proceed all objects grabbed from reverse-engine that include (class, interface, trait, but also user function and closure).

No way on UML class diagram for functions, so I'll fix this time only the umlWriter

Owner

llaville commented Mar 31, 2015

Ok found origin of issue !
In AbstractProcessor, and common render() method, when we proceed all objects grabbed from reverse-engine that include (class, interface, trait, but also user function and closure).

No way on UML class diagram for functions, so I'll fix this time only the umlWriter

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

This affect only the Bartlett/Reflect reflector and not Andrewsville/PHP-Token-Reflection (cool ;-)

Owner

llaville commented Mar 31, 2015

This affect only the Bartlett/Reflect reflector and not Andrewsville/PHP-Token-Reflection (cool ;-)

llaville added a commit that referenced this issue Mar 31, 2015

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Ok this time we should got it !

Owner

llaville commented Mar 31, 2015

Ok this time we should got it !

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

at one details ... forget to filter classes collection on user function and closure : see commit 4b66240

Owner

llaville commented Mar 31, 2015

at one details ... forget to filter classes collection on user function and closure : see commit 4b66240

@remicollet

This comment has been minimized.

Show comment
Hide comment
@remicollet

remicollet Mar 31, 2015

Thanks, I confirm the issue is fixed.

remicollet commented Mar 31, 2015

Thanks, I confirm the issue is fixed.

@llaville

This comment has been minimized.

Show comment
Hide comment
@llaville

llaville Mar 31, 2015

Owner

Nice to hear :)

Owner

llaville commented Mar 31, 2015

Nice to hear :)

@llaville llaville closed this Mar 31, 2015

@llaville llaville added the bug label Mar 31, 2015

@llaville llaville self-assigned this Mar 31, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment