Skip to content

Commit 38546e6

Browse files
committed
Fix Psalm
1 parent 91ff869 commit 38546e6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Inpsyde/PhpcsHelpers.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public static function findOopContext(File $file, int $position): int
125125
in_array($condCode, Tokens::$ooScopeTokens, true)
126126
&& ($condLevel === $targetLevel)
127127
) {
128-
return $condPosition;
128+
return (int)$condPosition;
129129
}
130130
}
131131

@@ -422,7 +422,7 @@ public static function functionDocBlockTag(string $tag, File $file, int $positio
422422
/**
423423
* @param File $file
424424
* @param int $functionPosition
425-
* @return array<string>
425+
* @return array<string, array<string>>
426426
*/
427427
public static function functionDocBlockParamTypes(File $file, int $functionPosition): array
428428
{
@@ -688,6 +688,7 @@ public static function isUntypedPsrMethod(File $file, int $position): bool
688688
return false;
689689
}
690690

691+
/** @var array<string> $psrInterfaces */
691692
static $psrInterfaces;
692693
$psrInterfaces or $psrInterfaces = [
693694
'LoggerInterface',
@@ -712,6 +713,7 @@ public static function isUntypedPsrMethod(File $file, int $position): bool
712713
'StreamFactoryInterface',
713714
];
714715

716+
/** @var string $name */
715717
foreach ($names as $name) {
716718
$lastName = array_slice(explode('\\', $name), -1, 1)[0];
717719
if (in_array($lastName, $psrInterfaces, true)) {

Inpsyde/Sniffs/CodeQuality/ArgumentTypeDeclarationSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function process(File $file, $position)
8181

8282
foreach ($variables as $varPosition => $varToken) {
8383
// Not triggering error for variable explicitly declared as mixed (or mixed|null)
84-
if ($this->isMixed($varToken['content'] ?? '', $docBlockTypes)) {
84+
if ($this->isMixed((string)($varToken['content'] ?? ''), $docBlockTypes)) {
8585
continue;
8686
}
8787

@@ -102,7 +102,7 @@ public function process(File $file, $position)
102102

103103
/**
104104
* @param string $paramName
105-
* @param array $docBlockTypes
105+
* @param array<string, array<string>> $docBlockTypes
106106
* @return bool
107107
*/
108108
private function isMixed(string $paramName, array $docBlockTypes): bool

0 commit comments

Comments
 (0)