Skip to content

Commit 4f6cff1

Browse files
committed
Fix Psalm
1 parent 3bac935 commit 4f6cff1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Inpsyde/Helpers/FunctionDocBlock.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ public static function normalizeTypesString(string $typesString): array
170170
if (strpos($splitType, '&') !== false) {
171171
$splitType = rtrim(ltrim($splitType, '('), ')');
172172
} elseif (strpos($splitType, '?') === 0) {
173-
$splitType = substr($splitType, 1);
174-
$hasNull = $splitType !== false;
173+
$splitType = substr($splitType, 1) ?: '';
174+
$hasNull = $hasNull || ($splitType !== '');
175175
}
176-
if ($splitType === false) {
176+
if (!$splitType) {
177177
continue;
178178
}
179179
if (strtolower($splitType) === 'null') {

Inpsyde/Sniffs/CodeQuality/StaticClosureSniff.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ public function process(File $phpcsFile, $stackPtr): void
7171
$tokens = $phpcsFile->getTokens();
7272
while (!$thisFound && ($i < $functionEnd)) {
7373
$token = $tokens[$i];
74-
$thisFound = (($token['code'] === T_VARIABLE) && ($token['content'] === '$this'))
74+
$content = (string)($token['content'] ?? '');
75+
$thisFound = (($token['code'] === T_VARIABLE) && ($content === '$this'))
7576
|| (
7677
in_array($token['code'], [T_DOUBLE_QUOTED_STRING, T_HEREDOC], true)
77-
&& (strpos($token['content'], '$this->') !== false)
78+
&& (strpos($content, '$this->') !== false)
7879
);
7980
$i++;
8081
}

0 commit comments

Comments
 (0)