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...
54
}
55
56
/**
57
* @param VaultConfig $config
58
* @param CoreInterface $core
59
*
60
* @return Vault
61
*/
62
protected function makeVault(VaultConfig $config, CoreInterface $core): Vault
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..