Skip to content

Commit dcda566

Browse files
committed
Regression tests
Closes phpstan/phpstan#7824 Closes phpstan/phpstan#10819
1 parent efef7fc commit dcda566

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

tests/PHPStan/Rules/Methods/CallToStaticMethodStatementWithoutSideEffectsRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,9 @@ public function testFirstClassCallables(): void
101101
]);
102102
}
103103

104+
public function testBug10819(): void
105+
{
106+
$this->analyse([__DIR__ . '/data/bug-10819.php'], []);
107+
}
108+
104109
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Bug10819;
4+
5+
use DateTime;
6+
use ValueError;
7+
8+
class HelloWorld
9+
{
10+
public function checkDate(string $dateString): bool
11+
{
12+
try {
13+
DateTime::createFromFormat('Y-m-d', $dateString);
14+
15+
return true;
16+
} catch (ValueError) {
17+
return false;
18+
}
19+
}
20+
}

tests/PHPStan/Rules/Properties/TypesAssignedToPropertiesRuleTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,4 +813,10 @@ public function testBug8282(): void
813813
$this->analyse([__DIR__ . '/data/bug-8282.php'], []);
814814
}
815815

816+
public function testBug7824(): void
817+
{
818+
$this->checkExplicitMixed = true;
819+
$this->analyse([__DIR__ . '/data/bug-7824.php'], []);
820+
}
821+
816822
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace Bug7824;
4+
5+
use Ds\Map;
6+
7+
final class A
8+
{
9+
/** @var Map<string, string> */
10+
private Map $map;
11+
12+
public function __construct()
13+
{
14+
$this->map = new Map();
15+
}
16+
}

0 commit comments

Comments
 (0)