Skip to content

Commit c394bfd

Browse files
committed
minor #251 Fix CS on PHPStan rule (chr-hertel)
This PR was merged into the main branch. Discussion ---------- Fix CS on PHPStan rule | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | | License | MIT Commits ------- 099789c Fix CS on PHPStan rule
2 parents bf941b4 + 099789c commit c394bfd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.phpstan/ForbidNativeExceptionRule.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ private function isForbiddenException(string $exceptionClass): bool
8888
$exceptionClass = ltrim($exceptionClass, '\\');
8989

9090
// Check if it's a native PHP exception
91-
return in_array($exceptionClass, self::FORBIDDEN_EXCEPTIONS, true);
91+
return \in_array($exceptionClass, self::FORBIDDEN_EXCEPTIONS, true);
9292
}
9393

9494
private function createError(Node $node, string $exceptionClass, Scope $scope, string $context): RuleError
@@ -101,7 +101,7 @@ private function createError(Node $node, string $exceptionClass, Scope $scope, s
101101

102102
$suggestedNamespace = $this->getSuggestedExceptionNamespace($currentNamespace);
103103

104-
$message = sprintf(
104+
$message = \sprintf(
105105
'Use of native PHP exception "%s" is forbidden in %s context. Use "%s%s" instead.',
106106
$exceptionClass,
107107
$context,
@@ -112,7 +112,7 @@ private function createError(Node $node, string $exceptionClass, Scope $scope, s
112112
return RuleErrorBuilder::message($message)
113113
->line($node->getLine())
114114
->identifier('symfonyAi.forbidNativeException')
115-
->tip(sprintf(
115+
->tip(\sprintf(
116116
'Replace "%s" with "%s%s" to use a package-specific exception.',
117117
$exceptionClass,
118118
$suggestedNamespace,
@@ -129,6 +129,6 @@ private function getSuggestedExceptionNamespace(string $currentNamespace): strin
129129
}
130130
}
131131

132-
throw new \RuntimeException(sprintf('Unexpected namespace "%s".', $currentNamespace));
132+
throw new \RuntimeException(\sprintf('Unexpected namespace "%s".', $currentNamespace));
133133
}
134134
}

0 commit comments

Comments
 (0)