It seems like $config->makeRoute('vault')->withCore('vault') of type object<Spiral\Http\Routing\Traits\CoreTrait> or object<Spiral\Http\Routing\RouteInterface> is incompatible with the declared type object<Spiral\Vault\VaultRoute> of property $route.
Our type inference engine has found an assignment to a property that is incompatible
with the declared type of that property.
Either this assignment is in error or the assigned type should be added
to the documentation/type hint for that property..
It seems like $this->route can also be of type object<Spiral\Http\Routing\Traits\CoreTrait>; however, Spiral\Http\Traits\RouterTrait::addRoute() does only seem to accept object<Spiral\Http\Routing\RouteInterface>, maybe add an additional type check?
If a method or function can return multiple different values and unless you are
sure that you only can receive a single value in this context, we recommend
to add an additional type check:
/** * @return array|string */functionreturnsDifferentValues($x){if($x){return'foo';}returnarray();}$x=returnsDifferentValues($y);if(is_array($x)){// $x is an array.}
If this a common case that PHP Analyzer should handle natively, please let us
know by opening an issue.
Loading history...
46
}
47
48
/**
49
* @param VaultConfig $config
50
* @param ContainerInterface $container
51
*
52
* @return Vault
53
*/
54
protected function makeVault(VaultConfig $config, ContainerInterface $container): Vault
55
{
56
return new Vault($config, $this->route, $container);
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..