Skip to content

Commit

Permalink
Fix 'WP_Error should be referenced via a fully qualified name.' (szep…
Browse files Browse the repository at this point in the history
  • Loading branch information
IanDelMar authored Feb 26, 2023
1 parent c67f764 commit 0c34d2f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/IsWpErrorRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use PHPStan\Rules\RuleLevelHelper;
use PHPStan\Type\ObjectType;
use PHPStan\Type\VerbosityLevel;
use WP_Error;

use function sprintf;

Expand Down Expand Up @@ -65,7 +64,7 @@ public function processNode(Node $node, Scope $scope): array
$argumentType = $scope->getType($args[0]->value);
$accepted = $this->ruleLevelHelper->accepts(
$argumentType,
new ObjectType(WP_Error::class),
new ObjectType(\WP_Error::class),
$scope->isDeclareStrictTypes()
);

Expand All @@ -80,7 +79,7 @@ public function processNode(Node $node, Scope $scope): array
];
}

if ((new ObjectType(WP_Error::class))->isSuperTypeOf($argumentType)->yes()) {
if ((new ObjectType(\WP_Error::class))->isSuperTypeOf($argumentType)->yes()) {
return [
RuleErrorBuilder::message(
'is_wp_error(WP_Error) will always evaluate to true.'
Expand Down

0 comments on commit 0c34d2f

Please sign in to comment.