Skip to content

Commit

Permalink
Change PHP_INT_MAX to null and update end-to-end tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos authored and sebastianbergmann committed Sep 9, 2024
1 parent c2dc716 commit ab2cd21
Show file tree
Hide file tree
Showing 74 changed files with 81 additions and 82 deletions.
3 changes: 1 addition & 2 deletions src/Framework/MockObject/Generator/MockMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
*/
namespace PHPUnit\Framework\MockObject\Generator;

use const PHP_INT_MAX;
use function count;
use function explode;
use function implode;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/mock-objects/generator/232.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/mock-objects/generator/3967.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/mock-objects/generator/397.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/mock-objects/generator/4139.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
6 changes: 3 additions & 3 deletions tests/end-to-end/mock-objects/generator/abstract_class.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/mock-objects/generator/class.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/mock-objects/generator/class_partial.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/mock-objects/generator/interface.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand Down
4 changes: 2 additions & 2 deletions tests/end-to-end/mock-objects/generator/namespaced_class.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
2 changes: 1 addition & 1 deletion tests/end-to-end/mock-objects/generator/parameter_dnf.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
Loading

0 comments on commit ab2cd21

Please sign in to comment.