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

TypeError: Argument 1 passed to Phan\AST\Visitor\KindVisitorImplementation::__invoke() must be an instance of ast\Node, string given #2975

Closed
slifin opened this issue Jul 15, 2019 · 0 comments · Fixed by #2976

Comments

@slifin
Copy link

slifin commented Jul 15, 2019

Server:

phan --daemonize-tcp-port 4846 --unused-variable-detection

Client:

phan_client -l test.php -m checkstyle

Breakage code (test.php):

<?php

if (5 and 'hey') {
  echo 'hello';
}
else {
  echo 'hello';
}

PHP errors:

TypeError: Argument 1 passed to Phan\AST\Visitor\KindVisitorImplementation::__invoke() must be an instance of ast\Node, string given, called in /Users/adriansmith/.composer/vendor/phan/phan/src/Phan/Analysis/NegatedConditionVisitor.php on line 180 and defined in /Users/adriansmith/.composer/vendor/phan/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php:29
Stack trace:
#0 /Users/adriansmith/.composer/vendor/phan/phan/src/Phan/Analysis/NegatedConditionVisitor.php(180): Phan\AST\Visitor\KindVisitorImplementation->__invoke('hey')
#1 /Users/adriansmith/.composer/vendor/phan/phan/src/Phan/Analysis/NegatedConditionVisitor.php(123): Phan\Analysis\NegatedConditionVisitor->analyzeShortCircuitingAnd(5, 'hey')
#2 /Users/adriansmith/.composer/vendor/phan/phan/src/Phan/AST/Visitor/KindVisitorImplementation.php(32): Phan\Analysis\NegatedConditionVisitor->visitBinaryOp(Object(ast\Node))
#3 /Users/adriansmith/.composer/vendor/phan/phan/src/Phan/BlockAnalysisVisitor.php(1483): Phan\AST\Visitor\KindVisitorImplemen<…>
(Phan 2.2.5 crashed due to an uncaught Throwable when parsing/analyzing 'test.php')
Invalid response from phan for tcp://127.0.0.1:4846: {"status":"error_unknown","message":"failed to send a response - Possibly encountered an exception. See daemon output: [{\"function\":\"__destruct\",\"class\":\"Phan\\\\Daemon\\\\Request\",\"type\":\"->\"}]"}
child process 20526 exited with status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant