Skip to content

Commit e2a1a27

Browse files
committed
:octocat: phpstan baseline
1 parent e1af2fa commit e2a1a27

File tree

5 files changed

+52
-24
lines changed

5 files changed

+52
-24
lines changed

.gitattributes

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
/.build export-ignore
2-
/.github export-ignore
3-
/.idea export-ignore
4-
/.phan export-ignore
5-
/.phpdoc export-ignore
6-
/docs export-ignore
7-
/examples export-ignore
8-
/tests export-ignore
9-
/.editorconfig export-ignore
10-
/.gitattributes export-ignore
11-
/.gitignore export-ignore
12-
/.readthedocs.yml export-ignore
13-
/phpcs.xml.dist export-ignore
14-
/phpdoc.xml.dist export-ignore
15-
/phpmd.xml.dist export-ignore
16-
/phpunit.xml.dist export-ignore
17-
/phpstan.dist.neon export-ignore
1+
/.build export-ignore
2+
/.github export-ignore
3+
/.idea export-ignore
4+
/.phan export-ignore
5+
/.phpdoc export-ignore
6+
/docs export-ignore
7+
/examples export-ignore
8+
/tests export-ignore
9+
/.editorconfig export-ignore
10+
/.gitattributes export-ignore
11+
/.gitignore export-ignore
12+
/.readthedocs.yml export-ignore
13+
/phpcs.xml.dist export-ignore
14+
/phpdoc.xml.dist export-ignore
15+
/phpmd.xml.dist export-ignore
16+
/phpunit.xml.dist export-ignore
17+
/phpstan.dist.neon export-ignore
18+
/phpstan-baseline.neon export-ignore
1819

1920
*.php diff=php

phpstan-baseline.neon

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: "#^Access to an undefined property chillerlan\\\\SettingsTest\\\\TestContainer\\:\\:\\$foo\\.$#"
5+
count: 1
6+
path: tests/ContainerTest.php
7+
8+
-
9+
message: "#^Access to private property chillerlan\\\\SettingsTest\\\\TestContainer\\:\\:\\$test3\\.$#"
10+
count: 4
11+
path: tests/ContainerTest.php
12+
13+
-
14+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertFalse\\(\\) with true will always evaluate to false\\.$#"
15+
count: 1
16+
path: tests/ContainerTest.php
17+
18+
-
19+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNull\\(\\) with string will always evaluate to false\\.$#"
20+
count: 2
21+
path: tests/ContainerTest.php
22+
23+
-
24+
message: "#^Property chillerlan\\\\SettingsTest\\\\TestContainer\\:\\:\\$test3 \\(string\\) in isset\\(\\) is not nullable\\.$#"
25+
count: 1
26+
path: tests/ContainerTest.php
27+
28+
-
29+
message: "#^Property chillerlan\\\\SettingsTest\\\\TestContainer\\:\\:\\$test3 is never read, only written\\.$#"
30+
count: 1
31+
path: tests/TestContainer.php

phpstan.dist.neon

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ parameters:
88
- src
99
- tests
1010

11+
treatPhpDocTypesAsCertain: false
12+
1113
includes:
14+
- phpstan-baseline.neon
1215
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
1316
- vendor/phpstan/phpstan-deprecation-rules/rules.neon

tests/ContainerTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public function testConstruct():void{
2727

2828
$this::assertSame('test1', $container->test1);
2929
$this::assertSame(true, $container->test2);
30-
/** @phpstan-ignore-next-line */
3130
$this::assertNull($container->test3);
3231
$this::assertSame('test4', $container->test4);
3332

@@ -39,16 +38,13 @@ public function testGet():void{
3938

4039
$this::assertSame('foo', $container->test1);
4140
$this::assertNull($container->test2);
42-
/** @phpstan-ignore-next-line */
4341
$this::assertNull($container->test3);
4442
$this::assertNull($container->test4);
45-
/** @phpstan-ignore-next-line */
4643
$this::assertNull($container->foo);
4744

4845
// isset test
4946
$this::assertTrue(isset($container->test1));
5047
$this::assertFalse(isset($container->test2));
51-
/** @phpstan-ignore-next-line */
5248
$this::assertFalse(isset($container->test3));
5349
$this::assertFalse(isset($container->test4));
5450
$this::assertFalse(isset($container->foo));
@@ -66,12 +62,10 @@ public function testSet():void{
6662
$container = new TestContainer;
6763
$container->test1 = 'bar';
6864
$container->test2 = false;
69-
/** @phpstan-ignore-next-line */
7065
$container->test3 = 'nope';
7166

7267
$this::assertSame('bar', $container->test1);
7368
$this::assertSame(false, $container->test2);
74-
/** @phpstan-ignore-next-line */
7569
$this::assertNull($container->test3);
7670

7771
// unset

tests/TestContainer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@
1616
class TestContainer extends SettingsContainerAbstract{
1717
use TestOptionsTrait;
1818

19-
/** @phpstan-ignore-next-line */
2019
private string $test3 = 'what';
2120
}

0 commit comments

Comments
 (0)