Skip to content

Commit da4490a

Browse files
Hackwarrichard67
authored andcommitted
Fixing phpstan error and adding baseline (#139)
1 parent 0a14507 commit da4490a

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

.gitattributes

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
.github/ export-ignore
2-
.phan/ export-ignore
32
docs/ export-ignore
43
Tests/ export-ignore
5-
.drone.jsonnet export-ignore
6-
.drone.yml export-ignore
74
.editorconfig export-ignore
85
.gitattributes export-ignore
96
.gitignore export-ignore
107
.phpunit.cache export-ignore
118
phpunit.xml.dist export-ignore
12-
rector.php export-ignore
139
ruleset.xml export-ignore
10+
phpstan.neon export-ignore
11+
phpstan-baseline.neon export-ignore

phpstan-baseline.neon

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
parameters:
2+
ignoreErrors:
3+
-
4+
message: '#^Call to function is_int\(\) with int will always evaluate to true\.$#'
5+
identifier: function.alreadyNarrowedType
6+
count: 1
7+
path: src/AbstractWebApplication.php
8+
9+
-
10+
message: '#^Instanceof between DateTime and DateTime will always evaluate to true\.$#'
11+
identifier: instanceof.alwaysTrue
12+
count: 1
13+
path: src/AbstractWebApplication.php
14+
15+
-
16+
message: '#^Result of && is always false\.$#'
17+
identifier: booleanAnd.alwaysFalse
18+
count: 1
19+
path: src/AbstractWebApplication.php

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
includes:
33
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
4+
- phpstan-baseline.neon
45

56
parameters:
67
level: 5

src/AbstractWebApplication.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ protected function compress()
321321

322322
// Iterate through the encodings and attempt to compress the data using any found supported encodings.
323323
foreach ($encodings as $encoding) {
324-
if (($supported[$encoding] == 'gz') || ($supported[$encoding] == 'deflate')) {
324+
if (in_array($supported[$encoding], ['gz', 'deflate'])) {
325325
// Verify that the server supports gzip compression before we attempt to gzip encode the data.
326326
// @codeCoverageIgnoreStart
327327
if (!\extension_loaded('zlib') || \ini_get('zlib.output_compression')) {

0 commit comments

Comments
 (0)