Skip to content

Commit a838bb4

Browse files
committed
Regression tests
Closes phpstan/phpstan#6697 Closes phpstan/phpstan#6443
1 parent 2cd83b2 commit a838bb4

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

tests/PHPStan/Rules/Comparison/ImpossibleCheckTypeFunctionCallRuleTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,4 +573,18 @@ public function testConditionalTypesInference(): void
573573
]);
574574
}
575575

576+
public function testBug6697(): void
577+
{
578+
$this->checkAlwaysTrueCheckTypeFunctionCall = true;
579+
$this->treatPhpDocTypesAsCertain = true;
580+
$this->analyse([__DIR__ . '/data/bug-6697.php'], []);
581+
}
582+
583+
public function testBug6443(): void
584+
{
585+
$this->checkAlwaysTrueCheckTypeFunctionCall = true;
586+
$this->treatPhpDocTypesAsCertain = true;
587+
$this->analyse([__DIR__ . '/data/bug-6443.php'], []);
588+
}
589+
576590
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Bug6443;
4+
5+
/**
6+
* String utilities for frequent tasks
7+
*/
8+
class StringUtils
9+
{
10+
public static function stringify(
11+
mixed $anyValue,
12+
string $arrayConcatChar = ", "
13+
): string {
14+
// this cases are always empty strings
15+
if ($anyValue === null || (is_array($anyValue) && !$anyValue)) {
16+
return "";
17+
}
18+
if (is_array($anyValue)) {
19+
return implode($arrayConcatChar, $anyValue);
20+
}
21+
return "blub";
22+
}
23+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
namespace Bug6697;
4+
5+
$result = \is_subclass_of( '\\My\\Namespace\\MyClass', '\\My\\Namespace\\MyBaseClass', true);

0 commit comments

Comments
 (0)