Skip to content

Error with method signature of Collection::offsetGet() #290

Open
@davidbyoung

Description

@davidbyoung

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions