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

Trait in Trait causes UnitObjectException if the nested trait is missing #243

Closed
maikgreubel opened this issue Aug 26, 2015 · 3 comments
Closed
Assignees
Labels

Comments

@maikgreubel
Copy link

I have a trait "Generics\Util\Interpolator" which is used in another trait "OrmConnection". This causes problems in documentation generation with the following trace:

 [exec] phpDox 0.8.2-dev - Copyright (C) 2010 - 2015 by Arne Blankerts
 [exec]
 [exec] [26.08.2015 - 13:07:54] Using config file './phpdox.xml'
 [exec] [26.08.2015 - 13:07:54] Registered collector backend 'parser'
 [exec] [26.08.2015 - 13:07:54] Registered enricher 'build'
 [exec] [26.08.2015 - 13:07:54] Registered enricher 'git'
 [exec] [26.08.2015 - 13:07:54] Registered enricher 'checkstyle'
 [exec] [26.08.2015 - 13:07:54] Registered enricher 'phpcs'
 [exec] [26.08.2015 - 13:07:54] Registered enricher 'pmd'
 [exec] [26.08.2015 - 13:07:54] Registered enricher 'phpunit'
 [exec] [26.08.2015 - 13:07:54] Registered enricher 'phploc'
 [exec] [26.08.2015 - 13:07:54] Registered output engine 'xml'
 [exec] [26.08.2015 - 13:07:54] Registered output engine 'html'
 [exec] [26.08.2015 - 13:07:54] Loading bootstrap file 'D:/web/caribu/vendor/autoload.php'
 [exec] [26.08.2015 - 13:07:54] Starting to process project 'Caribu API Documentation'
 [exec] [26.08.2015 - 13:07:54] Starting collector
 [exec] [26.08.2015 - 13:07:54] Scanning directory 'D:/web/caribu/src' for files to process
 [exec]
 [exec] .............                                       [13]
 [exec]
 [exec] [26.08.2015 - 13:07:55] Saving results to directory 'D:/web/caribu/build/api/xml'
 [exec] [26.08.2015 - 13:07:56] Resolving inheritance
 [exec]
 [exec]
 [exec]
 [exec] Oups... phpDox encountered a problem and has terminated!
 [exec]
 [exec] It most likely means you've found a bug, so please file a report for this
 [exec] and paste the following details and the stacktrace (if given) along:
 [exec]
 [exec] PHP Version: 5.6.6 (WINNT)
 [exec] PHPDox Version: 0.8.2-dev
 [exec] Exception: TheSeer\phpDox\Collector\UnitObjectException (Code: 7)
 [exec] Location: D:\web\caribu\vendor\theseer\phpdox\src\collector\project\AbstractUnitObject.php (Line 347)
 [exec]
 [exec] No dependency "Generics\Util\Interpolator" found in unit Nkey\Caribu\Model\AbstractModel
 [exec]
 [exec] #0 D:\web\caribu\vendor\theseer\phpdox\src\Application.php(145): TheSeer\phpDox\Collector\InheritanceResolver->resolve()
 [exec] #1 D:\web\caribu\vendor\theseer\phpdox\src\CLI.php(161): TheSeer\phpDox\Application->runCollector()
 [exec] #2 D:\web\caribu\vendor\theseer\phpdox\phpdox(68): TheSeer\phpDox\CLI->run()
 [exec]
 [exec]
 [exec]
 [exec] Result: 5

The class Nkey\Caribu\Model\AbstractModel uses the trait indirectly by extending the class "Orm" which uses the trait "OrmTransaction", and this trait uses "OrmConnection". So we have this inheritance chain:

[abstract class] AbstractModel
EXTENDS [class] Orm
USE [trait] OrmTransaction
USE [trait] OrmConnection
USE [trait] Interpolator

No problems for PHPUnit and Eclipse but for phpdox. I can only solve the issue by removing the "use Interpolator" from OrmConnection trait and insert that code into Orm class. This is working but the wrong place for the use of trait.

@theseer theseer added the Bug label Sep 9, 2015
@theseer theseer self-assigned this Sep 9, 2015
@edrush
Copy link

edrush commented Nov 26, 2015

Have the same problem...

dereckson added a commit to nasqueron/auth-grove that referenced this issue Jul 12, 2016
Summary:
This is a wordaround to get solve phpdox issue,
see theseer/phpdox#243.

Test Plan: `phpunit && phpdox`

Reviewers: dereckson

Differential Revision: https://devcentral.nasqueron.org/D517
@hlorofos
Copy link

Prioritize to fix please

@theseer
Copy link
Owner

theseer commented Aug 11, 2016

I finally found some time to debug this some more and it turns out, the bug description is wrong:
The bug is not about the fact a trait is used within a trait but rather the nested used trait cannot be found - as the error message sort of hints at.

This is true for both reported cases.

That is because the used "missing" trait is not part of the actually processed codebase but at least for the 2nd reported case comes from a dependency installed via composer.

The fact phpDox is crashing on that is of course still a bug.

@theseer theseer changed the title Trait in Trait causes UnitObjectException Trait in Trait causes UnitObjectException if the nested trait is missing Aug 11, 2016
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

4 participants