proget-hq / phpstan-yii2

Yii2 extension for PHPStan
MIT License
52 stars 18 forks source link

Incompatibility with latest PHPStan #43

Closed EtienneBruines closed 3 years ago

EtienneBruines commented 3 years ago

When running phpstan analyse api --level the following error is thrown. Seems like a relatively "simple" backwards incompatible type-change by the phpstan project.

  2/41 [▓░░░░░░░░░░░░░░░░░░░░░░░░░░░]   4%PHP Fatal error:  Declaration of Proget\PHPStan\Yii2\Type\ActiveRecordObjectType::setOffsetValueType(?PHPStan\Type\Type $offsetType, PHPStan\Type\Type $valueType): PHPStan\Type\Type must be compatible with PHPStan\Type\ObjectType::setOffsetValueType(?PHPStan\Type\Type $offsetType, PHPStan\Type\Type $valueType, bool $unionValues = true): PHPStan\Type\Type in /home/etiennebruines/workspaces/mossaino/mossaino/vendor/proget-hq/phpstan-yii2/src/Type/ActiveRecordObjectType.php on line 28
<pre>PHP Compile Error &#039;yii\base\ErrorException&#039; with message &#039;Declaration of Proget\PHPStan\Yii2\Type\ActiveRecordObjectType::setOffsetValueType(?PHPStan\Type\Type $offsetType, PHPStan\Type\Type $valueType): PHPStan\Type\Type must be compatible with PHPStan\Type\ObjectType::setOffsetValueType(?PHPStan\Type\Type $offsetType, PHPStan\Type\Type $valueType, bool $unionValues = true): PHPStan\Type\Type&#039; 

in /home/etiennebruines/workspaces/mossaino/mossaino/vendor/proget-hq/phpstan-yii2/src/Type/ActiveRecordObjectType.php:28

Stack trace:
#0 [internal function]: yii\base\ErrorHandler-&gt;handleFatalError()
#1 {main}</pre>Script ./vendor/bin/phpstan analyse api --level max --memory-limit=1G handling the test/phpstan event returned with error code 1

Versions

phpstan/phpstan 0.12.91
proget-hq/phpstan-yii2 0.7.4

Workaround

Pinning phpstan to 0.12.90 seems to alleviate the issue.