Error Identifier: phpstanPlayground.phpDoc
Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.
Code example #
<?php declare(strict_types = 1);
/*
* @param string $name
* @return int
*/
function doFoo(string $name): int
{
return strlen($name);
}
Why is it reported? #
A comment contains PHPDoc tags (like @param, @return, @var, etc.) but uses /* instead of /** as the opening delimiter. PHP and PHPStan only recognize PHPDoc blocks that start with /**. A comment starting with /* is treated as a regular multi-line comment, and its type annotations are silently ignored.
This is a common typo that can cause PHPStan to miss type information that was intended to be provided.
How to fix it #
Change the comment opening from /* to /**:
-/*
+/**
* @param string $name
* @return int
*/
function doFoo(string $name): int
{
return strlen($name);
}
Non-ignorable error #
This error cannot be ignored using @phpstan-ignore or the ignoreErrors configuration. Non-ignorable errors indicate code that would cause a crash or a fatal error at runtime, or a fundamental problem in the analysed code that must be addressed.
Rules that report this error #
- PHPStan\Rules\Playground\PhpdocCommentRule [1]