Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sayuprc committed Mar 16, 2024
1 parent 33ce9aa commit 8293b47
Show file tree
Hide file tree
Showing 8 changed files with 328 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,16 @@ public function dataRequiredParameterAfterOptional(): array
return [
[
70400,
[],
[
[
"Anonymous function uses native union types but they're supported only on PHP 8.0 and later.",
17,
],
[
"Anonymous function uses native union types but they're supported only on PHP 8.0 and later.",
19,
],
],
],
[
80000,
Expand All @@ -112,6 +121,14 @@ public function dataRequiredParameterAfterOptional(): array
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
13,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
17,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
21,
],
],
],
[
Expand All @@ -133,10 +150,59 @@ public function dataRequiredParameterAfterOptional(): array
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
13,
],
[
'Deprecated in PHP 8.1: Required parameter $bar follows optional parameter $foo.',
15,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
17,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
21,
],
],
],
[
80300,
[
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
5,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
9,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
11,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
13,
],
[
'Deprecated in PHP 8.1: Required parameter $bar follows optional parameter $foo.',
15,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
17,
],
[
'Deprecated in PHP 8.3: Required parameter $bar follows optional parameter $foo.',
19,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
21,
],
[
'Deprecated in PHP 8.3: Required parameter $bar follows optional parameter $foo.',
23,
],
],
],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,16 @@ public function dataRequiredParameterAfterOptional(): array
return [
[
70400,
[],
[
[
"Anonymous function uses native union types but they're supported only on PHP 8.0 and later.",
29,
],
[
"Anonymous function uses native union types but they're supported only on PHP 8.0 and later.",
33,
],
],
],
[
80000,
Expand All @@ -156,6 +165,14 @@ public function dataRequiredParameterAfterOptional(): array
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
21,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
29,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
37,
],
],
],
[
Expand All @@ -177,10 +194,59 @@ public function dataRequiredParameterAfterOptional(): array
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
21,
],
[
'Deprecated in PHP 8.1: Required parameter $bar follows optional parameter $foo.',
25,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
29,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
37,
],
],
],
[
80300,
[
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
5,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
13,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
17,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
21,
],
[
'Deprecated in PHP 8.1: Required parameter $bar follows optional parameter $foo.',
25,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
29,
],
[
'Deprecated in PHP 8.3: Required parameter $bar follows optional parameter $foo.',
33,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
37,
],
[
'Deprecated in PHP 8.3: Required parameter $bar follows optional parameter $foo.',
41,
],
],
],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,16 @@ public function dataRequiredParameterAfterOptional(): array
return [
[
70400,
[],
[
[
"Function RequiredAfterOptional\doAmet() uses native union types but they're supported only on PHP 8.0 and later.",
34,
],
[
"Function RequiredAfterOptional\doConsectetur() uses native union types but they're supported only on PHP 8.0 and later.",
38,
],
],
],
[
80000,
Expand All @@ -237,6 +246,14 @@ public function dataRequiredParameterAfterOptional(): array
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
26,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
34,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
42,
],
],
],
[
Expand All @@ -258,10 +275,59 @@ public function dataRequiredParameterAfterOptional(): array
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
26,
],
[
'Deprecated in PHP 8.1: Required parameter $bar follows optional parameter $foo.',
30,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
34,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
42,
],
],
],
[
80300,
[
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
5,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
14,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
18,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
26,
],
[
'Deprecated in PHP 8.1: Required parameter $bar follows optional parameter $foo.',
30,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
34,
],
[
'Deprecated in PHP 8.3: Required parameter $bar follows optional parameter $foo.',
38,
],
[
'Deprecated in PHP 8.0: Required parameter $bar follows optional parameter $foo.',
42,
],
[
'Deprecated in PHP 8.3: Required parameter $bar follows optional parameter $foo.',
46,
],
],
],
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php // lint >= 7.4
<?php // lint >= 8.0

namespace RequiredAfterOptional;

Expand All @@ -13,3 +13,11 @@
fn (?int $foo = 1, $bar): int => 1; // not OK

fn (?int $foo = null, $bar): int => 1; // not OK

fn (int|null $foo = 1, $bar): int => 1; // not OK

fn (int|null $foo = null, $bar): int => 1; // not OK

fn (mixed $foo = 1, $bar): int => 1; // not OK

fn (mixed $foo = null, $bar): int => 1; // not OK
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace RequiredAfterOptional;

Expand All @@ -25,3 +25,19 @@ function (?int $foo = 1, $bar): void // not OK
function (?int $foo = null, $bar): void // not OK
{
};

function (int|null $foo = 1, $bar): void // not OK
{
};

function (int|null $foo = null, $bar): void // not OK
{
};

function (mixed $foo = 1, $bar): void // not OK
{
};

function (mixed $foo = null, $bar): void // not OK
{
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php // lint >= 8.0

namespace RequiredAfterOptional;

Expand Down Expand Up @@ -30,3 +30,19 @@ function doDolor(?int $foo = 1, $bar): void // not OK
function doSit(?int $foo = null, $bar): void // not OK
{
}

function doAmet(int|null $foo = 1, $bar): void // not OK
{
}

function doConsectetur(int|null $foo = null, $bar): void // not OK
{
}

function doAdipiscing(mixed $foo = 1, $bar): void // not OK
{
}

function doElit(mixed $foo = null, $bar): void // not OK
{
}

0 comments on commit 8293b47

Please sign in to comment.