Skip to content

Commit 123eda2

Browse files
committed
fix: deprecated in php8.1
1 parent c281594 commit 123eda2

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "tburry/pquery",
2+
"name": "guyavatrade/pquery",
33
"type": "library",
4-
"description": "A jQuery like html dom parser written in php.",
4+
"description": "A jQuery like html dom parser written in php. This fork add fixes for php 8.1",
55
"keywords": ["php", "dom", "ganon"],
66
"license": "LGPL-2.1",
77
"authors": [

gan_node_html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2352,7 +2352,7 @@ public function before($content) {
23522352
return $this;
23532353
}
23542354

2355-
public function count() {
2355+
public function count(): int{
23562356
return 1;
23572357
}
23582358

pQuery.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function clear() {
7878
*
7979
* @return int Returns the count of matched elements.
8080
*/
81-
public function count() {
81+
public function count(): int {
8282
return count($this->nodes);
8383
}
8484

@@ -94,7 +94,7 @@ public function count() {
9494
// return $formatter->format($dom);
9595
// }
9696

97-
public function getIterator() {
97+
public function getIterator(): Traversable {
9898
return new ArrayIterator($this->nodes);
9999
}
100100

@@ -118,15 +118,15 @@ public function html($value = null) {
118118
return $this;
119119
}
120120

121-
public function offsetExists($offset) {
121+
public function offsetExists($offset): bool {
122122
return isset($this->nodes[$offset]);
123123
}
124124

125-
public function offsetGet($offset) {
125+
public function offsetGet($offset): mixed {
126126
return isset($this->nodes[$offset]) ? $this->nodes[$offset] : null;
127127
}
128128

129-
public function offsetSet($offset, $value) {
129+
public function offsetSet($offset, $value): void {
130130

131131
if (is_null($offset) || !isset($this->nodes[$offset])) {
132132
throw new \BadMethodCallException("You are not allowed to add new nodes to the pQuery object.");
@@ -135,7 +135,7 @@ public function offsetSet($offset, $value) {
135135
}
136136
}
137137

138-
public function offsetUnset($offset) {
138+
public function offsetUnset($offset): void {
139139
if (isset($this->nodes[$offset])) {
140140
$this->nodes[$offset]->remove();
141141
unset($this->nodes[$offset]);

0 commit comments

Comments
 (0)