The expression return new ClassNode($this->injector, $set) returns the type anonymous//src/di/ProviderSetProvider.php$0 which is incompatible with the return type mandated by Ray\Di\ProviderInterface::get() of Ray\Di\T.
In the issue above, the returned value is violating the contract defined by the
mentioned interface.
Let's take a look at an example:
interfaceHasName{/** @return string */publicfunctiongetName();}className{public$name;}classUserimplementsHasName{/** @return string|Name */publicfunctiongetName(){returnnewName('foo');// This is a violation of the ``HasName`` interface// which only allows a string value to be returned.}}
Loading history...
52
{
53
/** @var InjectorInterface */
54
private $injector;
55
56
/** @var Set<object> */
57
private $set;
58
59
/**
60
* @param Set<object> $set
61
*/
62
public function __construct(InjectorInterface $injector, Set $set)
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: