diff --git a/src/PHPStan/PregMatchTypeSpecifyingExtension.php b/src/PHPStan/PregMatchTypeSpecifyingExtension.php index 774b45b..58f388b 100644 --- a/src/PHPStan/PregMatchTypeSpecifyingExtension.php +++ b/src/PHPStan/PregMatchTypeSpecifyingExtension.php @@ -87,7 +87,9 @@ public function specifyTypes(MethodReflection $methodReflection, StaticCall $nod $matchedType = PregMatchFlags::removeNullFromMatches($matchedType); } + $overwrite = false; if ($context->false()) { + $overwrite = true; $context = $context->negate(); } @@ -98,6 +100,6 @@ public function specifyTypes(MethodReflection $methodReflection, StaticCall $nod $scope, )->setRootExpr($node); - return $context->false() ? $typeSpecifier->setAlwaysOverwriteTypes() : $typeSpecifier; + return $overwrite ? $typeSpecifier->setAlwaysOverwriteTypes() : $typeSpecifier; } } diff --git a/src/PcreException.php b/src/PcreException.php index 3ac4e61..23d9327 100644 --- a/src/PcreException.php +++ b/src/PcreException.php @@ -39,7 +39,6 @@ private static function pcreLastErrorMessage($code) return preg_last_error_msg(); } - /** @var array> $constants */ $constants = get_defined_constants(true); if (!isset($constants['pcre']) || !is_array($constants['pcre'])) { return 'UNDEFINED_ERROR';