Skip to content

Commit c13ffc1

Browse files
herndlmondrejmirtes
authored andcommitted
Add regression test
1 parent 9d450a4 commit c13ffc1

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

tests/Type/WebMozartAssert/ImpossibleCheckTypeMethodCallRuleTest.php

+18
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ public function testExtension(): void
4747
]);
4848
}
4949

50+
public function testBug8(): void
51+
{
52+
$this->analyse([__DIR__ . '/data/bug-8.php'], [
53+
[
54+
'Call to static method Webmozart\Assert\Assert::numeric() with numeric-string will always evaluate to true.',
55+
15,
56+
],
57+
[
58+
'Call to static method Webmozart\Assert\Assert::numeric() with \'foo\' will always evaluate to false.',
59+
16,
60+
],
61+
[
62+
'Call to static method Webmozart\Assert\Assert::numeric() with \'17.19\' will always evaluate to true.',
63+
17,
64+
],
65+
]);
66+
}
67+
5068
public function testBug33(): void
5169
{
5270
$this->analyse([__DIR__ . '/data/bug-33.php'], []);
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace WebmozartAssertBug8;
6+
7+
use Webmozart\Assert\Assert;
8+
9+
class Bug8
10+
{
11+
12+
public function foo(string $a): void
13+
{
14+
Assert::numeric($a);
15+
Assert::numeric($a);
16+
Assert::numeric('foo');
17+
Assert::numeric('17.19');
18+
}
19+
20+
}

0 commit comments

Comments
 (0)