Skip to content

Uncaught Error: Call to a member function getType() on null #3349

@staabm

Description

@staabm

Bug report

just ran into a "random" error, which phpstan told me to open a issue with this stack trace:

phpstan analyse -c phpstan.neon.dist
 252/252 [============================] 100% ------ --------------------------------------------------------------
  Line   lib\Debug.php
 ------ --------------------------------------------------------------
         Internal error: Call to a member function getType() on null
         Run PHPStan with --debug option and post the stack trace to:
         https://github.com/phpstan/phpstan/issues/new
 ------ --------------------------------------------------------------

so, running with --debug gets me:

PHP Fatal error:  Uncaught Error: Call to a member function getType() on null in phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Rules/Functions/IncompatibleDefaultParameterTypeRule.php:51
Stack trace:
#0 phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Analyser/FileAnalyser.php(69): PHPStan\Rules\Functions\IncompatibleDefaultParameterTypeRule->processNode(Object(PhpParser\Node\Stmt\Function_), Object(PHPStan\Analyser\MutatingScope))
#1 phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Analyser/NodeScopeResolver.php(243): PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}(Object(PhpParser\Node\Stmt\Function_), Object(PHPStan\Analyser\MutatingScope))
#2 phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Analyser/NodeScopeResolver.php(203): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpPa in phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Rules/Functions/IncompatibleDefaultParameterTypeRule.php on line 51
Fatal error: Uncaught Error: Call to a member function getType() on null in phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Rules/Functions/IncompatibleDefaultParameterTypeRule.php:51
Stack trace:
#0 phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Analyser/FileAnalyser.php(69): PHPStan\Rules\Functions\IncompatibleDefaultParameterTypeRule->processNode(Object(PhpParser\Node\Stmt\Function_), Object(PHPStan\Analyser\MutatingScope))
#1 phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Analyser/NodeScopeResolver.php(243): PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}(Object(PhpParser\Node\Stmt\Function_), Object(PHPStan\Analyser\MutatingScope))
#2 phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Analyser/NodeScopeResolver.php(203): PHPStan\Analyser\NodeScopeResolver->processStmtNode(Object(PhpPa in phar://C:/Users/mstaab/Documents/GitHub/php-rocket/vendor-bin/phpstan/vendor/phpstan/phpstan/phpstan/src/Rules/Functions/IncompatibleDefaultParameterTypeRule.php on line 51
Script phpstan analyse -c phpstan.neon.dist --debug handling the phpstan event returned with error code 255

do you need more to reproduce or similar?

env:

$ php -v
PHP 7.4.5 (cli) (built: Apr 14 2020 16:17:19) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

mstaab@NB-COMPLEX-15 MINGW64 ~/Documents/GitHub/php-rocket (rm-pear)
$ vendor/bin/phpstan -v
PHPStan - PHP Static Analysis Tool 0.12.25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions