Laravel-PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key)

Posted by

Error

PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key)
should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\xampp\htdocs\myhospitalnow\mhn-core-ms\vendor\laravel\framework\src\Illuminate\Support\Collection.php:1693
Stack trace:

Solution

That’s a php version issue. Upgrade laravel or downgrade PHP. This article covers how to downgrade the PHP version so it matches the Laravel Version.

Go to your composer.json update line

"php": "^7.3",

To

  "php": ">=8.1.17",

After that and run composer update

You would have to use Composer to update your Laravel Framework version and all of its dependencies to at least version 8.

The error is solved

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x