Skip to content

Commit 0ecb23b

Browse files
herndlmondrejmirtes
authored andcommitted
Add regression test for non-empty-string ImpossibleCheckTypeStaticMethodCallRule problems
1 parent 160574e commit 0ecb23b

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/Type/WebMozartAssert/ImpossibleCheckTypeMethodCallRuleTest.php

+6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ public function testExtension(): void
2626
]);
2727
}
2828

29+
public function testBug85(): void
30+
{
31+
$this->analyse([__DIR__ . '/data/bug-85.php'], []);
32+
}
33+
2934
public static function getAdditionalConfigFiles(): array
3035
{
3136
return [
37+
__DIR__ . '/../../../vendor/phpstan/phpstan-strict-rules/rules.neon',
3238
__DIR__ . '/../../../extension.neon',
3339
];
3440
}
+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PHPStan\Type\WebMozartAssert;
6+
7+
use Webmozart\Assert\Assert;
8+
9+
final class Bug85
10+
{
11+
12+
public function foo(string $cityCode): void
13+
{
14+
Assert::length($cityCode, 3);
15+
Assert::upper($cityCode);
16+
}
17+
18+
/**
19+
* @param mixed $url
20+
*/
21+
function bar($url): void
22+
{
23+
Assert::stringNotEmpty($url);
24+
Assert::contains($url, '/');
25+
Assert::startsWith($url, 'https://github.com/');
26+
}
27+
28+
public function baz(string $s): void
29+
{
30+
Assert::stringNotEmpty($s);
31+
Assert::uuid($s);
32+
}
33+
34+
}

0 commit comments

Comments
 (0)