The expression yield new $class() returns the type Generator which is incompatible with the return type mandated by Symfony\Component\HttpKe...face::registerBundles() of Symfony\Component\HttpKe...dleInterface[]|iterable.
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...
19
}
20
}
21
}
22
23
public function getRootDir(): string
24
{
25
return __DIR__;
26
}
27
28
public function getProjectDir(): string
29
{
30
return __DIR__;
31
}
32
33
protected function build(ContainerBuilder $container)
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: