Skip to content

Commit fe5d13f

Browse files
authored
Fix issues reported by PHPStan (#684)
1 parent 513568a commit fe5d13f

File tree

4 files changed

+25
-35
lines changed

4 files changed

+25
-35
lines changed

phpstan.neon.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ parameters:
2727
path: 'tests/Scoper/PhpScoperTest.php'
2828
- message: '#Dead catch#'
2929
path: 'tests/Scoper/PhpScoperSpecTest.php'
30-
- message: '#Cannot assign offset#'
31-
path: 'tests/Scoper/PhpScoperSpecTest.php'
3230
- message: '#DummyScoperFactory extends @final#'
3331
path: 'tests/Console/Command/DummyScoperFactory.php'
3432
- message: '#Anonymous function should return string but returns array#'
@@ -37,3 +35,5 @@ parameters:
3735
path: 'tests/Console/Command/AddPrefixCommandIntegrationTest.php'
3836
- message: '#ConfigurationKeysTest\:\:retrieveConfigurationKeys\(\) should return array#'
3937
path: 'tests/Configuration/ConfigurationKeysTest.php'
38+
- message: '#Property .* does not accept#'
39+
path: 'src/PhpParser/NodeVisitor/UseStmt/UseStmtCollection.php'

src/Autoload/ScoperAutoloadGenerator.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ final class ScoperAutoloadGenerator
4141
// https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#exposing-classes
4242
EOF;
4343

44+
/** @var non-empty-string */
4445
private static string $eol;
4546

4647
private SymbolsRegistry $registry;
@@ -179,10 +180,6 @@ private static function wrapStatementsInNamespaceBlock(array $statements): array
179180
static function (string $statement) use ($indentLine): string {
180181
$parts = explode(self::$eol, $statement);
181182

182-
if (false === $parts) {
183-
return $statement;
184-
}
185-
186183
return implode(
187184
self::$eol,
188185
array_map($indentLine, $parts),

src/Configuration/RegexChecker.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function isRegexLike(string $value): bool
4040
return false;
4141
}
4242

43+
/** @var non-empty-string $firstCharacter */
4344
$firstCharacter = $value[0];
4445

4546
if (!self::isValidDelimiter($firstCharacter)) {
@@ -48,7 +49,7 @@ public function isRegexLike(string $value): bool
4849

4950
$parts = explode($firstCharacter, $value);
5051

51-
if (false === $parts || count($parts) !== 3) {
52+
if (count($parts) !== 3) {
5253
return false;
5354
}
5455

vendor-bin/phpstan/composer.lock

Lines changed: 20 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)