-
-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
help wantedExtra attention is neededExtra attention is needed
Description
I'm not sure if this is a real issue or not, maybe there is a way to fix this with \StubsGenerator API.
What?
Here is a generated stubs file:
<?php
namespace WP_Syntex\SomePackage;
interface FirstInterface
{
/**
* @return SecondInterface
*/
public function get(): \WP_Syntex\SomePackage\SecondInterface;
}
interface SecondInterface
{
public function getId(): int;
}
class SecondObject implements \WP_Syntex\SomePackage\SecondInterface
{
public function __construct(int $id)
{
}
public function getId(): int
{
}
}
class FirstObject implements \WP_Syntex\SomePackage\FirstInterface
{
public function __construct(\WP_Syntex\SomePackage\SecondObject $second)
{
}
/**
* @return SecondObject
*/
public function get(): \WP_Syntex\SomePackage\SecondObject
{
}
}Additional information
We can see that FirstInterface depends on SecondInterface. It seems to create weird PHPStan errors (see)...
Here is the directory tree:
.
├── FirstInterface.php
├── FirstObject.php
├── SecondInterface.php
└── SecondObject.php
And the finder configuration:
return \StubsGenerator\Finder::create()
->in('./SomePackage');Expected result
I would expect SecondInterface to be defined before FirstInterface.
Note that this behavior occurs also with concrete classes (in Polylang stubs for instance).
Otherwise thanks for this awesome tool ❤️
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedExtra attention is neededExtra attention is needed