paquettg/php-html-parser

Error with method signature of Collection::offsetGet()

davidbyoung opened this issue · 1 comments

PHP 8.1 RC3 errors due to the fact that Collection::offsetGet() does not declare the return type.

PHP Fatal error:  During inheritance of ArrayAccess: Uncaught ErrorException: Return type of PHPHtmlParser\Dom\Node\Collection::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 /vendor/paquettg/php-html-parser/src/PHPHtmlParser/Dom/Node/Collection.php:133

Rather than upgrade to PHP 8, this library could use the #[\ReturnTypeWillChange] as suggested in the error, which will just be interpreted as a harmless PHP comment in PHP < 8.

i use php ver 8.2.0 and still got this error.

error Trace:
error Trace

code:
code