diff --git a/examples/StringChecker.php b/examples/StringChecker.php index 2f8b654ed..3f3014088 100644 --- a/examples/StringChecker.php +++ b/examples/StringChecker.php @@ -1,31 +1,36 @@ =3.0.2"` to your + * composer.json. */ class StringChecker extends \Psalm\Plugin { /** - * checks an expression - * @param PhpParser\Node\Expr $stmt - * @param Context $context - * @param CodeLocation $file_name - * @param array $suppressed_issues + * Checks an expression + * + * @param \PhpParser\Node\Expr $stmt + * @param Context $context + * @param CodeLocation $code_location + * @param array $suppressed_issues * @return null|false */ public function checkExpression( - PhpParser\Node\Expr $stmt, + \PhpParser\Node\Expr $stmt, Context $context, CodeLocation $code_location, array $suppressed_issues ) { if ($stmt instanceof \PhpParser\Node\Scalar\String_) { + // Replace "Psalm" with your namespace $class_or_class_method = '/^\\\?Psalm(\\\[A-Z][A-Za-z0-9]+)+(::[A-Za-z0-9]+)?$/'; if (preg_match($class_or_class_method, $stmt->value)) {