You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Commenting a method with @return void triggers an InvalidReturnVoid error: Function return type is void, but function contains return statement (....Commenting.FunctionComment.InvalidReturnVoid)
when the method contains anonymous class that contains a return.
Example:
<?php
namespace Test;
/**
* Class AnonTest
*/
class AnonTest
{
/**
* do something
*
* @return void
*/
public function someFunc(): void
{
$class = new class
{
/**
* Getter
*
* @return string
*/
public function getString(): string
{
return 'some string';
}
};
echo $class->getString();
}
}