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 ❤️
I'm not sure if this is a real issue or not, maybe there is a way to fix this with
\StubsGeneratorAPI.What?
Here is a generated stubs file:
Additional information
We can see that
FirstInterfacedepends onSecondInterface. It seems to create weird PHPStan errors (see)...Here is the directory tree:
And the finder configuration:
Expected result
I would expect
SecondInterfaceto be defined beforeFirstInterface.Note that this behavior occurs also with concrete classes (in Polylang stubs for instance).
Otherwise thanks for this awesome tool ❤️