Skip to content

crash on first class callable as conditional do while #12246

Closed

Description

@samsonasik

Bug report

given code:

final class SkipFirstClassCallableInDo
{
    public function getSubscribedEvents()
    {
        do {

        } while ($this->textElement(...));
    }

    public function textElement()
    {
         return 1;
    }
}

it cause crash:

Call to undefined method PHPStan\Node\Printer\Printer::pPHPStan_Node_MethodCallableNode()

Code snippet that reproduces the problem

https://phpstan.org/r/178ac73a-e99c-4961-957f-a3c6062d7c44

Expected output

it should not crash.

Did PHPStan help you today? Did it make you happy in any way?

No response

Activity

  1. added this to the Easy fixes milestone on Jan 16, 2025
  2. phpstan-bot commented on Jan 16, 2025

    @phpstan-bot
    Contributor

    @samsonasik After the latest push in 2.1.x, PHPStan now reports different result with your code snippet:

    @@ @@
    --1: Call to undefined method PHPStan\Node\Printer\Printer::pPHPStan_Node_MethodCallableNode()
    +No errors
  3. samsonasik commented on Jan 16, 2025

    @samsonasik
    Author
  4. phpstan-bot commented on Jan 16, 2025

    @phpstan-bot
    Contributor

    @samsonasik After the latest push in 2.1.x, PHPStan now reports different result with your code snippet:

    @@ @@
    --1: Call to undefined method PHPStan\Node\Printer\Printer::pPHPStan_Node_MethodCallableNode()
    +No errors
  5. samsonasik commented on Jan 16, 2025

    @samsonasik
    Author

    it is not, is the website up to date with phpstan bot?

  6. added a commit that references this issue on Mar 11, 2026
    bb4650d
  7. phpstan-bot commented on Mar 11, 2026

    @phpstan-bot
    Contributor

    Closed via merging phpstan/phpstan-src#5194

  8. added 2 commits that reference this issue on Mar 11, 2026
    bb4650d
    edd2e1d
  9. added a commit that references this issue on Apr 7, 2026
    8d7da5d
  10. github-actions commented on Apr 12, 2026

    @github-actions

    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.

  11. locked as resolved and limited conversation to collaborators on Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions