Skip to content

Commit ab2cd21

Browse files
kubawerlossebastianbergmann
authored andcommitted
Change PHP_INT_MAX to null and update end-to-end tests
1 parent c2dc716 commit ab2cd21

File tree

74 files changed

+81
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+81
-82
lines changed

src/Framework/MockObject/Generator/MockMethod.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
namespace PHPUnit\Framework\MockObject\Generator;
1111

12-
use const PHP_INT_MAX;
1312
use function count;
1413
use function explode;
1514
use function implode;
@@ -216,7 +215,7 @@ public function generateCode(): string
216215
$argumentsCount = 0;
217216

218217
if (str_contains($this->argumentsForCall, '...')) {
219-
$argumentsCount = PHP_INT_MAX; // @todo: change it to null and update end-to-end tests
218+
$argumentsCount = null;
220219
} elseif (!empty($this->argumentsForCall)) {
221220
$argumentsCount = substr_count($this->argumentsForCall, ',') + 1;
222221
}

src/Framework/MockObject/Generator/templates/doubled_method.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
$__phpunit_arguments = [{arguments_call}];
1818
$__phpunit_count = func_num_args();
1919

20-
if ($__phpunit_count > {arguments_count}) {
20+
if ({arguments_count} !== null && $__phpunit_count > {arguments_count}) {
2121
$__phpunit_arguments_tmp = func_get_args();
2222
2323
for ($__phpunit_i = {arguments_count}; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

tests/end-to-end/mock-objects/generator/232.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte
8080
$__phpunit_arguments = [];
8181
$__phpunit_count = func_num_args();
8282

83-
if ($__phpunit_count > 0) {
83+
if (0 !== null && $__phpunit_count > 0) {
8484
$__phpunit_arguments_tmp = func_get_args();
8585

8686
for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

tests/end-to-end/mock-objects/generator/3154_namespaced_constant_resolving.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class Issue3154Mock extends Is\Namespaced\Issue3154 implements PHPUnit\Framework
6565
$__phpunit_arguments = [$i, $j, $v, $z];
6666
$__phpunit_count = func_num_args();
6767

68-
if ($__phpunit_count > 4) {
68+
if (4 !== null && $__phpunit_count > 4) {
6969
$__phpunit_arguments_tmp = func_get_args();
7070

7171
for ($__phpunit_i = 4; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

tests/end-to-end/mock-objects/generator/3967.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class MockBaz extends Exception implements Baz, PHPUnit\Framework\MockObject\Moc
5353
$__phpunit_arguments = [];
5454
$__phpunit_count = func_num_args();
5555

56-
if ($__phpunit_count > 0) {
56+
if (0 !== null && $__phpunit_count > 0) {
5757
$__phpunit_arguments_tmp = func_get_args();
5858

5959
for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

tests/end-to-end/mock-objects/generator/397.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class MockC extends C implements PHPUnit\Framework\MockObject\MockObjectInternal
5151
$__phpunit_arguments = [$other];
5252
$__phpunit_count = func_num_args();
5353

54-
if ($__phpunit_count > 1) {
54+
if (1 !== null && $__phpunit_count > 1) {
5555
$__phpunit_arguments_tmp = func_get_args();
5656

5757
for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

tests/end-to-end/mock-objects/generator/4139.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class %s implements PHPUnit\Framework\MockObject\MockObjectInternal, InterfaceWi
4141
$__phpunit_arguments = [];
4242
$__phpunit_count = func_num_args();
4343

44-
if ($__phpunit_count > 0) {
44+
if (0 !== null && $__phpunit_count > 0) {
4545
$__phpunit_arguments_tmp = func_get_args();
4646

4747
for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

tests/end-to-end/mock-objects/generator/abstract_class.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte
5555
$__phpunit_arguments = [];
5656
$__phpunit_count = func_num_args();
5757

58-
if ($__phpunit_count > 0) {
58+
if (0 !== null && $__phpunit_count > 0) {
5959
$__phpunit_arguments_tmp = func_get_args();
6060

6161
for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
@@ -92,7 +92,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte
9292
$__phpunit_arguments = [];
9393
$__phpunit_count = func_num_args();
9494

95-
if ($__phpunit_count > 0) {
95+
if (0 !== null && $__phpunit_count > 0) {
9696
$__phpunit_arguments_tmp = func_get_args();
9797

9898
for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
@@ -129,7 +129,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte
129129
$__phpunit_arguments = [];
130130
$__phpunit_count = func_num_args();
131131

132-
if ($__phpunit_count > 0) {
132+
if (0 !== null && $__phpunit_count > 0) {
133133
$__phpunit_arguments_tmp = func_get_args();
134134

135135
for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

tests/end-to-end/mock-objects/generator/class.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte
5555
$__phpunit_arguments = [$foo];
5656
$__phpunit_count = func_num_args();
5757

58-
if ($__phpunit_count > 1) {
58+
if (1 !== null && $__phpunit_count > 1) {
5959
$__phpunit_arguments_tmp = func_get_args();
6060

6161
for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
@@ -92,7 +92,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte
9292
$__phpunit_arguments = [$foo];
9393
$__phpunit_count = func_num_args();
9494

95-
if ($__phpunit_count > 1) {
95+
if (1 !== null && $__phpunit_count > 1) {
9696
$__phpunit_arguments_tmp = func_get_args();
9797

9898
for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

tests/end-to-end/mock-objects/generator/class_nonexistent_method.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class MockFoo extends Foo implements PHPUnit\Framework\MockObject\MockObjectInte
5151
$__phpunit_arguments = [];
5252
$__phpunit_count = func_num_args();
5353

54-
if ($__phpunit_count > 0) {
54+
if (0 !== null && $__phpunit_count > 0) {
5555
$__phpunit_arguments_tmp = func_get_args();
5656

5757
for ($__phpunit_i = 0; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {

0 commit comments

Comments
 (0)