Skip to content

Commit 1ee5bfc

Browse files
committed
Add more regression tests
1 parent d4bdaf7 commit 1ee5bfc

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

tests/PHPStan/Rules/Functions/CallToFunctionParametersRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,11 @@ public function testBug9399(): void
16251625
$this->analyse([__DIR__ . '/data/bug-9399.php'], []);
16261626
}
16271627

1628+
public function testBug9559(): void
1629+
{
1630+
$this->analyse([__DIR__ . '/data/bug-9559.php'], []);
1631+
}
1632+
16281633
public function testBug9923(): void
16291634
{
16301635
if (PHP_VERSION_ID < 80000) {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug9559;
4+
5+
class ZZ {};
6+
function foo(?ZZ $z = null, ?int $a = 0, ?string $b = "x"): string { return "bah"; }
7+
8+
function doit(int $x): void {
9+
$call = [];
10+
if ($x) $call['a'] = 45;
11+
foo(...array_merge($call, [ "b" => "3" ]));
12+
}

tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,11 @@ public function testBug8632(): void
882882
$this->analyse([__DIR__ . '/data/bug-8632.php'], []);
883883
}
884884

885+
public function testBug7857(): void
886+
{
887+
$this->analyse([__DIR__ . '/data/bug-7857.php'], []);
888+
}
889+
885890
public function testBug8879(): void
886891
{
887892
$this->analyse([__DIR__ . '/data/bug-8879.php'], []);
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug7857;
4+
5+
class Paginator
6+
{
7+
/**
8+
* @return array{page: int, perPage?: int}
9+
*/
10+
public function toArray(int $page, ?int $perPage): array
11+
{
12+
return array_merge(
13+
['page' => $page],
14+
$perPage !== null ? ['perPage' => $perPage] : []
15+
);
16+
}
17+
}

0 commit comments

Comments
 (0)