-
-
Notifications
You must be signed in to change notification settings - Fork 903
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
Internal error: AST failed to parse in located source (first 20 characters: #7590
Comments
This bug report is missing a link to reproduction at phpstan.org/try. It will most likely be closed after manual review. |
After some research we found out all the files have one in common and that's \Phalcon\Events\Event in them. It doesn't matter if it's only imported or really used in the class but it always finishes with this internal error. |
Hi, thank you for reporting this. I've added a bit more debugging so it should tell us what's the parse error: phpstan/phpstan-src@a342b2b Can you please update to I've also asked for shivammathur/homebrew-extensions#1890 so that I can reproduce and debug it. |
Hi, thank you for your response. Here's the output version
|
This is the root issue. This is how the generated stub for the <?php
namespace Phalcon\Events;
class Event implements \Phalcon\Events\EventInterface
{
protected $cancelable = null;
protected $data = null;
protected $source = null;
protected $stopped = false;
protected $type = null;
public function getData()
{
}
public function getSource() : ?\((void*)0)
{
}
public function getType() : string
{
}
public function __construct(string $type, $source = null, $data = null, bool $cancelable =
\UNKNOWN)
{
}
public function isCancelable() : bool
{
}
public function isStopped() : bool
{
}
public function setData($data = null) : \Phalcon\Events\EventInterface
{
}
public function setType(string $type) : \Phalcon\Events\EventInterface
{
}
public function stop() : \Phalcon\Events\EventInterface
{
}
} There's a weird return type in the |
It's a |
Reported: phalcon/cphalcon#16023 (comment) Thank you! |
@ondrejmirtes Could you please tell how did you generate this stub? |
@Jeckerson PHPStan uses Roave/BetterReflection, it needs AST to create its Reflection objects. So it reads PHP native Reflection data to generate this source code. It's implemented in ReflectionSourceStubber: https://github.com/ondrejmirtes/BetterReflection/blob/5.3.x/src/SourceLocator/SourceStubber/ReflectionSourceStubber.php As I said, the return type for the getSource() ReflectionMethod is what the extension reports wrongly. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
After updating to PHP8.1 I get the
While running the --debug -vvv mode I get this error
Code snippet that reproduces the problem
Was not able to reproduce the problem since the files themselves are fine. There's always 8 of them and even when I tried to delete them it didn't help with this error to appear.
Expected output
Zero internal errors
Did PHPStan help you today? Did it make you happy in any way?
I am very happy with PHPStan otherwise it's a great tool helping us to get better.
This is my first time writing an issue at all so I hope I did it right and that someone will help me with my experience.
Thank you!
The text was updated successfully, but these errors were encountered: