Skip to content

Commit 1aa8ffd

Browse files
authored
Merge pull request #5 from orklah/misc-improvements
Misc code improvements
2 parents ebded8b + 44baeb5 commit 1aa8ffd

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

psalm.xml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xmlns="https://getpsalm.org/schema/config"
55
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
6-
totallyTyped="false"
7-
allowPhpStormGenerics="true"
6+
totallyTyped="true"
7+
errorLevel="1"
88
>
99
<projectFiles>
1010
<directory name="src" />
@@ -14,14 +14,8 @@
1414
</projectFiles>
1515

1616
<issueHandlers>
17-
<InternalClass errorLevel="suppress" />
1817
<MoreSpecificReturnType errorLevel="suppress" />
1918
<LessSpecificReturnStatement errorLevel="suppress" />
20-
<MoreSpecificImplementedParamType errorLevel="suppress" />
21-
<UnresolvableInclude errorLevel="suppress" />
22-
<ParamNameMismatch errorLevel="suppress" />
23-
<ForbiddenCode errorLevel="suppress" />
24-
<RedundantCondition errorLevel="suppress" />
2519
</issueHandlers>
2620

2721
</psalm>

src/voku/PhpDocFixer/CliCommand/PhpDocFixerCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
6868
if ($phpStormStubsInfo[$functionName_or_classAndMethodName] !== $types) {
6969
$errors[$functionName_or_classAndMethodName] = [
7070
'phpStubTypes' => $phpStormStubsInfo[$functionName_or_classAndMethodName],
71-
'phpDocTypes' => $types,
71+
'phpDocTypes' => $types,
7272
];
7373
}
7474
}

src/voku/PhpDocFixer/ReadPhpStormStubs/PhpStormStubsReader.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ public function parse(): array
3333

3434
foreach ($phpCode->getClasses() as $class) {
3535
$methodInfo = $class->getMethodsInfo();
36+
$className = (string) $class->name;
3637
foreach ($methodInfo as $methodName => $info) {
37-
$return[$class->name . '::' . $methodName]['return'] = \ltrim($info['returnTypes']['typeFromPhpDocSimple'] ?? '', '\\');
38+
$return[$className . '::' . $methodName]['return'] = \ltrim($info['returnTypes']['typeFromPhpDocSimple'] ?? '', '\\');
3839
foreach ($info['paramsTypes'] as $paramName => $paramTypes) {
39-
$return[$class->name . '::' . $methodName]['params'][$paramName] = \ltrim($paramTypes['typeFromPhpDocSimple'] ?? '', '\\');
40+
$return[$className . '::' . $methodName]['params'][$paramName] = \ltrim($paramTypes['typeFromPhpDocSimple'] ?? '', '\\');
4041
}
4142
}
4243
}

src/voku/PhpDocFixer/ReadXmlDocs/XmlReader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function parse(): array
2727
$finder->files()->in($this->xml_path);
2828

2929
$data = [[]];
30+
/** @var \Symfony\Component\Finder\SplFileInfo $file */
3031
foreach ($finder as $file) {
3132
if (\strpos($file->getFilename(), '.xml') === false) {
3233
continue;
@@ -52,7 +53,7 @@ public function parse(): array
5253
}
5354
}
5455

55-
return \array_merge([], ...$data);
56+
return \array_merge(...$data);
5657
}
5758

5859
/**

tests/CheckerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010
final class CheckerTest extends \PHPUnit\Framework\TestCase
1111
{
12-
public static function testPhpStormStubsReader()
12+
public static function testPhpStormStubsReader(): void
1313
{
1414
$phpStormStubsPath = __DIR__ . '/../vendor/jetbrains/phpstorm-stubs/mbstring/';
1515
$phpTypesFromPhpStormStubs = new \voku\PhpDocFixer\ReadPhpStormStubs\PhpStormStubsReader($phpStormStubsPath);

0 commit comments

Comments
 (0)