inspirum /
balikobot-php
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Inspirum\Balikobot\Model\OrderedShipment; |
||
| 6 | |||
| 7 | use Inspirum\Arrayable\BaseModel; |
||
| 8 | |||
| 9 | /** |
||
| 10 | * @extends \Inspirum\Arrayable\BaseModel<string,mixed> |
||
| 11 | */ |
||
| 12 | final class DefaultOrderedShipment extends BaseModel implements OrderedShipment |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @param list<string> $packageIds |
||
|
0 ignored issues
–
show
|
|||
| 16 | */ |
||
| 17 | 4 | public function __construct( |
|
| 18 | private readonly string $orderId, |
||
| 19 | private readonly string $carrier, |
||
| 20 | private readonly array $packageIds, |
||
| 21 | private readonly string $handoverUrl, |
||
| 22 | private readonly string $labelsUrl, |
||
| 23 | private readonly ?string $fileUrl = null, |
||
| 24 | ) { |
||
| 25 | 4 | } |
|
| 26 | |||
| 27 | 3 | public function getOrderId(): string |
|
| 28 | { |
||
| 29 | 3 | return $this->orderId; |
|
| 30 | } |
||
| 31 | |||
| 32 | 3 | public function getCarrier(): string |
|
| 33 | { |
||
| 34 | 3 | return $this->carrier; |
|
| 35 | } |
||
| 36 | |||
| 37 | /** @inheritDoc */ |
||
| 38 | 1 | public function getPackageIds(): array |
|
| 39 | { |
||
| 40 | 1 | return $this->packageIds; |
|
| 41 | } |
||
| 42 | |||
| 43 | 1 | public function getHandoverUrl(): string |
|
| 44 | { |
||
| 45 | 1 | return $this->handoverUrl; |
|
| 46 | } |
||
| 47 | |||
| 48 | 1 | public function getLabelsUrl(): string |
|
| 49 | { |
||
| 50 | 1 | return $this->labelsUrl; |
|
| 51 | } |
||
| 52 | |||
| 53 | 1 | public function getFileUrl(): ?string |
|
| 54 | { |
||
| 55 | 1 | return $this->fileUrl; |
|
| 56 | } |
||
| 57 | |||
| 58 | /** @inheritDoc */ |
||
| 59 | 1 | public function __toArray(): array |
|
| 60 | { |
||
| 61 | 1 | return [ |
|
|
0 ignored issues
–
show
The expression
return array('carrier' =...Url' => $this->fileUrl) returns the type array<string,array|null|string> which is incompatible with the return type mandated by Inspirum\Arrayable\BaseModel::__toArray() of Inspirum\Arrayable\TValue[].
In the issue above, the returned value is violating the contract defined by the mentioned interface. Let's take a look at an example: interface HasName {
/** @return string */
public function getName();
}
class Name {
public $name;
}
class User implements HasName {
/** @return string|Name */
public function getName() {
return new Name('foo'); // This is a violation of the ``HasName`` interface
// which only allows a string value to be returned.
}
}
Loading history...
|
|||
| 62 | 1 | 'carrier' => $this->carrier, |
|
| 63 | 1 | 'orderId' => $this->orderId, |
|
| 64 | 1 | 'packageIds' => $this->packageIds, |
|
| 65 | 1 | 'handoverUrl' => $this->handoverUrl, |
|
| 66 | 1 | 'labelsUrl' => $this->labelsUrl, |
|
| 67 | 1 | 'fileUrl' => $this->fileUrl, |
|
| 68 | 1 | ]; |
|
| 69 | } |
||
| 70 | } |
||
| 71 |
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