Are PHPDoc fields from the stub overrides corresponding PHPDocs from the original class? #6205
-
I've read the docs, but still have one question. Are corresponding PHPDoc fields from stub and class somehow merging together, or PHPDoc from the stub completely overrides PHPDoc from the class? For example, is it expected that PHPStan warns about MyClass.php: /**
* @method void someMethod()
*/
class MyClass
{
public function __call(string $name, array $args)
{
// …
}
public function realMethod(): bool
{
return true;
}
} MyClass.stub /**
* @property string $someProp
*/
class MyClass
{
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Stubs are not merged, if you override the PHPDoc on the top of the class, the one from the stub file is going to be used. But of course if the original class has a different PHPDoc for example above some property, and you don't override that one in the stub, the original one is going to be used. |
Beta Was this translation helpful? Give feedback.
-
This doesn't seem to be true (anymore). I have a stub for many classes, eg |
Beta Was this translation helpful? Give feedback.
Stubs are not merged, if you override the PHPDoc on the top of the class, the one from the stub file is going to be used. But of course if the original class has a different PHPDoc for example above some property, and you don't override that one in the stub, the original one is going to be used.