summaryrefslogtreecommitdiffstats
path: root/php-phpmyadmin-sql-parser5-php81.patch
blob: e43d7a702596410aa77e0f44b0e17dcc681791a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
Adapted for 5.4.2 from upstream:


From 57b6c4366da680dbde339393edb3055c0ca6311d Mon Sep 17 00:00:00 2001
From: William Desportes <williamdes@wdes.fr>
Date: Tue, 17 Aug 2021 00:11:59 +0200
Subject: [PATCH] Fix PHP 8.1 fatal errors on classes that "implements
 ArrayAccess"

"PHP Fatal error:  During inheritance of ArrayAccess: Uncaught Return type of PhpMyAdmin\SqlParser\TokensList::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"

"Fatal error: During inheritance of ArrayAccess: Uncaught Return type of PhpMyAdmin\SqlParser\TokensList::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice"

I added "#[ReturnTypeWillChange]"

Signed-off-by: William Desportes <williamdes@wdes.fr>
---
 src/TokensList.php | 4 ++++
 src/UtfString.php  | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/TokensList.php b/src/TokensList.php
index 486e3aa6..7b63a045 100644
--- a/src/TokensList.php
+++ b/src/TokensList.php
@@ -153,6 +153,7 @@ public function getNextOfTypeAndValue($type, $value)
      * @param int   $offset the offset to be set
      * @param Token $value  the token to be saved
      */
+    #[ReturnTypeWillChange]
     public function offsetSet($offset, $value)
     {
         if ($offset === null) {
@@ -169,6 +170,7 @@ public function offsetSet($offset, $value)
      *
      * @return Token
      */
+    #[ReturnTypeWillChange]
     public function offsetGet($offset)
     {
         return $offset < $this->count ? $this->tokens[$offset] : null;
@@ -181,6 +183,7 @@ public function offsetGet($offset)
      *
      * @return bool
      */
+    #[ReturnTypeWillChange]
     public function offsetExists($offset)
     {
         return $offset < $this->count;
@@ -191,6 +194,7 @@ public function offsetExists($offset)
      *
      * @param int $offset the offset to be unset
      */
+    #[ReturnTypeWillChange]
     public function offsetUnset($offset)
     {
         unset($this->tokens[$offset]);
diff --git a/src/UtfString.php b/src/UtfString.php
index 217d1989..ee6e21f0 100644
--- a/src/UtfString.php
+++ b/src/UtfString.php
@@ -91,6 +91,7 @@ public function __construct($str)
      *
      * @return bool
      */
+    #[ReturnTypeWillChange]
     public function offsetExists($offset)
     {
         return ($offset >= 0) && ($offset < $this->charLen);
@@ -103,6 +104,7 @@ public function offsetExists($offset)
      *
      * @return string|null
      */
+    #[ReturnTypeWillChange]
     public function offsetGet($offset)
     {
         if (($offset < 0) || ($offset >= $this->charLen)) {
@@ -146,6 +148,7 @@ public function offsetGet($offset)
      *
      * @throws Exception not implemented.
      */
+    #[ReturnTypeWillChange]
     public function offsetSet($offset, $value)
     {
         throw new Exception('Not implemented.');
@@ -158,6 +161,7 @@ public function offsetSet($offset, $value)
      *
      * @throws Exception not implemented.
      */
+    #[ReturnTypeWillChange]
     public function offsetUnset($offset)
     {
         throw new Exception('Not implemented.');

From ed900e5b219b13c62dd260fd03ff65c31723d385 Mon Sep 17 00:00:00 2001
From: William Desportes <williamdes@wdes.fr>
Date: Sun, 5 Sep 2021 21:58:36 +0200
Subject: [PATCH] Use fully qualified syntax for "#[\ReturnTypeWillChange]"

Ref: 644f6bea450d5d22cb7c7c7991698d9d7945756b

Signed-off-by: William Desportes <williamdes@wdes.fr>
---
 src/TokensList.php | 9 ++++-----
 src/UtfString.php  | 9 ++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/TokensList.php b/src/TokensList.php
index bdc520c5..21cac879 100644
--- a/src/TokensList.php
+++ b/src/TokensList.php
@@ -154,7 +153,7 @@ public function getNextOfTypeAndValue($type, $value)
      * @param int   $offset the offset to be set
      * @param Token $value  the token to be saved
      */
-    #[ReturnTypeWillChange]
+    #[\ReturnTypeWillChange]
     public function offsetSet($offset, $value)
     {
         if ($offset === null) {
@@ -171,7 +170,7 @@ public function offsetSet($offset, $value)
      *
      * @return Token
      */
-    #[ReturnTypeWillChange]
+    #[\ReturnTypeWillChange]
     public function offsetGet($offset)
     {
         return $offset < $this->count ? $this->tokens[$offset] : null;
@@ -184,7 +183,7 @@ public function offsetGet($offset)
      *
      * @return bool
      */
-    #[ReturnTypeWillChange]
+    #[\ReturnTypeWillChange]
     public function offsetExists($offset)
     {
         return $offset < $this->count;
@@ -195,7 +194,7 @@ public function offsetExists($offset)
      *
      * @param int $offset the offset to be unset
      */
-    #[ReturnTypeWillChange]
+    #[\ReturnTypeWillChange]
     public function offsetUnset($offset)
     {
         unset($this->tokens[$offset]);
diff --git a/src/UtfString.php b/src/UtfString.php
index 548aa28f..ffd89323 100644
--- a/src/UtfString.php
+++ b/src/UtfString.php
@@ -92,7 +91,7 @@ public function __construct($str)
      *
      * @return bool
      */
-    #[ReturnTypeWillChange]
+    #[\ReturnTypeWillChange]
     public function offsetExists($offset)
     {
         return ($offset >= 0) && ($offset < $this->charLen);
@@ -105,7 +104,7 @@ public function offsetExists($offset)
      *
      * @return string|null
      */
-    #[ReturnTypeWillChange]
+    #[\ReturnTypeWillChange]
     public function offsetGet($offset)
     {
         if (($offset < 0) || ($offset >= $this->charLen)) {
@@ -149,7 +148,7 @@ public function offsetGet($offset)
      *
      * @throws Exception not implemented.
      */
-    #[ReturnTypeWillChange]
+    #[\ReturnTypeWillChange]
     public function offsetSet($offset, $value)
     {
         throw new Exception('Not implemented.');
@@ -162,7 +161,7 @@ public function offsetSet($offset, $value)
      *
      * @throws Exception not implemented.
      */
-    #[ReturnTypeWillChange]
+    #[\ReturnTypeWillChange]
     public function offsetUnset($offset)
     {
         throw new Exception('Not implemented.');