summaryrefslogtreecommitdiffstats
path: root/phpunit-php8.patch
diff options
context:
space:
mode:
Diffstat (limited to 'phpunit-php8.patch')
-rw-r--r--phpunit-php8.patch380
1 files changed, 303 insertions, 77 deletions
diff --git a/phpunit-php8.patch b/phpunit-php8.patch
index 8143a3a..c7be253 100644
--- a/phpunit-php8.patch
+++ b/phpunit-php8.patch
@@ -1,7 +1,62 @@
+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 2021-03-19 12:29:00.122960437 +0100
-+++ ./PHPUnit/Framework/TestCase.php 2021-03-19 12:29:16.926880988 +0100
-@@ -1059,7 +1059,7 @@ abstract class PHPUnit_Framework_TestCas
+--- ./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 {
@@ -10,9 +65,39 @@ diff -up ./PHPUnit/Framework/TestCase.php.php8 ./PHPUnit/Framework/TestCase.php
} 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 2021-03-19 12:28:10.627194461 +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);
}
@@ -22,53 +107,6 @@ diff -up ./PHPUnit/Util/Configuration.php.php8 ./PHPUnit/Util/Configuration.php
{
}
-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 2021-03-19 12:28:10.627194461 +0100
-@@ -7,7 +7,7 @@ class Singleton
- {
- }
-
-- final private function __clone()
-+ private function __clone()
- {
- }
-
-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 2021-03-19 12:28:10.627194461 +0100
-@@ -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 2021-03-19 12:28:10.627194461 +0100
-@@ -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));
- }
-
-diff -up ./PHPUnit/Util/Configuration.php.old ./PHPUnit/Util/Configuration.php
---- ./PHPUnit/Util/Configuration.php.old 2021-09-10 07:36:55.786834316 +0200
-+++ ./PHPUnit/Util/Configuration.php 2021-09-10 07:38:02.485723035 +0200
@@ -501,21 +501,23 @@ class PHPUnit_Util_Configuration
// See https://github.com/sebastianbergmann/phpunit/issues/277
switch ($array) {
@@ -100,9 +138,9 @@ diff -up ./PHPUnit/Util/Configuration.php.old ./PHPUnit/Util/Configuration.php
}
foreach ($configuration['env'] as $name => $value) {
-diff -up ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.old ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist
---- ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.old 2021-09-10 07:43:43.165206553 +0200
-+++ ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist 2021-09-10 07:43:46.619201163 +0200
+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);
}
@@ -112,28 +150,216 @@ diff -up ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.old ./PHPUnit/Util/
{
return true;
}
-diff -up ./PHPUnit/Framework/Constraint/IsType.php.old ./PHPUnit/Framework/Constraint/IsType.php
---- ./PHPUnit/Framework/Constraint/IsType.php.old 2021-11-23 07:39:40.865503163 +0100
-+++ ./PHPUnit/Framework/Constraint/IsType.php 2021-11-23 07:39:58.420422741 +0100
-@@ -116,7 +116,20 @@ class PHPUnit_Framework_Constraint_IsTyp
- return is_object($other);
+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;
+ }
- 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;
++ #[\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));
+ }
- case 'scalar':
- return is_scalar($other);