Skip to content

TypeError: Argument 1 Passed to PHPStan\Type\ClosureType::PHPStan\{closure}() #4097

@icanhazstring

Description

@icanhazstring

Bug report

PHPStan: 0.12.56

Running analyse I encounter an Uncaught TypeError.

Trace:

/vagrant/SnapshotRepository.php
PHP Fatal error:  Uncaught TypeError: Argument 1 passed to PHPStan\Type\ClosureType::PHPStan\Type\{closure}() must be an instance of PHPStan\Reflection\Native\NativeParameterReflection, instance of PHPStan\Reflection\Php\DummyParameter given in phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/ClosureType.php:265
Stack trace:
#0 [internal function]: PHPStan\Type\ClosureType::PHPStan\Type\{closure}(Object(PHPStan\Reflection\Php\DummyParameter))
#1 phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/ClosureType.php(268): array_map(Object(Closure), Array)
#2 phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/TypeTraverser.php(52): PHPStan\Type\ClosureType->traverse(Array)
#3 phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/TypeUtils.php(111): PHPStan\Type\TypeTraverser->traverseInternal(Object(PHPStan\Type\ClosureType))
#4 phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/TypeTraverser.php in phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/ClosureType.php on line 265
Fatal error: Uncaught TypeError: Argument 1 passed to PHPStan\Type\ClosureType::PHPStan\Type\{closure}() must be an instance of PHPStan\Reflection\Native\NativeParameterReflection, instance of PHPStan\Reflection\Php\DummyParameter given in phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/ClosureType.php:265
Stack trace:
#0 [internal function]: PHPStan\Type\ClosureType::PHPStan\Type\{closure}(Object(PHPStan\Reflection\Php\DummyParameter))
#1 phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/ClosureType.php(268): array_map(Object(Closure), Array)
#2 phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/TypeTraverser.php(52): PHPStan\Type\ClosureType->traverse(Array)
#3 phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/TypeUtils.php(111): PHPStan\Type\TypeTraverser->traverseInternal(Object(PHPStan\Type\ClosureType))
#4 phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/TypeTraverser.php in phar:///vagrant/vendor/phpstan/phpstan/phpstan/src/Type/ClosureType.php on line 265

Code snippet that reproduces the problem

https://phpstan.org/r/e2a1c89c-a601-41d3-810e-87e0d7babe39

Expected output

No exception or error should be reported.

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