22
33namespace hiqdev \php \billing \product ;
44
5+ use Google \Service \TPU ;
6+ use hiqdev \php \billing \product \behavior \BehaviorCollectionInterface ;
57use hiqdev \php \billing \product \behavior \BehaviorTariffTypeCollection ;
68use hiqdev \php \billing \product \behavior \TariffTypeBehaviorRegistry ;
79use hiqdev \php \billing \product \Domain \Model \TariffTypeInterface ;
810use hiqdev \php \billing \product \Exception \ProductNotDefinedException ;
11+ use hiqdev \php \billing \product \price \PriceTypeDefinition ;
912use hiqdev \php \billing \product \price \PriceTypeDefinitionCollection ;
13+ use hiqdev \php \billing \product \price \PriceTypeDefinitionCollectionInterface ;
1014use hiqdev \php \billing \product \price \PriceTypeDefinitionFactory ;
1115use hiqdev \php \billing \product \trait \HasLock ;
1216
1317/**
14- * @implements TariffTypeDefinitionInterface<PriceTypeDefinitionCollection>
18+ * @template TPriceTypeDefinitionCollection of PriceTypeDefinitionCollection
19+ * @implements TariffTypeDefinitionInterface<TPriceTypeDefinitionCollection>
20+ * @psalm-suppress InvalidTemplateParam
1521 */
1622class TariffTypeDefinition implements TariffTypeDefinitionInterface
1723{
@@ -39,7 +45,7 @@ public function belongToTariffType(TariffTypeInterface $tariffType): bool
3945 return $ this ->tariffType ->equals ($ tariffType );
4046 }
4147
42- public function ofProduct (ProductInterface $ product ): TariffTypeDefinitionInterface
48+ public function ofProduct (ProductInterface $ product ): static
4349 {
4450 $ this ->ensureNotLocked ();
4551 $ this ->product = $ product ;
@@ -51,6 +57,7 @@ public function getProduct(): ProductInterface
5157 {
5258 $ this ->ensureProductExists ();
5359
60+ /** @psalm-suppress NullableReturnStatement */
5461 return $ this ->product ;
5562 }
5663
@@ -61,22 +68,32 @@ private function ensureProductExists(): void
6168 }
6269 }
6370
64- public function setPricesSuggester (string $ suggesterClass ): TariffTypeDefinitionInterface
71+ public function setPricesSuggester (string $ suggesterClass ): static
6572 {
6673 $ this ->ensureNotLocked ();
6774
6875 // Validate or store the suggester class
6976 return $ this ;
7077 }
7178
72- public function withPrices (): PriceTypeDefinitionCollection
79+ /**
80+ * @psalm-suppress InvalidReturnType
81+ * @psalm-suppress InvalidReturnStatement
82+ */
83+ public function withPrices ()
7384 {
7485 $ this ->ensureNotLocked ();
7586
7687 return $ this ->prices ;
7788 }
7889
79- public function withBehaviors (): BehaviorTariffTypeCollection
90+ /**
91+ * @return BehaviorCollectionInterface<TariffTypeDefinition>
92+ * @psalm-suppress ImplementedReturnTypeMismatch
93+ * @psalm-suppress InvalidReturnType
94+ * @psalm-suppress InvalidReturnStatement
95+ */
96+ public function withBehaviors ()
8097 {
8198 $ this ->ensureNotLocked ();
8299
0 commit comments