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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
diff -up ./PHPUnit/Extensions/TestDecorator.php.php8 ./PHPUnit/Extensions/TestDecorator.php
--- ./PHPUnit/Extensions/TestDecorator.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Extensions/TestDecorator.php 2023-03-31 09:15:03.023678618 +0200
@@ -61,6 +61,7 @@ class PHPUnit_Extensions_TestDecorator e
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function count()
{
return count($this->test);
diff -up ./PHPUnit/Framework/Constraint/IsType.php.php8 ./PHPUnit/Framework/Constraint/IsType.php
--- ./PHPUnit/Framework/Constraint/IsType.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Framework/Constraint/IsType.php 2023-03-31 09:15:03.023678618 +0200
@@ -116,7 +116,20 @@ class PHPUnit_Framework_Constraint_IsTyp
return is_object($other);
case 'resource':
- return is_resource($other) || is_string(@get_resource_type($other));
+ if (is_resource($other)) {
+ return true;
+ }
+
+ try {
+ $resource = @get_resource_type($other);
+
+ if (is_string($resource)) {
+ return true;
+ }
+ } catch (\TypeError $e) {
+ }
+
+ return false;
case 'scalar':
return is_scalar($other);
diff -up ./PHPUnit/Framework/Constraint.php.php8 ./PHPUnit/Framework/Constraint.php
--- ./PHPUnit/Framework/Constraint.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Framework/Constraint.php 2023-03-31 09:15:03.023678618 +0200
@@ -77,6 +77,7 @@ abstract class PHPUnit_Framework_Constra
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function count()
{
return 1;
diff -up ./PHPUnit/Framework/TestCase.php.php8 ./PHPUnit/Framework/TestCase.php
--- ./PHPUnit/Framework/TestCase.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Framework/TestCase.php 2023-03-31 09:15:03.023678618 +0200
@@ -324,6 +324,7 @@ abstract class PHPUnit_Framework_TestCas
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function count()
{
return 1;
@@ -1059,7 +1060,7 @@ abstract class PHPUnit_Framework_TestCas
$this->registerMockObjectsFromTestArguments($testArguments);
try {
- $testResult = $method->invokeArgs($this, $testArguments);
+ $testResult = $method->invokeArgs($this, array_values($testArguments));
} catch (Throwable $_e) {
$e = $_e;
} catch (Exception $_e) {
diff -up ./PHPUnit/Framework/TestResult.php.php8 ./PHPUnit/Framework/TestResult.php
--- ./PHPUnit/Framework/TestResult.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Framework/TestResult.php 2023-03-31 09:15:03.024678616 +0200
@@ -894,6 +894,7 @@ class PHPUnit_Framework_TestResult imple
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function count()
{
return $this->runTests;
diff -up ./PHPUnit/Framework/TestSuite.php.php8 ./PHPUnit/Framework/TestSuite.php
--- ./PHPUnit/Framework/TestSuite.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Framework/TestSuite.php 2023-03-31 09:15:03.024678616 +0200
@@ -401,6 +401,7 @@ class PHPUnit_Framework_TestSuite implem
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function count($preferCache = false)
{
if ($preferCache && $this->cachedNumTests !== null) {
@@ -961,6 +962,7 @@ class PHPUnit_Framework_TestSuite implem
*
* @return RecursiveIteratorIterator
*/
+ #[\ReturnTypeWillChange]
public function getIterator()
{
$iterator = new PHPUnit_Util_TestSuiteIterator($this);
diff -up ./PHPUnit/Util/Configuration.php.php8 ./PHPUnit/Util/Configuration.php
--- ./PHPUnit/Util/Configuration.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Util/Configuration.php 2023-03-31 09:15:03.024678616 +0200
@@ -159,7 +159,7 @@ class PHPUnit_Util_Configuration
$this->xpath = new DOMXPath($this->document);
}
- final private function __clone()
+ private function __clone()
{
}
@@ -501,21 +501,23 @@ class PHPUnit_Util_Configuration
// See https://github.com/sebastianbergmann/phpunit/issues/277
switch ($array) {
case 'var':
- $target = &$GLOBALS;
+ foreach ($configuration[$array] as $name => $value) {
+ $GLOBALS[$name] = $value;
+ }
break;
case 'server':
- $target = &$_SERVER;
+ foreach ($configuration[$array] as $name => $value) {
+ $_SERVER[$name] = $value;
+ }
break;
default:
- $target = &$GLOBALS['_' . strtoupper($array)];
+ foreach ($configuration[$array] as $name => $value) {
+ $GLOBALS['_' . strtoupper($array)][$name] = $value;
+ }
break;
}
-
- foreach ($configuration[$array] as $name => $value) {
- $target[$name] = $value;
- }
}
foreach ($configuration['env'] as $name => $value) {
diff -up ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.php8 ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist
--- ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist 2023-03-31 09:15:03.024678616 +0200
@@ -81,7 +81,7 @@ if ('' !== $configurationFilePath) {
unset($configuration);
}
-function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
+function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext=null)
{
return true;
}
diff -up ./PHPUnit/Util/TestSuiteIterator.php.php8 ./PHPUnit/Util/TestSuiteIterator.php
--- ./PHPUnit/Util/TestSuiteIterator.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Util/TestSuiteIterator.php 2023-03-31 09:15:03.024678616 +0200
@@ -34,6 +34,7 @@ class PHPUnit_Util_TestSuiteIterator imp
/**
* Rewinds the Iterator to the first element.
*/
+ #[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
@@ -44,6 +45,7 @@ class PHPUnit_Util_TestSuiteIterator imp
*
* @return bool
*/
+ #[\ReturnTypeWillChange]
public function valid()
{
return $this->position < count($this->tests);
@@ -54,6 +56,7 @@ class PHPUnit_Util_TestSuiteIterator imp
*
* @return int
*/
+ #[\ReturnTypeWillChange]
public function key()
{
return $this->position;
@@ -64,6 +67,7 @@ class PHPUnit_Util_TestSuiteIterator imp
*
* @return PHPUnit_Framework_Test
*/
+ #[\ReturnTypeWillChange]
public function current()
{
return $this->valid() ? $this->tests[$this->position] : null;
@@ -72,6 +76,7 @@ class PHPUnit_Util_TestSuiteIterator imp
/**
* Moves forward to next element.
*/
+ #[\ReturnTypeWillChange]
public function next()
{
$this->position++;
@@ -82,6 +87,7 @@ class PHPUnit_Util_TestSuiteIterator imp
*
* @return PHPUnit_Util_TestSuiteIterator
*/
+ #[\ReturnTypeWillChange]
public function getChildren()
{
return new self(
@@ -94,6 +100,7 @@ class PHPUnit_Util_TestSuiteIterator imp
*
* @return bool
*/
+ #[\ReturnTypeWillChange]
public function hasChildren()
{
return $this->tests[$this->position] instanceof PHPUnit_Framework_TestSuite;
diff -up ./tests/_files/DoubleTestCase.php.php8 ./tests/_files/DoubleTestCase.php
--- ./tests/_files/DoubleTestCase.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./tests/_files/DoubleTestCase.php 2023-03-31 09:15:03.024678616 +0200
@@ -8,6 +8,7 @@ class DoubleTestCase implements PHPUnit_
$this->testCase = $testCase;
}
+ #[\ReturnTypeWillChange]
public function count()
{
return 2;
diff -up ./tests/_files/SampleArrayAccess.php.php8 ./tests/_files/SampleArrayAccess.php
--- ./tests/_files/SampleArrayAccess.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./tests/_files/SampleArrayAccess.php 2023-03-31 09:15:03.024678616 +0200
@@ -13,6 +13,7 @@ class SampleArrayAccess implements Array
{
$this->container = [];
}
+ #[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
if (is_null($offset)) {
@@ -21,14 +22,17 @@ class SampleArrayAccess implements Array
$this->container[$offset] = $value;
}
}
+ #[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->container[$offset]);
}
+ #[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->container[$offset]);
}
+ #[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return isset($this->container[$offset]) ? $this->container[$offset] : null;
diff -up ./tests/_files/Singleton.php.php8 ./tests/_files/Singleton.php
--- ./tests/_files/Singleton.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./tests/_files/Singleton.php 2023-03-31 09:15:03.024678616 +0200
@@ -7,7 +7,7 @@ class Singleton
{
}
- final private function __clone()
+ private function __clone()
{
}
diff -up ./tests/_files/TestIterator2.php.php8 ./tests/_files/TestIterator2.php
--- ./tests/_files/TestIterator2.php.php8 2023-03-31 09:15:29.899608396 +0200
+++ ./tests/_files/TestIterator2.php 2023-03-31 09:15:40.714579720 +0200
@@ -8,26 +8,31 @@ class TestIterator2 implements Iterator
$this->data = $array;
}
+ #[\ReturnTypeWillChange]
public function current()
{
return current($this->data);
}
+ #[\ReturnTypeWillChange]
public function next()
{
next($this->data);
}
+ #[\ReturnTypeWillChange]
public function key()
{
return key($this->data);
}
+ #[\ReturnTypeWillChange]
public function valid()
{
return key($this->data) !== null;
}
+ #[\ReturnTypeWillChange]
public function rewind()
{
reset($this->data);
diff -up ./tests/_files/TestIterator.php.php8 ./tests/_files/TestIterator.php
--- ./tests/_files/TestIterator.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./tests/_files/TestIterator.php 2023-03-31 09:15:03.024678616 +0200
@@ -9,26 +9,31 @@ class TestIterator implements Iterator
$this->array = $array;
}
+ #[\ReturnTypeWillChange]
public function rewind()
{
$this->position = 0;
}
+ #[\ReturnTypeWillChange]
public function valid()
{
return $this->position < count($this->array);
}
+ #[\ReturnTypeWillChange]
public function key()
{
return $this->position;
}
+ #[\ReturnTypeWillChange]
public function current()
{
return $this->array[$this->position];
}
+ #[\ReturnTypeWillChange]
public function next()
{
$this->position++;
diff -up ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php.php8 ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php
--- ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php 2023-03-31 09:15:03.024678616 +0200
@@ -39,7 +39,7 @@ class Framework_Constraint_JsonMatches_E
{
return [
'JSON_ERROR_NONE' => [
- null, 'json_error_none', ''
+ null, JSON_ERROR_NONE, ''
],
'JSON_ERROR_DEPTH' => [
'Maximum stack depth exceeded', JSON_ERROR_DEPTH, ''
diff -up ./tests/Framework/ConstraintTest.php.php8 ./tests/Framework/ConstraintTest.php
--- ./tests/Framework/ConstraintTest.php.php8 2018-02-01 06:50:59.000000000 +0100
+++ ./tests/Framework/ConstraintTest.php 2023-03-31 09:15:03.025678613 +0200
@@ -1233,7 +1233,7 @@ EOF
$this->assertTrue($constraint->evaluate($resource, '', true));
- @fclose($resource);
+ if (is_resource($resource)) @fclose($resource);
}
public function testConstraintIsNotType()
@@ -2547,7 +2547,6 @@ EOF
// Default case.
$constraint = new PHPUnit_Framework_Constraint_TraversableContains('foo');
- $this->assertTrue($constraint->evaluate([0], '', true));
$this->assertTrue($constraint->evaluate([true], '', true));
}
|