Skip to content

Commit

Permalink
Fix Psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzap committed Aug 31, 2023
1 parent 3bac935 commit 4f6cff1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Inpsyde/Helpers/FunctionDocBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ public static function normalizeTypesString(string $typesString): array
if (strpos($splitType, '&') !== false) {
$splitType = rtrim(ltrim($splitType, '('), ')');
} elseif (strpos($splitType, '?') === 0) {
$splitType = substr($splitType, 1);
$hasNull = $splitType !== false;
$splitType = substr($splitType, 1) ?: '';
$hasNull = $hasNull || ($splitType !== '');
}
if ($splitType === false) {
if (!$splitType) {
continue;
}
if (strtolower($splitType) === 'null') {
Expand Down
5 changes: 3 additions & 2 deletions Inpsyde/Sniffs/CodeQuality/StaticClosureSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ public function process(File $phpcsFile, $stackPtr): void
$tokens = $phpcsFile->getTokens();
while (!$thisFound && ($i < $functionEnd)) {
$token = $tokens[$i];
$thisFound = (($token['code'] === T_VARIABLE) && ($token['content'] === '$this'))
$content = (string)($token['content'] ?? '');
$thisFound = (($token['code'] === T_VARIABLE) && ($content === '$this'))
|| (
in_array($token['code'], [T_DOUBLE_QUOTED_STRING, T_HEREDOC], true)
&& (strpos($token['content'], '$this->') !== false)
&& (strpos($content, '$this->') !== false)
);
$i++;
}
Expand Down

0 comments on commit 4f6cff1

Please sign in to comment.