From d844ceb24a3fd016c0bb94f88337c8ad21ac663f Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Sun, 7 Jul 2024 13:09:36 +0900 Subject: [PATCH] Mark 'method_intercept' function for PHPStan and Psalm to ignore The 'method_intercept' function which is a PECL-created function is updated to be ignored by PHPStan and Psalm. This change addresses static analysis warnings from these tools, ensuring that they do not flag this part of the code. The update will bring more clarity to issues identified during codebase analysis. --- src/Aspect.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Aspect.php b/src/Aspect.php index c92a41f5..47c0fe7d 100644 --- a/src/Aspect.php +++ b/src/Aspect.php @@ -20,7 +20,7 @@ use function end; use function extension_loaded; use function get_declared_classes; -use function method_intercept; +use function method_intercept; // @phpstan-ignore-line use function strcasecmp; use function sys_get_temp_dir; @@ -131,7 +131,8 @@ private function applyInterceptors(): void $methodNames = array_keys($methods); foreach ($methodNames as $methodName) { assert($dispatcher instanceof MethodInterceptorInterface); - method_intercept($className, $methodName, $dispatcher); + /** @psalm-suppress UndefinedFunction PECL-created function */ + method_intercept($className, $methodName, $dispatcher); // @phpstan-ignore-line } } }