pquery icon indicating copy to clipboard operation
pquery copied to clipboard

PHP 8 Deprecations

Open DevCapere opened this issue 2 years ago • 0 comments

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 { /*.... */ }
//                 ^^^^^           ^^^^

DevCapere avatar Sep 29 '23 22:09 DevCapere