- Larastan Version: 3.6.0
- Laravel Version: 11.45.1
Description
Adding Larastan breaks phpstan's resolving of property types included by @mixin into classes inheriting from Laravel requests. The type always resolves to mixed instead of the proper type.
Laravel code where the issue was found
namespace StanTest;
/**
* @property bool $test
*/
#[\AllowDynamicProperties]
class Mixin
{
}
namespace StanTest;
use Illuminate\Http\Request;
/**
* @mixin \StanTest\Mixin
*/
#[\AllowDynamicProperties]
class TestClass extends Request
{
public function test(): bool
{
return $this->test;
}
}
phpstan complains here:
------ -------------------------------------------------------------------------
Line TestClass.php
------ -------------------------------------------------------------------------
15 Method StanTest\TestClass::test() should return bool but returns mixed.
🪪 return.type
✏️ src/TestClass.php:15
------ -------------------------------------------------------------------------
If TestClass doesn't extend Request, it's fine.
Description
Adding Larastan breaks phpstan's resolving of property types included by @mixin into classes inheriting from Laravel requests. The type always resolves to mixed instead of the proper type.
Laravel code where the issue was found
phpstan complains here:
If TestClass doesn't extend Request, it's fine.