presenter icon indicating copy to clipboard operation
presenter copied to clipboard

Deprecation warnings on php8

Open mad-briller opened this issue 3 years ago • 1 comments

This package supports all versions of Laravel 5-9 basically, but Laravel 9 requires php8, which is yielding these deprecation errors:

PHP Deprecated:  Return type of Hemp\Presenter\Presenter::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/brad/code/active-housing/admin/vendor/hemp/presenter/src/Presenter.php on line 308
PHP Deprecated:  Return type of Hemp\Presenter\Presenter::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brad/code/active-housing/admin/vendor/hemp/presenter/src/Presenter.php on line 319
PHP Deprecated:  Return type of Hemp\Presenter\Presenter::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brad/code/active-housing/admin/vendor/hemp/presenter/src/Presenter.php on line 332
PHP Deprecated:  Return type of Hemp\Presenter\Presenter::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /home/brad/code/active-housing/admin/vendor/hemp/presenter/src/Presenter.php on line 344

Which makes it tough to use. I tried making changes to this package to support PHP8 / Laravel 9 only but it seems like this package specifically tries to support all versions at once. If i provide a pr that fixes these errors and makes it only compatible with laravel 9 / php8.1, would that be accepted as a new major version? The main incompatible change is the need for the mixed type hint on the offsetGet method.

the other option is to add the ReturnTypeWillChange attribute, but that is just kicking the can down the road, as at somepoint a new major version would need to be cut that only supports php8+.

Thanks for your time.

mad-briller avatar Sep 16 '22 07:09 mad-briller

I'm cool with making a PR just for PHP 8.

davidhemphill avatar Sep 17 '22 01:09 davidhemphill

I guess this can be closed then. Thanks for merging :)

zappzerapp avatar Jan 09 '23 10:01 zappzerapp