| 1 | <?php |
||
| 2 | |||
| 3 | namespace Loevgaard\DandomainFoundation\Entity; |
||
| 4 | |||
| 5 | use Doctrine\ORM\Mapping as ORM; |
||
| 6 | use Loevgaard\DandomainFoundation\Entity\Generated\ShippingMethodInterface; |
||
|
0 ignored issues
–
show
|
|||
| 7 | use Loevgaard\DandomainFoundation\Entity\Generated\ShippingMethodTrait; |
||
|
0 ignored issues
–
show
The type
Loevgaard\DandomainFound...ted\ShippingMethodTrait was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 8 | use Money\Currency; |
||
|
0 ignored issues
–
show
This use statement conflicts with another class in this namespace,
Loevgaard\DandomainFoundation\Entity\Currency. Consider defining an alias.
Let?s assume that you have a directory layout like this: .
|-- OtherDir
| |-- Bar.php
| `-- Foo.php
`-- SomeDir
`-- Foo.php
and let?s assume the following content of // Bar.php
namespace OtherDir;
use SomeDir\Foo; // This now conflicts the class OtherDir\Foo
If both files PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as // Bar.php
namespace OtherDir;
use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
|
|||
| 9 | use Money\Money; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @ORM\Entity() |
||
| 13 | * @ORM\Table(name="ldf_shipping_methods") |
||
| 14 | */ |
||
| 15 | class ShippingMethod extends AbstractEntity implements ShippingMethodInterface |
||
| 16 | { |
||
| 17 | use ShippingMethodTrait; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var int |
||
| 21 | * |
||
| 22 | * @ORM\Id |
||
| 23 | * @ORM\GeneratedValue |
||
| 24 | * @ORM\Column(type="integer") |
||
| 25 | **/ |
||
| 26 | protected $id; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var int |
||
| 30 | * |
||
| 31 | * @ORM\Column(type="integer", unique=true) |
||
| 32 | */ |
||
| 33 | protected $externalId; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var string|null |
||
| 37 | * |
||
| 38 | * @ORM\Column(nullable=true, type="string", length=3) |
||
| 39 | */ |
||
| 40 | protected $feeCurrency; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @var int|null |
||
| 44 | * |
||
| 45 | * @ORM\Column(nullable=true, type="integer") |
||
| 46 | */ |
||
| 47 | protected $feeAmount; |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @var bool|null |
||
| 51 | * |
||
| 52 | * @ORM\Column(nullable=true, type="boolean") |
||
| 53 | */ |
||
| 54 | protected $feeInclVat; |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @var string|null |
||
| 58 | * |
||
| 59 | * @ORM\Column(nullable=true, type="string", length=191) |
||
| 60 | */ |
||
| 61 | protected $name; |
||
| 62 | |||
| 63 | public function __toString() |
||
| 64 | { |
||
| 65 | return (string) $this->name; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * @return int |
||
| 70 | */ |
||
| 71 | public function getId(): int |
||
| 72 | { |
||
| 73 | return (int) $this->id; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * @param int $id |
||
| 78 | * |
||
| 79 | * @return ShippingMethodInterface |
||
| 80 | */ |
||
| 81 | public function setId($id) |
||
| 82 | { |
||
| 83 | $this->id = $id; |
||
| 84 | |||
| 85 | return $this; |
||
| 86 | } |
||
| 87 | |||
| 88 | /** |
||
| 89 | * @return int |
||
| 90 | */ |
||
| 91 | public function getExternalId(): int |
||
| 92 | { |
||
| 93 | return (int) $this->externalId; |
||
| 94 | } |
||
| 95 | |||
| 96 | /** |
||
| 97 | * @param int $externalId |
||
| 98 | * |
||
| 99 | * @return ShippingMethodInterface |
||
| 100 | */ |
||
| 101 | public function setExternalId($externalId) |
||
| 102 | { |
||
| 103 | $this->externalId = $externalId; |
||
| 104 | |||
| 105 | return $this; |
||
| 106 | } |
||
| 107 | |||
| 108 | /** |
||
| 109 | * @return Money|null |
||
| 110 | */ |
||
| 111 | public function getFee(): ?Money |
||
| 112 | { |
||
| 113 | if (!$this->feeCurrency) { |
||
| 114 | return null; |
||
| 115 | } |
||
| 116 | |||
| 117 | return new Money($this->feeAmount, new Currency($this->feeCurrency)); |
||
| 118 | } |
||
| 119 | |||
| 120 | /** |
||
| 121 | * @param Money $money |
||
| 122 | * |
||
| 123 | * @return ShippingMethodInterface |
||
| 124 | */ |
||
| 125 | public function setFee(Money $money): ShippingMethodInterface |
||
| 126 | { |
||
| 127 | $this->feeAmount = $money->getAmount(); |
||
|
0 ignored issues
–
show
It seems like
$money->getAmount() of type string is incompatible with the declared type integer|null of property $feeAmount.
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...
|
|||
| 128 | $this->feeCurrency = $money->getCurrency()->getCode(); |
||
| 129 | |||
| 130 | return $this; |
||
| 131 | } |
||
| 132 | |||
| 133 | /** |
||
| 134 | * @return bool|null |
||
| 135 | */ |
||
| 136 | public function getFeeInclVat() |
||
| 137 | { |
||
| 138 | return $this->feeInclVat; |
||
| 139 | } |
||
| 140 | |||
| 141 | /** |
||
| 142 | * @param bool|null $feeInclVat |
||
| 143 | * |
||
| 144 | * @return ShippingMethodInterface |
||
| 145 | */ |
||
| 146 | public function setFeeInclVat($feeInclVat) |
||
| 147 | { |
||
| 148 | $this->feeInclVat = $feeInclVat; |
||
| 149 | |||
| 150 | return $this; |
||
| 151 | } |
||
| 152 | |||
| 153 | /** |
||
| 154 | * @return null|string |
||
| 155 | */ |
||
| 156 | public function getName() |
||
| 157 | { |
||
| 158 | return $this->name; |
||
| 159 | } |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @param null|string $name |
||
| 163 | * |
||
| 164 | * @return ShippingMethodInterface |
||
| 165 | */ |
||
| 166 | public function setName($name) |
||
| 167 | { |
||
| 168 | $this->name = $name; |
||
| 169 | |||
| 170 | return $this; |
||
| 171 | } |
||
| 172 | } |
||
| 173 |
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