From 10a92a97bad4abf58459d643d826576062f13b55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Sun, 8 Sep 2024 21:14:22 +0200 Subject: [PATCH 1/7] Add test to show the problem --- tests/end-to-end/regression/5891.phpt | 20 +++++++ .../regression/5891/Issue5891Test.php | 55 +++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 tests/end-to-end/regression/5891.phpt create mode 100644 tests/end-to-end/regression/5891/Issue5891Test.php diff --git a/tests/end-to-end/regression/5891.phpt b/tests/end-to-end/regression/5891.phpt new file mode 100644 index 00000000000..1cb93e8e9d9 --- /dev/null +++ b/tests/end-to-end/regression/5891.phpt @@ -0,0 +1,20 @@ +--TEST-- +https://github.com/sebastianbergmann/phpunit/issues/5891 +--FILE-- +run($_SERVER['argv']); +--EXPECTF-- +PHPUnit %s by Sebastian Bergmann and contributors. + +Runtime: %s + +.. 2 / 2 (100%) + +Time: %s, Memory: %s MB + +OK (2 tests, 3 assertions) diff --git a/tests/end-to-end/regression/5891/Issue5891Test.php b/tests/end-to-end/regression/5891/Issue5891Test.php new file mode 100644 index 00000000000..dc70e24a038 --- /dev/null +++ b/tests/end-to-end/regression/5891/Issue5891Test.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +namespace PHPUnit\TestFixture\Issue5891; + +use PHPUnit\Framework\TestCase; + +final class Issue5891Test extends TestCase +{ + public function testVariadicParam(): void + { + $variadicParam = $this->createMock(VariadicParam::class); + $variadicParam + ->method('foo') + ->with($this->callback(static function (...$items): bool + { + self::assertSame([1], $items); // should be "self::assertSame([1, 2, 3], $items);" + + return true; + })); + + $variadicParam->foo(1, 2, 3); + } + + public function testTwoParametersAndVariadicParam(): void + { + $twoParametersAndVariadicParam = $this->createMock(TwoParametersAndVariadicParam::class); + $twoParametersAndVariadicParam + ->method('foo') + ->with($this->callback(static function ($head, ...$tail): bool + { + self::assertSame('1st', $head); + self::assertSame([], $tail); // should be "self::assertSame(['2nd', '3rd', '4th'], $tail);" + + return true; + })); + + $twoParametersAndVariadicParam->foo('1st', '2nd', '3rd', '4th'); + } +} + +interface VariadicParam +{ + public function foo(int ...$items): void; +} +interface TwoParametersAndVariadicParam +{ + public function foo(string $first, string $second, string ...$rest): void; +} From f860ec8308a76943ecb84ae0d1eda2e24d80e3e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Sun, 8 Sep 2024 21:39:55 +0200 Subject: [PATCH 2/7] Update test to expect correct values --- tests/end-to-end/regression/5891/Issue5891Test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/end-to-end/regression/5891/Issue5891Test.php b/tests/end-to-end/regression/5891/Issue5891Test.php index dc70e24a038..ea553c066e9 100644 --- a/tests/end-to-end/regression/5891/Issue5891Test.php +++ b/tests/end-to-end/regression/5891/Issue5891Test.php @@ -20,7 +20,7 @@ public function testVariadicParam(): void ->method('foo') ->with($this->callback(static function (...$items): bool { - self::assertSame([1], $items); // should be "self::assertSame([1, 2, 3], $items);" + self::assertSame([1, 2, 3], $items); return true; })); @@ -36,7 +36,7 @@ public function testTwoParametersAndVariadicParam(): void ->with($this->callback(static function ($head, ...$tail): bool { self::assertSame('1st', $head); - self::assertSame([], $tail); // should be "self::assertSame(['2nd', '3rd', '4th'], $tail);" + self::assertSame(['2nd', '3rd', '4th'], $tail); return true; })); From 18911e55e9a18d473668406a246346bed4a8afdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Sun, 8 Sep 2024 21:43:47 +0200 Subject: [PATCH 3/7] Fix variadic function as callback --- .psalm/baseline.xml | 2 +- src/Framework/Constraint/Callback.php | 22 ++++++++++++++++++- .../MockObject/Generator/MockMethod.php | 12 +++++++++- .../MockObject/Runtime/Rule/Parameters.php | 8 ++++++- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/.psalm/baseline.xml b/.psalm/baseline.xml index 5781159d73c..d7811ffe922 100644 --- a/.psalm/baseline.xml +++ b/.psalm/baseline.xml @@ -442,7 +442,7 @@ 'arguments_call' => $this->argumentsForCall, 'return_declaration' => !empty($this->returnType->asString()) ? (': ' . $this->returnType->asString()) : '', 'return_type' => $this->returnType->asString(), - 'arguments_count' => !empty($this->argumentsForCall) ? substr_count($this->argumentsForCall, ',') + 1 : 0, + 'arguments_count' => $argumentsCount, 'class_name' => $this->className, 'method_name' => $this->methodName, 'modifier' => $this->modifier, diff --git a/src/Framework/Constraint/Callback.php b/src/Framework/Constraint/Callback.php index 665ed5432c9..4ff1c11120f 100644 --- a/src/Framework/Constraint/Callback.php +++ b/src/Framework/Constraint/Callback.php @@ -9,6 +9,8 @@ */ namespace PHPUnit\Framework\Constraint; +use ReflectionFunction; + /** * @psalm-template CallbackInput of mixed * @@ -37,14 +39,32 @@ public function toString(): string return 'is accepted by specified callback'; } + /** + * @psalm-suppress ArgumentTypeCoercion + */ + public function hasVariadicParam(): bool + { + foreach ((new ReflectionFunction($this->callback))->getParameters() as $parameter) { + if ($parameter->isVariadic()) { + return true; + } + } + + return false; + } + /** * Evaluates the constraint for parameter $value. Returns true if the * constraint is met, false otherwise. * * @psalm-param CallbackInput $other + * + * @psalm-suppress InvalidArgument */ protected function matches(mixed $other): bool { - return ($this->callback)($other); + return $this->hasVariadicParam() + ? ($this->callback)(...$other) + : ($this->callback)($other); } } diff --git a/src/Framework/MockObject/Generator/MockMethod.php b/src/Framework/MockObject/Generator/MockMethod.php index 81f1cad71c6..be65449d737 100644 --- a/src/Framework/MockObject/Generator/MockMethod.php +++ b/src/Framework/MockObject/Generator/MockMethod.php @@ -9,6 +9,7 @@ */ namespace PHPUnit\Framework\MockObject\Generator; +use const PHP_INT_MAX; use function count; use function explode; use function implode; @@ -17,6 +18,7 @@ use function preg_match; use function preg_replace; use function sprintf; +use function str_contains; use function strlen; use function strpos; use function substr; @@ -211,13 +213,21 @@ public function generateCode(): string $template = $this->loadTemplate($templateFile); + $argumentsCount = 0; + + if (str_contains($this->argumentsForCall, '...')) { + $argumentsCount = PHP_INT_MAX; // @todo: change it to null and update end-to-end tests + } elseif (!empty($this->argumentsForCall)) { + $argumentsCount = substr_count($this->argumentsForCall, ',') + 1; + } + $template->setVar( [ 'arguments_decl' => $this->argumentsForDeclaration, 'arguments_call' => $this->argumentsForCall, 'return_declaration' => !empty($this->returnType->asString()) ? (': ' . $this->returnType->asString()) : '', 'return_type' => $this->returnType->asString(), - 'arguments_count' => !empty($this->argumentsForCall) ? substr_count($this->argumentsForCall, ',') + 1 : 0, + 'arguments_count' => $argumentsCount, 'class_name' => $this->className, 'method_name' => $this->methodName, 'modifier' => $this->modifier, diff --git a/src/Framework/MockObject/Runtime/Rule/Parameters.php b/src/Framework/MockObject/Runtime/Rule/Parameters.php index 5db1ff95983..0f7a5977aa1 100644 --- a/src/Framework/MockObject/Runtime/Rule/Parameters.php +++ b/src/Framework/MockObject/Runtime/Rule/Parameters.php @@ -12,6 +12,7 @@ use function count; use function sprintf; use Exception; +use PHPUnit\Framework\Constraint\Callback; use PHPUnit\Framework\Constraint\Constraint; use PHPUnit\Framework\Constraint\IsAnything; use PHPUnit\Framework\Constraint\IsEqual; @@ -108,8 +109,13 @@ private function doVerify(): bool } foreach ($this->parameters as $i => $parameter) { + if ($parameter instanceof Callback && $parameter->hasVariadicParam()) { + $other = $this->invocation->parameters(); + } else { + $other = $this->invocation->parameters()[$i]; + } $parameter->evaluate( - $this->invocation->parameters()[$i], + $other, sprintf( 'Parameter %s for invocation %s does not match expected ' . 'value.', From 1c004af0baaa0adb6456f2a758e380dc1d87f204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Sun, 8 Sep 2024 22:08:09 +0200 Subject: [PATCH 4/7] Renaming --- tests/end-to-end/regression/5891.phpt | 2 +- .../regression/5891/Issue5891Test.php | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/end-to-end/regression/5891.phpt b/tests/end-to-end/regression/5891.phpt index 1cb93e8e9d9..934ea0944ae 100644 --- a/tests/end-to-end/regression/5891.phpt +++ b/tests/end-to-end/regression/5891.phpt @@ -17,4 +17,4 @@ Runtime: %s Time: %s, Memory: %s MB -OK (2 tests, 3 assertions) +OK (2 tests, 2 assertions) diff --git a/tests/end-to-end/regression/5891/Issue5891Test.php b/tests/end-to-end/regression/5891/Issue5891Test.php index ea553c066e9..d22c5ed846d 100644 --- a/tests/end-to-end/regression/5891/Issue5891Test.php +++ b/tests/end-to-end/regression/5891/Issue5891Test.php @@ -15,8 +15,8 @@ final class Issue5891Test extends TestCase { public function testVariadicParam(): void { - $variadicParam = $this->createMock(VariadicParam::class); - $variadicParam + $mock = $this->createMock(ArgumentList::class); + $mock ->method('foo') ->with($this->callback(static function (...$items): bool { @@ -25,31 +25,31 @@ public function testVariadicParam(): void return true; })); - $variadicParam->foo(1, 2, 3); + $mock->foo(1, 2, 3); } public function testTwoParametersAndVariadicParam(): void { - $twoParametersAndVariadicParam = $this->createMock(TwoParametersAndVariadicParam::class); - $twoParametersAndVariadicParam + $mock = $this->createMock(TwoParametersAndArgumentList::class); + $mock ->method('foo') - ->with($this->callback(static function ($head, ...$tail): bool + ->with($this->callback(static function (...$items): bool { - self::assertSame('1st', $head); - self::assertSame(['2nd', '3rd', '4th'], $tail); + self::assertSame(['1st', '2nd', '3rd', '4th'], $items); return true; })); - $twoParametersAndVariadicParam->foo('1st', '2nd', '3rd', '4th'); + $mock->foo('1st', '2nd', '3rd', '4th'); } } -interface VariadicParam +interface ArgumentList { public function foo(int ...$items): void; } -interface TwoParametersAndVariadicParam + +interface TwoParametersAndArgumentList { public function foo(string $first, string $second, string ...$rest): void; } From c2dc716dbcf4b55f32077e42b4d780edac8d0a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Mon, 9 Sep 2024 07:28:31 +0200 Subject: [PATCH 5/7] Do not use the ternary operator --- src/Framework/Constraint/Callback.php | 10 ++++++---- src/Framework/MockObject/Runtime/Rule/Parameters.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Framework/Constraint/Callback.php b/src/Framework/Constraint/Callback.php index 4ff1c11120f..31dce1d2e90 100644 --- a/src/Framework/Constraint/Callback.php +++ b/src/Framework/Constraint/Callback.php @@ -42,7 +42,7 @@ public function toString(): string /** * @psalm-suppress ArgumentTypeCoercion */ - public function hasVariadicParam(): bool + public function isVariadic(): bool { foreach ((new ReflectionFunction($this->callback))->getParameters() as $parameter) { if ($parameter->isVariadic()) { @@ -63,8 +63,10 @@ public function hasVariadicParam(): bool */ protected function matches(mixed $other): bool { - return $this->hasVariadicParam() - ? ($this->callback)(...$other) - : ($this->callback)($other); + if ($this->isVariadic()) { + return ($this->callback)(...$other); + } + + return ($this->callback)($other); } } diff --git a/src/Framework/MockObject/Runtime/Rule/Parameters.php b/src/Framework/MockObject/Runtime/Rule/Parameters.php index 0f7a5977aa1..a1f100d08d9 100644 --- a/src/Framework/MockObject/Runtime/Rule/Parameters.php +++ b/src/Framework/MockObject/Runtime/Rule/Parameters.php @@ -109,7 +109,7 @@ private function doVerify(): bool } foreach ($this->parameters as $i => $parameter) { - if ($parameter instanceof Callback && $parameter->hasVariadicParam()) { + if ($parameter instanceof Callback && $parameter->isVariadic()) { $other = $this->invocation->parameters(); } else { $other = $this->invocation->parameters()[$i]; From ab2cd21adca01223e5b762cf1acc72a9500977f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kuba=20Wer=C5=82os?= Date: Mon, 9 Sep 2024 07:35:59 +0200 Subject: [PATCH 6/7] Change PHP_INT_MAX to null and update end-to-end tests --- src/Framework/MockObject/Generator/MockMethod.php | 3 +-- .../MockObject/Generator/templates/doubled_method.tpl | 2 +- tests/end-to-end/mock-objects/generator/232.phpt | 2 +- .../generator/3154_namespaced_constant_resolving.phpt | 2 +- tests/end-to-end/mock-objects/generator/3967.phpt | 2 +- tests/end-to-end/mock-objects/generator/397.phpt | 2 +- tests/end-to-end/mock-objects/generator/4139.phpt | 2 +- tests/end-to-end/mock-objects/generator/abstract_class.phpt | 6 +++--- tests/end-to-end/mock-objects/generator/class.phpt | 4 ++-- .../mock-objects/generator/class_nonexistent_method.phpt | 2 +- tests/end-to-end/mock-objects/generator/class_partial.phpt | 2 +- .../generator/class_with_deprecated_method.phpt | 2 +- .../generator/class_with_method_named_method.phpt | 2 +- ..._method_with_nullable_typehinted_variadic_arguments.phpt | 2 +- ...lass_with_method_with_typehinted_variadic_arguments.phpt | 2 +- .../class_with_method_with_variadic_arguments.phpt | 2 +- .../generator/constant_as_parameter_default_value.phpt | 2 +- tests/end-to-end/mock-objects/generator/interface.phpt | 2 +- .../generator/invocation_object_clone_object.phpt | 4 ++-- .../end-to-end/mock-objects/generator/namespaced_class.phpt | 4 ++-- .../mock-objects/generator/namespaced_class_partial.phpt | 2 +- .../mock-objects/generator/namespaced_interface.phpt | 2 +- tests/end-to-end/mock-objects/generator/nullable_types.phpt | 2 +- .../generator/nullable_union_type_parameter.phpt | 2 +- .../mock-objects/generator/nullable_union_type_return.phpt | 2 +- tests/end-to-end/mock-objects/generator/parameter_dnf.phpt | 2 +- .../end-to-end/mock-objects/generator/parameter_false.phpt | 2 +- .../mock-objects/generator/parameter_intersection.phpt | 2 +- tests/end-to-end/mock-objects/generator/parameter_null.phpt | 2 +- tests/end-to-end/mock-objects/generator/parameter_true.phpt | 2 +- .../end-to-end/mock-objects/generator/parameter_union.phpt | 2 +- .../generator/return_type_declarations_closure.phpt | 2 +- .../generator/return_type_declarations_dnf.phpt | 2 +- .../generator/return_type_declarations_false.phpt | 2 +- .../generator/return_type_declarations_final.phpt | 2 +- .../generator/return_type_declarations_generator.phpt | 2 +- .../generator/return_type_declarations_intersection.phpt | 2 +- .../generator/return_type_declarations_never.phpt | 2 +- .../generator/return_type_declarations_null.phpt | 2 +- .../generator/return_type_declarations_nullable.phpt | 2 +- .../generator/return_type_declarations_object_method.phpt | 2 +- .../generator/return_type_declarations_parent.phpt | 2 +- .../generator/return_type_declarations_self.phpt | 2 +- .../generator/return_type_declarations_static.phpt | 6 +++--- .../generator/return_type_declarations_true.phpt | 2 +- .../generator/return_type_declarations_union.phpt | 2 +- .../generator/return_type_declarations_void.phpt | 2 +- .../mock-objects/generator/scalar_type_declarations.phpt | 2 +- .../mock-objects/mock-method/clone_method_arguments.phpt | 2 +- .../mock-method/deprecated_with_description.phpt | 2 +- .../mock-method/deprecated_without_description.phpt | 2 +- .../end-to-end/mock-objects/mock-method/private_method.phpt | 2 +- .../mock-objects/mock-method/protected_method.phpt | 2 +- .../mock-objects/mock-method/return_by_reference.phpt | 2 +- .../mock-method/return_by_reference_with_return_type.phpt | 2 +- tests/end-to-end/mock-objects/mock-method/return_type.phpt | 2 +- .../mock-objects/mock-method/return_type_parent.phpt | 2 +- .../mock-objects/mock-method/return_type_self.phpt | 2 +- .../end-to-end/mock-objects/mock-method/with_argument.phpt | 2 +- .../mock-objects/mock-method/with_argument_default.phpt | 2 +- .../mock-method/with_argument_default_constant.phpt | 2 +- .../mock-method/with_argument_default_new_expression.phpt | 2 +- .../mock-method/with_argument_default_null.phpt | 2 +- .../mock-objects/mock-method/with_argument_nullable.phpt | 2 +- .../mock-objects/mock-method/with_argument_reference.phpt | 2 +- .../mock-objects/mock-method/with_argument_typed_array.phpt | 2 +- .../mock-method/with_argument_typed_callable.phpt | 2 +- .../mock-objects/mock-method/with_argument_typed_class.phpt | 2 +- .../mock-method/with_argument_typed_scalar.phpt | 2 +- .../mock-objects/mock-method/with_argument_typed_self.phpt | 2 +- .../mock-method/with_argument_typed_unkown_class.phpt | 2 +- .../mock-method/with_argument_typed_variadic.phpt | 2 +- .../mock-objects/mock-method/with_argument_variadic.phpt | 2 +- .../end-to-end/mock-objects/mock-method/with_arguments.phpt | 2 +- 74 files changed, 81 insertions(+), 82 deletions(-) diff --git a/src/Framework/MockObject/Generator/MockMethod.php b/src/Framework/MockObject/Generator/MockMethod.php index be65449d737..497cd114f42 100644 --- a/src/Framework/MockObject/Generator/MockMethod.php +++ b/src/Framework/MockObject/Generator/MockMethod.php @@ -9,7 +9,6 @@ */ namespace PHPUnit\Framework\MockObject\Generator; -use const PHP_INT_MAX; use function count; use function explode; use function implode; @@ -216,7 +215,7 @@ public function generateCode(): string $argumentsCount = 0; if (str_contains($this->argumentsForCall, '...')) { - $argumentsCount = PHP_INT_MAX; // @todo: change it to null and update end-to-end tests + $argumentsCount = null; } elseif (!empty($this->argumentsForCall)) { $argumentsCount = substr_count($this->argumentsForCall, ',') + 1; } diff --git a/src/Framework/MockObject/Generator/templates/doubled_method.tpl b/src/Framework/MockObject/Generator/templates/doubled_method.tpl index 8ecd412c213..1b1b663feff 100644 --- a/src/Framework/MockObject/Generator/templates/doubled_method.tpl +++ b/src/Framework/MockObject/Generator/templates/doubled_method.tpl @@ -17,7 +17,7 @@ $__phpunit_arguments = [{arguments_call}]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > {arguments_count}) { + if ({arguments_count} !== null && $__phpunit_count > {arguments_count}) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/232.phpt b/tests/end-to-end/mock-objects/generator/232.phpt index 983f6af2896..ec1d06164c6 100644 --- a/tests/end-to-end/mock-objects/generator/232.phpt +++ b/tests/end-to-end/mock-objects/generator/232.phpt @@ -80,7 +80,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt b/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt index 7feda6cbb6c..98ff9b40513 100644 --- a/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt +++ b/tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt @@ -65,7 +65,7 @@ class Issue3154Mock extends Is\Namespaced\Issue3154 implements PHPUnit\Framework $__phpunit_arguments = [$i, $j, $v, $z]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 4) { + if (4 !== null && $__phpunit_count > 4) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 4; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/3967.phpt b/tests/end-to-end/mock-objects/generator/3967.phpt index c037c6af695..e67bc8bb0a8 100644 --- a/tests/end-to-end/mock-objects/generator/3967.phpt +++ b/tests/end-to-end/mock-objects/generator/3967.phpt @@ -53,7 +53,7 @@ class MockBaz extends Exception implements Baz, PHPUnit\Framework\MockObject\Moc $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/397.phpt b/tests/end-to-end/mock-objects/generator/397.phpt index df096d4d4fa..8b278242435 100644 --- a/tests/end-to-end/mock-objects/generator/397.phpt +++ b/tests/end-to-end/mock-objects/generator/397.phpt @@ -51,7 +51,7 @@ class MockC extends C implements PHPUnit\Framework\MockObject\MockObjectInternal $__phpunit_arguments = [$other]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/4139.phpt b/tests/end-to-end/mock-objects/generator/4139.phpt index 535c0f9e27f..9b8c19b16cf 100644 --- a/tests/end-to-end/mock-objects/generator/4139.phpt +++ b/tests/end-to-end/mock-objects/generator/4139.phpt @@ -41,7 +41,7 @@ class %s implements PHPUnit\Framework\MockObject\MockObjectInternal, InterfaceWi $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/abstract_class.phpt b/tests/end-to-end/mock-objects/generator/abstract_class.phpt index 15261323796..94df08cfd4d 100644 --- a/tests/end-to-end/mock-objects/generator/abstract_class.phpt +++ b/tests/end-to-end/mock-objects/generator/abstract_class.phpt @@ -55,7 +55,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { @@ -92,7 +92,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { @@ -129,7 +129,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/class.phpt b/tests/end-to-end/mock-objects/generator/class.phpt index 69c70e064bb..b0ebcbdc635 100644 --- a/tests/end-to-end/mock-objects/generator/class.phpt +++ b/tests/end-to-end/mock-objects/generator/class.phpt @@ -55,7 +55,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { @@ -92,7 +92,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt b/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt index 055a815be0a..9c4810f223d 100644 --- a/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt +++ b/tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt @@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/class_partial.phpt b/tests/end-to-end/mock-objects/generator/class_partial.phpt index 2eb741eb475..ce892e17454 100644 --- a/tests/end-to-end/mock-objects/generator/class_partial.phpt +++ b/tests/end-to-end/mock-objects/generator/class_partial.phpt @@ -55,7 +55,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt b/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt index 95fdd2fe646..c00106bf899 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_deprecated_method.phpt @@ -57,7 +57,7 @@ class MockFoo extends ClassWithDeprecatedMethod implements PHPUnit\Framework\Moc $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt b/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt index 1a0a23ce333..53fd4e674aa 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_method_named_method.phpt @@ -50,7 +50,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt b/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt index ce64bb2b7cc..9cba0bfa01e 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_method_with_nullable_typehinted_variadic_arguments.phpt @@ -51,7 +51,7 @@ class MockFoo extends ClassWithMethodWithNullableTypehintedVariadicArguments imp $__phpunit_arguments = [$a]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt b/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt index b7100796a9e..70ad5c7a79d 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_method_with_typehinted_variadic_arguments.phpt @@ -51,7 +51,7 @@ class MockFoo extends ClassWithMethodWithTypehintedVariadicArguments implements $__phpunit_arguments = [$a]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt b/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt index ea1e2ec59c6..a09d8354a8b 100644 --- a/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt +++ b/tests/end-to-end/mock-objects/generator/class_with_method_with_variadic_arguments.phpt @@ -51,7 +51,7 @@ class MockFoo extends ClassWithMethodWithVariadicArguments implements PHPUnit\Fr $__phpunit_arguments = [$a]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt b/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt index 9c855906818..bce9904c2a2 100644 --- a/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt +++ b/tests/end-to-end/mock-objects/generator/constant_as_parameter_default_value.phpt @@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/interface.phpt b/tests/end-to-end/mock-objects/generator/interface.phpt index 2258c32cbb4..136048e39d9 100644 --- a/tests/end-to-end/mock-objects/generator/interface.phpt +++ b/tests/end-to-end/mock-objects/generator/interface.phpt @@ -49,7 +49,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt b/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt index 8592925d272..c782b9f2ce4 100644 --- a/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt +++ b/tests/end-to-end/mock-objects/generator/invocation_object_clone_object.phpt @@ -56,7 +56,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { @@ -93,7 +93,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class.phpt index d6822a08dab..2f723c59170 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class.phpt @@ -57,7 +57,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { @@ -94,7 +94,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt b/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt index 5b111eacd43..9d173c1c958 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_class_partial.phpt @@ -57,7 +57,7 @@ class MockFoo extends NS\Foo implements PHPUnit\Framework\MockObject\MockObjectI $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt b/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt index 36ae50392ff..311c7f3fc53 100644 --- a/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt +++ b/tests/end-to-end/mock-objects/generator/namespaced_interface.phpt @@ -51,7 +51,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, NS\Foo $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/nullable_types.phpt b/tests/end-to-end/mock-objects/generator/nullable_types.phpt index 337d98cd0bb..ca2c23225f2 100644 --- a/tests/end-to-end/mock-objects/generator/nullable_types.phpt +++ b/tests/end-to-end/mock-objects/generator/nullable_types.phpt @@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$x]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/nullable_union_type_parameter.phpt b/tests/end-to-end/mock-objects/generator/nullable_union_type_parameter.phpt index 215e4872ea2..f22b4c465a6 100644 --- a/tests/end-to-end/mock-objects/generator/nullable_union_type_parameter.phpt +++ b/tests/end-to-end/mock-objects/generator/nullable_union_type_parameter.phpt @@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$baz, $other]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 2) { + if (2 !== null && $__phpunit_count > 2) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 2; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/nullable_union_type_return.phpt b/tests/end-to-end/mock-objects/generator/nullable_union_type_return.phpt index b8951419f06..1f5e419c7ed 100644 --- a/tests/end-to-end/mock-objects/generator/nullable_union_type_return.phpt +++ b/tests/end-to-end/mock-objects/generator/nullable_union_type_return.phpt @@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/parameter_dnf.phpt b/tests/end-to-end/mock-objects/generator/parameter_dnf.phpt index ff461b3b6d9..05a20b37868 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_dnf.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_dnf.phpt @@ -64,7 +64,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/parameter_false.phpt b/tests/end-to-end/mock-objects/generator/parameter_false.phpt index 8918a0e0bc3..a402ba1fa5a 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_false.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_false.phpt @@ -54,7 +54,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/parameter_intersection.phpt b/tests/end-to-end/mock-objects/generator/parameter_intersection.phpt index fd71afe49b0..6cdd91eb8ae 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_intersection.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_intersection.phpt @@ -59,7 +59,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/parameter_null.phpt b/tests/end-to-end/mock-objects/generator/parameter_null.phpt index 2798d272833..8834188b3c2 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_null.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_null.phpt @@ -54,7 +54,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/parameter_true.phpt b/tests/end-to-end/mock-objects/generator/parameter_true.phpt index 9f887d660b8..fb28fc3b8fb 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_true.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_true.phpt @@ -54,7 +54,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/parameter_union.phpt b/tests/end-to-end/mock-objects/generator/parameter_union.phpt index 44528fca51e..c214e5627c1 100644 --- a/tests/end-to-end/mock-objects/generator/parameter_union.phpt +++ b/tests/end-to-end/mock-objects/generator/parameter_union.phpt @@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$baz, $other]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 2) { + if (2 !== null && $__phpunit_count > 2) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 2; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt index 8c563f8a0a0..e260418c8c2 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_closure.phpt @@ -49,7 +49,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_dnf.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_dnf.phpt index 8f7b39600bf..f3f0a941784 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_dnf.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_dnf.phpt @@ -64,7 +64,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_false.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_false.phpt index 1cff137cb95..09ee685dec6 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_false.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_false.phpt @@ -54,7 +54,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt index a44f218db5c..d1bfadcf821 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_final.phpt @@ -56,7 +56,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt index bba83cc3e66..f71b9eb9d3c 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_generator.phpt @@ -49,7 +49,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_intersection.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_intersection.phpt index 83353f44a16..74d0b33905c 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_intersection.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_intersection.phpt @@ -59,7 +59,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_never.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_never.phpt index 00fadb261c2..863faad4ba5 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_never.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_never.phpt @@ -49,7 +49,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_null.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_null.phpt index e5bf4557ae6..890d6c61d1e 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_null.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_null.phpt @@ -54,7 +54,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt index 50e7729e74d..07ff368f67b 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_nullable.phpt @@ -49,7 +49,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt index 0624a88db1c..daaa0752cbc 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_object_method.phpt @@ -52,7 +52,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt index f781369dae9..8fd67b8d265 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_parent.phpt @@ -56,7 +56,7 @@ class MockBar extends Bar implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt index dada8dcb80a..d2d3e96e579 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_self.phpt @@ -49,7 +49,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_static.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_static.phpt index 0aa1b619133..8ed1d7166b3 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_static.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_static.phpt @@ -59,7 +59,7 @@ class MockClassWithStaticReturnTypes extends ClassWithStaticReturnTypes implemen $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { @@ -96,7 +96,7 @@ class MockClassWithStaticReturnTypes extends ClassWithStaticReturnTypes implemen $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { @@ -133,7 +133,7 @@ class MockClassWithStaticReturnTypes extends ClassWithStaticReturnTypes implemen $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_true.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_true.phpt index acb48690c9a..c37ccece7b2 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_true.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_true.phpt @@ -54,7 +54,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_union.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_union.phpt index 8432acf3916..cb6555ef471 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_union.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_union.phpt @@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt b/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt index c73556df98e..1759729031f 100644 --- a/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt +++ b/tests/end-to-end/mock-objects/generator/return_type_declarations_void.phpt @@ -49,7 +49,7 @@ class MockFoo implements PHPUnit\Framework\MockObject\MockObjectInternal, Foo $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt b/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt index b20b468594e..2d534e3c776 100644 --- a/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt +++ b/tests/end-to-end/mock-objects/generator/scalar_type_declarations.phpt @@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte $__phpunit_arguments = [$baz]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/clone_method_arguments.phpt b/tests/end-to-end/mock-objects/mock-method/clone_method_arguments.phpt index 50ab1870d1e..e5636f6f4d9 100644 --- a/tests/end-to-end/mock-objects/mock-method/clone_method_arguments.phpt +++ b/tests/end-to-end/mock-objects/mock-method/clone_method_arguments.phpt @@ -39,7 +39,7 @@ print $code; $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/deprecated_with_description.phpt b/tests/end-to-end/mock-objects/mock-method/deprecated_with_description.phpt index 6ccdc32901b..f7d0354de0f 100644 --- a/tests/end-to-end/mock-objects/mock-method/deprecated_with_description.phpt +++ b/tests/end-to-end/mock-objects/mock-method/deprecated_with_description.phpt @@ -44,7 +44,7 @@ public function bar() $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/deprecated_without_description.phpt b/tests/end-to-end/mock-objects/mock-method/deprecated_without_description.phpt index e2a387ecfe0..1f36d5525ab 100644 --- a/tests/end-to-end/mock-objects/mock-method/deprecated_without_description.phpt +++ b/tests/end-to-end/mock-objects/mock-method/deprecated_without_description.phpt @@ -44,7 +44,7 @@ public function bar() $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/private_method.phpt b/tests/end-to-end/mock-objects/mock-method/private_method.phpt index f844e12da35..4b5cacfd7b0 100644 --- a/tests/end-to-end/mock-objects/mock-method/private_method.phpt +++ b/tests/end-to-end/mock-objects/mock-method/private_method.phpt @@ -39,7 +39,7 @@ private function bar() $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/protected_method.phpt b/tests/end-to-end/mock-objects/mock-method/protected_method.phpt index f8f6d82999e..40a93252247 100644 --- a/tests/end-to-end/mock-objects/mock-method/protected_method.phpt +++ b/tests/end-to-end/mock-objects/mock-method/protected_method.phpt @@ -39,7 +39,7 @@ protected function bar() $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/return_by_reference.phpt b/tests/end-to-end/mock-objects/mock-method/return_by_reference.phpt index 51156da0c97..531d7be25eb 100644 --- a/tests/end-to-end/mock-objects/mock-method/return_by_reference.phpt +++ b/tests/end-to-end/mock-objects/mock-method/return_by_reference.phpt @@ -39,7 +39,7 @@ public function &bar() $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/return_by_reference_with_return_type.phpt b/tests/end-to-end/mock-objects/mock-method/return_by_reference_with_return_type.phpt index 3baa0687d02..637cb2debe8 100644 --- a/tests/end-to-end/mock-objects/mock-method/return_by_reference_with_return_type.phpt +++ b/tests/end-to-end/mock-objects/mock-method/return_by_reference_with_return_type.phpt @@ -39,7 +39,7 @@ public function &bar(): string $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/return_type.phpt b/tests/end-to-end/mock-objects/mock-method/return_type.phpt index 9d44056ae7b..0ae04dc0dc9 100644 --- a/tests/end-to-end/mock-objects/mock-method/return_type.phpt +++ b/tests/end-to-end/mock-objects/mock-method/return_type.phpt @@ -39,7 +39,7 @@ public function bar(): string $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/return_type_parent.phpt b/tests/end-to-end/mock-objects/mock-method/return_type_parent.phpt index 7fd0b2734a6..5d896a32476 100644 --- a/tests/end-to-end/mock-objects/mock-method/return_type_parent.phpt +++ b/tests/end-to-end/mock-objects/mock-method/return_type_parent.phpt @@ -43,7 +43,7 @@ public function bar(): Baz $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/return_type_self.phpt b/tests/end-to-end/mock-objects/mock-method/return_type_self.phpt index 7ccd57a45ac..f2faa58ea8d 100644 --- a/tests/end-to-end/mock-objects/mock-method/return_type_self.phpt +++ b/tests/end-to-end/mock-objects/mock-method/return_type_self.phpt @@ -39,7 +39,7 @@ public function bar(): Foo $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument.phpt index 76b527ea4e4..3d2c6d84044 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument.phpt @@ -39,7 +39,7 @@ private function bar($arg) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_default.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_default.phpt index aaac640b99c..3cb44b0d3f0 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_default.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_default.phpt @@ -39,7 +39,7 @@ private function bar($arg = false) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_default_constant.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_default_constant.phpt index e7d79d5330d..25a91c71c54 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_default_constant.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_default_constant.phpt @@ -44,7 +44,7 @@ private function bar($a = 1, $b = 2, $c = 3, $d = 4) $__phpunit_arguments = [$a, $b, $c, $d]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 4) { + if (4 !== null && $__phpunit_count > 4) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 4; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_default_new_expression.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_default_new_expression.phpt index 94ef6dcfd99..57448e2cbe9 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_default_new_expression.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_default_new_expression.phpt @@ -46,7 +46,7 @@ public function method(Foo $foo = new \Foo(1, 2, 3)) $__phpunit_arguments = [$foo]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_default_null.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_default_null.phpt index 07fe364b31a..9c9489898db 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_default_null.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_default_null.phpt @@ -39,7 +39,7 @@ private function bar($arg = NULL) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_nullable.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_nullable.phpt index 6a7b2d35a7e..ca05df39b60 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_nullable.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_nullable.phpt @@ -39,7 +39,7 @@ private function bar(?string $arg) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_reference.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_reference.phpt index 149dc6adfea..31ec140b15a 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_reference.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_reference.phpt @@ -39,7 +39,7 @@ private function bar(&$arg) $__phpunit_arguments = [&$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_array.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_array.phpt index 08f5391e64c..228cfb4e77a 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_array.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_array.phpt @@ -39,7 +39,7 @@ private function bar(array $arg) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_callable.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_callable.phpt index d94e276f681..c45de6724c1 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_callable.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_callable.phpt @@ -39,7 +39,7 @@ private function bar(callable $arg) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_class.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_class.phpt index 54375f6806b..77318e54853 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_class.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_class.phpt @@ -39,7 +39,7 @@ private function bar(Exception $arg) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_scalar.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_scalar.phpt index a59f3871d18..4084f3c9c1e 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_scalar.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_scalar.phpt @@ -39,7 +39,7 @@ private function bar(string $arg) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_self.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_self.phpt index 4d7d5293807..b9571f2382a 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_self.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_self.phpt @@ -39,7 +39,7 @@ private function bar(Foo $arg) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_unkown_class.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_unkown_class.phpt index a0549f5ef08..980c4d85aa6 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_unkown_class.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_unkown_class.phpt @@ -39,7 +39,7 @@ private function bar(UnknownClass $arg) $__phpunit_arguments = [$arg]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 1) { + if (1 !== null && $__phpunit_count > 1) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_variadic.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_variadic.phpt index 3c2a792c356..5f2c4169cc5 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_typed_variadic.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_typed_variadic.phpt @@ -39,7 +39,7 @@ private function bar(string ...$args) $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_argument_variadic.phpt b/tests/end-to-end/mock-objects/mock-method/with_argument_variadic.phpt index e4ce178d801..2c0e391e78d 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_argument_variadic.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_argument_variadic.phpt @@ -39,7 +39,7 @@ private function bar(...$args) $__phpunit_arguments = []; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 0) { + if (0 !== null && $__phpunit_count > 0) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { diff --git a/tests/end-to-end/mock-objects/mock-method/with_arguments.phpt b/tests/end-to-end/mock-objects/mock-method/with_arguments.phpt index 7cdbfa7adb7..70f029a734d 100644 --- a/tests/end-to-end/mock-objects/mock-method/with_arguments.phpt +++ b/tests/end-to-end/mock-objects/mock-method/with_arguments.phpt @@ -39,7 +39,7 @@ private function bar($arg1, $arg2) $__phpunit_arguments = [$arg1, $arg2]; $__phpunit_count = func_num_args(); - if ($__phpunit_count > 2) { + if (2 !== null && $__phpunit_count > 2) { $__phpunit_arguments_tmp = func_get_args(); for ($__phpunit_i = 2; $__phpunit_i < $__phpunit_count; $__phpunit_i++) { From 441ccc756a79aba7c2fc1b9e471044dc74a9a3d9 Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Mon, 9 Sep 2024 07:57:39 +0200 Subject: [PATCH 7/7] Update ChangeLog --- ChangeLog-10.5.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog-10.5.md b/ChangeLog-10.5.md index 7b871acfd6c..834a63e3a7f 100644 --- a/ChangeLog-10.5.md +++ b/ChangeLog-10.5.md @@ -9,6 +9,7 @@ All notable changes of the PHPUnit 10.5 release series are documented in this fi * [#4584](https://github.com/sebastianbergmann/phpunit/issues/4584): `assertJsonStringEqualsJsonString()` considers objects with sequential numeric keys equal to arrays * [#4625](https://github.com/sebastianbergmann/phpunit/issues/4625): Generator yielding keys that are neither integer or string leads to hard-to-understand error message when used as data provider * [#4674](https://github.com/sebastianbergmann/phpunit/issues/4674): JSON assertions should treat objects as unordered +* [#5891](https://github.com/sebastianbergmann/phpunit/issues/5891): `Callback` constraint does not handle variadic arguments correctly when used for mock object expectations * [#5929](https://github.com/sebastianbergmann/phpunit/issues/5929): TestDox output containing `$` at the beginning gets truncated when used with a data provider ## [10.5.32] - 2024-09-04