Skip to content

PHP 8 Deprecations #19

@DevCapere

Description

@DevCapere

Some deprecations errors is occurring on PHP 8


<b>Deprecated</b>:  Return type of pQuery::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 <b>/var/www/html/api/vendor/tburry/pquery/pQuery.php</b> on line <b>121</b>

<b>Deprecated</b>:  Return type of pQuery::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 <b>/var/www/html/api/vendor/tburry/pquery/pQuery.php</b> on line <b>125</b>

<b>Deprecated</b>:  Return type of pQuery::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 <b>/var/www/html/api/vendor/tburry/pquery/pQuery.php</b> on line <b>129</b>

<b>Deprecated</b>:  Return type of pQuery::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 <b>/var/www/html/api/vendor/tburry/pquery/pQuery.php</b> on line <b>138</b>

<b>Deprecated</b>:  Return type of pQuery::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>/var/www/html/api/vendor/tburry/pquery/pQuery.php</b> on line <b>97</b>

<b>Deprecated</b>:  Return type of pQuery::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>/var/www/html/api/vendor/tburry/pquery/pQuery.php</b> on line <b>81</b>

<b>Deprecated</b>:  Return type of pQuery\DomNode::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in <b>/var/www/html/api/vendor/tburry/pquery/gan_node_html.php</b> on line <b>2355</b>

I think just add the types like the interface it should solve the problem:

public offsetExists(mixed $offset): bool { /*.... */ }
//                  ^^^^^           ^^^^

public offsetGet(mixed $offset): mixed { /*.... */ }
//               ^^^^^           ^^^^^ 

public offsetSet(mixed $offset, mixed $value): void  { /*.... */ }
//               ^^^^^          ^^^^^          ^^^^

public offsetUnset(mixed $offset): void { /*.... */ }
//                 ^^^^^           ^^^^

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