Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 3 additions & 33 deletions Build/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,6 @@ parameters:
count: 1
path: ../Classes/Configuration/Loader/TypoScript/SpecialOptionsLoader.php

-
message: '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\.$#'
identifier: foreach.nonIterable
count: 1
path: ../Classes/Configuration/Loader/TypoScript/TaxClassLoader.php

-
message: '#^Parameter \#1 \$taxClassKey of method Extcode\\Cart\\Domain\\Model\\Cart\\TaxClassFactoryInterface\:\:getTaxClass\(\) expects int, mixed given\.$#'
identifier: argument.type
count: 1
path: ../Classes/Configuration/Loader/TypoScript/TaxClassLoader.php

-
message: '#^Parameter \#2 \$array of function array_key_exists expects array, mixed given\.$#'
identifier: argument.type
Expand All @@ -150,12 +138,6 @@ parameters:
count: 1
path: ../Classes/Configuration/Loader/TypoScript/TaxClassLoader.php

-
message: '#^Possibly invalid array key type mixed\.$#'
identifier: offsetAccess.invalidOffset
count: 1
path: ../Classes/Configuration/Loader/TypoScript/TaxClassLoader.php

-
message: '#^Property Extcode\\Cart\\Configuration\\Loader\\TypoScript\\TaxClassLoader\:\:\$settings type has no value type specified in iterable type array\.$#'
identifier: missingType.iterableValue
Expand Down Expand Up @@ -397,7 +379,7 @@ parameters:
path: ../Classes/Controller/Backend/Order/OrderController.php

-
message: '#^Parameter \#1 \$queryResult of class TYPO3\\CMS\\Extbase\\Pagination\\QueryResultPaginator constructor expects TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface, array\|TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface given\.$#'
message: '#^Parameter \#1 \$queryResult of class TYPO3\\CMS\\Extbase\\Pagination\\QueryResultPaginator constructor expects TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface, array\|TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface\<int, TYPO3\\CMS\\Extbase\\DomainObject\\DomainObjectInterface\> given\.$#'
identifier: argument.type
count: 1
path: ../Classes/Controller/Backend/Order/OrderController.php
Expand Down Expand Up @@ -2395,17 +2377,11 @@ parameters:
path: ../Classes/Domain/Repository/Order/ItemRepository.php

-
message: '#^Method Extcode\\Cart\\Domain\\Repository\\Order\\ItemRepository\:\:findAll\(\) return type has no value type specified in iterable type array\|TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface\.$#'
message: '#^Method Extcode\\Cart\\Domain\\Repository\\Order\\ItemRepository\:\:findAll\(\) return type has no value type specified in iterable type array\|TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface\<int, TYPO3\\CMS\\Extbase\\DomainObject\\DomainObjectInterface\>\.$#'
identifier: missingType.iterableValue
count: 1
path: ../Classes/Domain/Repository/Order/ItemRepository.php

-
message: '#^Method Extcode\\Cart\\Domain\\Repository\\Order\\ItemRepository\:\:findAll\(\) return type with generic interface TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface does not specify its types\: TKey, TValue$#'
identifier: missingType.generics
count: 1
path: ../Classes/Domain/Repository/Order/ItemRepository.php

-
message: '#^Method Extcode\\Cart\\Domain\\Repository\\Order\\ItemRepository\:\:getFilterConstraints\(\) has parameter \$query with generic interface TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface but does not specify its types\: T$#'
identifier: missingType.generics
Expand Down Expand Up @@ -2491,17 +2467,11 @@ parameters:
path: ../Classes/Domain/Repository/Order/ProductRepository.php

-
message: '#^Method Extcode\\Cart\\Domain\\Repository\\Order\\ProductRepository\:\:findAll\(\) return type has no value type specified in iterable type array\|TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface\.$#'
message: '#^Method Extcode\\Cart\\Domain\\Repository\\Order\\ProductRepository\:\:findAll\(\) return type has no value type specified in iterable type array\|TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface\<int, TYPO3\\CMS\\Extbase\\DomainObject\\DomainObjectInterface\>\.$#'
identifier: missingType.iterableValue
count: 1
path: ../Classes/Domain/Repository/Order/ProductRepository.php

-
message: '#^Method Extcode\\Cart\\Domain\\Repository\\Order\\ProductRepository\:\:findAll\(\) return type with generic interface TYPO3\\CMS\\Extbase\\Persistence\\QueryResultInterface does not specify its types\: TKey, TValue$#'
identifier: missingType.generics
count: 1
path: ../Classes/Domain/Repository/Order/ProductRepository.php

-
message: '#^Method Extcode\\Cart\\Domain\\Repository\\Order\\ProductRepository\:\:getFilterConstraints\(\) has parameter \$query with generic interface TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface but does not specify its types\: T$#'
identifier: missingType.generics
Expand Down
31 changes: 28 additions & 3 deletions Classes/Event/Document/GenerateDocumentEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,36 @@
* LICENSE file that was distributed with this source code.
*/

use Extcode\Cart\Domain\Model\Order\Item;
use Extcode\Cart\Domain\Model\Order\Item as OrderItem;
use Psr\EventDispatcher\StoppableEventInterface;

final readonly class GenerateDocumentEvent
final class GenerateDocumentEvent implements StoppableEventInterface
{
public function __construct(public Item $orderItem, public string $pdfType)
private bool $isPropagationStopped = false;

public function __construct(
private readonly OrderItem $orderItem,
private readonly string $type
) {
}

public function getOrderItem(): OrderItem
{
return $this->orderItem;
}

public function getType(): string
{
return $this->type;
}

public function setPropagationStopped(bool $isPropagationStopped): void
{
$this->isPropagationStopped = $isPropagationStopped;
}

public function isPropagationStopped(): bool
{
return $this->isPropagationStopped;
}
}
5 changes: 3 additions & 2 deletions Tests/Functional/Command/OrderItemCleanupCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,9 @@ public function doesNotDeletesNotRelatedRecordsCreatedBeforeCutOffDate(): void
#[Test]
public function noCutOffDateTerminatesTheCommandWithErrorMessage(): void
{
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments (missing: "cutOffDate").');
$this->expectExceptionObject(
new RuntimeException('Not enough arguments (missing: "cutOffDate").')
);

$commandTester = new CommandTester($this->get(OrderItemCleanupCommand::class));
$commandTester->execute([]);
Expand Down
26 changes: 10 additions & 16 deletions Tests/Unit/Domain/Model/Cart/CartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,11 @@ public function resetDifferentOrderNumberThrowsException(): void
{
$this->grossCart->setOrderNumber('ValidOrderNumber');

$this->expectException(
LogicException::class
);
$this->expectExceptionMessage(
'You can not redeclare the order number of your cart.'
);
$this->expectExceptionCode(
1413969668
$this->expectExceptionObject(
new LogicException(
'You can not redeclare the order number of your cart.',
1413969668
)
);

$this->grossCart->setOrderNumber('NotValidOrderNumber');
Expand Down Expand Up @@ -321,14 +318,11 @@ public function resetDifferentInvoiceNumberThrowsException(): void
{
$this->grossCart->setInvoiceNumber('ValidInvoiceNumber');

$this->expectException(
LogicException::class
);
$this->expectExceptionMessage(
'You can not redeclare the invoice number of your cart.',
);
$this->expectExceptionCode(
1413969712
$this->expectExceptionObject(
new LogicException(
'You can not redeclare the invoice number of your cart.',
1413969712
)
);

$this->grossCart->setInvoiceNumber('NotValidInvoiceNumber');
Expand Down
Loading