mihaeu / dephpend

Detect flaws in your architecture, before they drag you down into the depths of dependency hell ...
https://dephpend.com
MIT License
530 stars 26 forks source link

Error running text mode #56

Closed 155martinmoreno closed 5 years ago

155martinmoreno commented 5 years ago

I'm running this command

docker run --rm -v <abs_path>:/inspect mihaeu/dephpend:latest text /inspect

and I'm getting this output

`Something went wrong, this shouldn't happen. Please take a minute and report this issue: https://github.com/mihaeu/dephpend/issues

Argument 1 passed to Mihaeu\PhpDependencies\Analyser\DependencyInspectionVisitor::addName() must be an instance of PhpParser\Node\Name, instance of PhpParser\Node\Expr\PropertyFetch given, called in /dephpend/src/Analyser/DependencyInspectionVisitor.php on line 89

[/dephpend/src/Analyser/DependencyInspectionVisitor.php at line 97]`

mihaeu commented 5 years ago

Oh that looks interesting. Can you share the file where this occurs?

On 17.09.19 13:20, Martín Moreno wrote:

I'm running this command

|docker run --rm -v :/inspect mihaeu/dephpend:latest text /inspect|

and I'm getting this output

`Something went wrong, this shouldn't happen. Please take a minute and report this issue: https://github.com/mihaeu/dephpend/issues

Argument 1 passed to Mihaeu\PhpDependencies\Analyser\DependencyInspectionVisitor::addName() must be an instance of PhpParser\Node\Name, instance of PhpParser\Node\Expr\PropertyFetch given, called in /dephpend/src/Analyser/DependencyInspectionVisitor.php on line 89

[/dephpend/src/Analyser/DependencyInspectionVisitor.php at line 97]`

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mihaeu/dephpend/issues/56?email_source=notifications&email_token=AAQRO7OKDR5CIBWA3WD52BLQKC4PTA5CNFSM4IXONRXKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HL2NHUQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQRO7LOXFB66DLUTG3JB4TQKC4PTANCNFSM4IXONRXA.

155martinmoreno commented 5 years ago

Well, it's a massive project, both in files count and size. Sorry, can't share Could size be related?

Also, is there any verbosity option that could narrow down the search? If it's small enough maybe I can share an extract.

mihaeu commented 5 years ago

No it seems to be a parser problem. All files are syntactically correct?

On 18.09.19 10:51, Martín Moreno wrote:

Well, it's a massive project, both in files count and size. Sorry, can't share Could size be related?

Also, is there any verbosity option that could narrow down the search? If it's small enough maybe I can share an extract.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mihaeu/dephpend/issues/56?email_source=notifications&email_token=AAQRO7MGNH7F5GIJFA5S6NLQKHTXVA5CNFSM4IXONRXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD67KMKA#issuecomment-532588072, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQRO7MCGV6XIPIGQGJFIODQKHTXVANCNFSM4IXONRXA.

155martinmoreno commented 5 years ago

Would say yes, but I'm still trying to get my bearings in the full code. Actually, that's why I'm using this tool.

Will try to split runs in several to see if I can narrow it down.

I'll let you know.

mihaeu commented 5 years ago

Yeah that's what I was going to suggest, something like for file in **/*.php; do dephpend text $file; done

On 18.09.19 11:17, Martín Moreno wrote:

Would say yes, but I'm still trying to get my bearings in the full code. Actually, that's why I'm using this tool.

Will try to split runs in several to see if I can narrow it down.

I'll let you know.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mihaeu/dephpend/issues/56?email_source=notifications&email_token=AAQRO7KERLHZDSDGKHYNMZDQKHW2NA5CNFSM4IXONRXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD67M6AY#issuecomment-532598531, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQRO7J55DOCHUJ7PTY3UGTQKHW2NANCNFSM4IXONRXA.

smuuf commented 5 years ago

I have stumbled upon the same error and using the "separate files" technique mentioned above I have found out the culprit. And it is this piece of code:

$someObject->someOtherObject::SOME_CONSTANT;

Which in and of itself is a valid way of how to access constants of some instance's class (I'm using PHP 7.2), but seems like it breaks some stuff in the analyzer.

Hope this helps.

mihaeu commented 5 years ago

Interesting, thanks for reporting this. I'll fix it this weekend.

On 10.10.19 12:25, Přemysl Karbula wrote:

I have stumbled upon the same error and using the "separate files" technique mentioned above I have found out the culprit. And it is this piece of code:

$this->someInstance::SOME_CONSTANT

Which in and of itself is a valid way of how to access constants of some instance's class /(I'm using |PHP 7.2|)/, but seems like it breaks some stuff in the analyzer.

Hope this helps.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mihaeu/dephpend/issues/56?email_source=notifications&email_token=AAQRO7LILCL24POYQNOARKLQN37KRA5CNFSM4IXONRXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA3XL3A#issuecomment-540505580, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQRO7MRDWJ2TFJM6W3U6RDQN37KRANCNFSM4IXONRXA.

mihaeu commented 5 years ago

@smuuf thanks for helping me analyze this. Instead of trying to be really smart about it I instead opted to ignore this problem because really that code does not make sense from the point of view of a static analyzer.