I have been cleaning up some PhpStorm warnings using PHPDoc and in some cases there are objects referenced incorrectly. Here's an example:
$Title = $currentSlide->createRichTextShape();
CreateRichTextShape() returns as RichText as seen here:
/**
* Create rich text shape
*
* @return \PhpOffice\PhpPresentation\Shape\RichText
*/
public function createRichTextShape()
{
$shape = new RichText();
$this->addShape($shape);
return $shape;
}
This all works fine.
Then I try to call a function within RichText such as:
$textRun = $Title->createTextRun( 'Title' );
However, when hovering over the code I receive this warning:
PhpStorm thinks CreateRichTextShape()
is returning an AbstractShape
when it is actually returning a RichText
, so it can't find the function within AbstractShape
even though it exists and is documented correctly.
Note that there are no actual errors in this code - it runs fine. Just want to get rid of the warnings.
At least regarding Laravel Projects, you can clear this up in PhpStorm by adding
/** @var RichText $Title */
before the variable/method.