bearsunday /
BEAR.QueryRepository
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace BEAR\QueryRepository; |
||
| 6 | |||
| 7 | use BEAR\Resource\AbstractUri; |
||
| 8 | use BEAR\Resource\ResourceObject; |
||
| 9 | |||
| 10 | use function array_key_exists; |
||
| 11 | use function array_merge; |
||
| 12 | use function array_unique; |
||
| 13 | use function explode; |
||
| 14 | use function implode; |
||
| 15 | |||
| 16 | final class SurrogateKeys |
||
| 17 | { |
||
| 18 | /** @var list<string> */ |
||
|
0 ignored issues
–
show
|
|||
| 19 | private array $surrogateKeys; |
||
| 20 | private readonly UriTagInterface $uriTag; |
||
| 21 | |||
| 22 | public function __construct(AbstractUri $uri) |
||
| 23 | { |
||
| 24 | $this->uriTag = new UriTag(); |
||
|
0 ignored issues
–
show
|
|||
| 25 | $this->surrogateKeys = [($this->uriTag)($uri)]; |
||
|
0 ignored issues
–
show
It seems like
array($this->uriTag($uri)) of type array is incompatible with the declared type BEAR\QueryRepository\list of property $surrogateKeys.
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.. Loading history...
|
|||
| 26 | } |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Add etag of embedded resource |
||
| 30 | */ |
||
| 31 | public function addTag(ResourceObject $ro): void |
||
| 32 | { |
||
| 33 | $this->surrogateKeys[] = ($this->uriTag)($ro->uri); |
||
| 34 | if (array_key_exists(Header::SURROGATE_KEY, $ro->headers)) { |
||
| 35 | $this->surrogateKeys = array_merge($this->surrogateKeys, explode(' ', $ro->headers[Header::SURROGATE_KEY])); |
||
|
0 ignored issues
–
show
It seems like
array_merge($this->surro...eader::SURROGATE_KEY])) of type array is incompatible with the declared type BEAR\QueryRepository\list of property $surrogateKeys.
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.. Loading history...
|
|||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | public function setSurrogateHeader(ResourceObject $ro): void |
||
| 40 | { |
||
| 41 | $key = implode(' ', array_unique($this->surrogateKeys)); |
||
| 42 | $wasSetManually = isset($ro->headers[Header::SURROGATE_KEY]); |
||
| 43 | if ($wasSetManually) { |
||
| 44 | $ro->headers[Header::SURROGATE_KEY] .= ' ' . $key; |
||
| 45 | |||
| 46 | return; |
||
| 47 | } |
||
| 48 | |||
| 49 | $ro->headers[Header::SURROGATE_KEY] = $key; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths