8000 regression tests · phpstan/phpstan-src@7cc0b0d · GitHub
[go: up one dir, main page]

Skip to content

Commit 7cc0b0d

Browse files
committed
regression tests
1 parent 933c2be commit 7cc0b0d

File tree

4 files changed

+50
-8
lines changed

4 files changed

+50
-8
lines changed

tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class TypesAssignedToPropertiesRuleTest extends RuleTestCase
1414
{
1515

1616
private bool $checkExplicitMixed = false;
17+
1718
private bool $checkImplicitMixed = false;
1819

1920
protected function getRule(): Rule
@@ -796,4 +797,14 @@ public function testBug8825(): void
796797
$this->analyse([__DIR__ . '/data/bug-8825.php'], []);
797798
}
798799

800+
public function testBug7844(): void
801+
{
802+
$this->analyse([__DIR__ . '/data/bug-7844.php'], []);
803+
}
804+
805+
public function testBug7844b(): void
806+
{
807+
$this->analyse([__DIR__ . '/data/bug-7844b.php'], []);
808+
}
809+
799810
}

tests/PHPStan/Rules/Properties/data/bug-7844.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ class C
1212

1313
public function foo(): void
1414
{
15-
\PHPStan\dumpType($this->data);
1615
if (count($this->data) > 0) {
17-
\PHPStan\dumpType($this->data);
1816
$this->val = array_shift($this->data);
19-
\PHPStan\dumpType($this->val);
2017
}
2118
}
2219
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace Bug7844b;
4+
5+
class Obj {}
6+
7+
class HelloWorld
8+
{
9+
public Obj $p1;
10+
public Obj $p2;
11+
public Obj $p3;
12+
public Obj $p4;
13+
public Obj $p5;
14+
15+
/** @param non-empty-list<Obj> $objs */
16+
public function __construct(array $objs)
17+
{
18+
\assert($objs !== []);
19+
$this->p1 = $objs[0];
20+
21+
\assert($objs !== []);
22+
$this->p2 = $objs[array_key_last($objs)];
23+
24+
\assert($objs !== []);
25+
$this->p3 = \array_pop($objs);
26+
27+
\assert($objs !== []);
28+
$this->p4 = \array_shift($objs);
29+
30+
\assert($objs !== []);
31+
$p = \array_shift($objs);
32+
$this->p5 = $p;
33+
34+
\assert($objs !== []);
35+
$this->doSomething(\array_pop($objs));
36+
}
37+
38+
private function doSomething(Obj $obj): void {}
39+
}

tests/PHPStan/Rules/Variables/ParameterOutAssignedTypeRuleTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,4 @@ public function testBug13093b(): void
7474
$this->analyse([__DIR__ . '/data/bug-13093b.php'], []);
7575
}
7676

77-
public function testBug7844(): void
78-
{
79-
$this->analyse([__DIR__ . '/data/bug-7844.php'], []);
80-
}
81-
8277
}

0 commit comments

Comments
 (0)
0