vimeo / psalm

A static analysis tool for finding errors in PHP applications
https://psalm.dev
MIT License
5.57k stars 660 forks source link

Running psalm is emitting `PHP Fatal error: During inheritance of ArrayAccess` for Php8.1 notices. #7516

Closed VincentLanglet closed 2 years ago

VincentLanglet commented 2 years ago

I'm trying to add psalm on SonataFormatterBundle, which is using SonataAdminBundle v3 and I'm getting the following error:

PHP Fatal error:  During inheritance of ArrayAccess: Uncaught RuntimeException: PHP Error: Return type of Sonata\AdminBundle\FieldDescription\FieldDescriptionCollection::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/runner/work/SonataFormatterBundle/SonataFormatterBundle/vendor/sonata-project/admin-bundle/src/FieldDescription/FieldDescriptionCollection.php:89 in /home/runner/work/SonataFormatterBundle/SonataFormatterBundle/vendor/vimeo/psalm/src/Psalm/Internal/ErrorHandler.php:66

https://github.com/sonata-project/SonataFormatterBundle/runs/4988136265?check_suite_focus=true

I understand that it means a notice/deprecation is triggered when running SonataFormatter on php 8.1. But the tests suite are working on this php version, so to me, psalm shouldn't transform this notice/deprecation into a fatal error.

VincentLanglet commented 2 years ago

I think it's my mistake and it just means we don't really support 8.1