Skip to content

Commit 6486f54

Browse files
authored
fix: phpstan deprecation (#580)
1 parent a348b51 commit 6486f54

31 files changed

Lines changed: 54 additions & 50 deletions

phpstan.neon.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ parameters:
8888
identifier: method.deprecated
8989
message: '#__construct.*Shopware\\Core\\Framework\\DataAbstractionLayer\\EntityDefinition.*#'
9090

91+
- # 6.8 deprecation
92+
identifier: method.deprecated
93+
message: '#arameter \$silent will be added in v6\.8\.0.*#'
94+
9195
- # 6.8 deprecation - only type change
9296
identifier: method.deprecated
9397
message: '#(setActiveBillingAddress|setActiveShippingAddress).*Shopware\\Core\\Checkout\\Customer\\CustomerEntity.*#'

src/Checkout/Order/Shipping/MessageQueue/ShippingInformationMessageHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private function handleInvalidCarrierException(PayPalApiException $e, Tracker &$
150150
private function trimTrackers(array $trackers): array
151151
{
152152
return \array_filter(\array_map(
153-
fn (string $tracker) => \mb_substr($tracker, 0, Tracker::MAX_LENGTH_TRACKING_NUMBER),
153+
static fn (string $tracker) => \mb_substr($tracker, 0, Tracker::MAX_LENGTH_TRACKING_NUMBER),
154154
$trackers
155155
));
156156
}

src/Checkout/PUI/Service/PUICustomerDataService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private function getBirthday(DataBag $dataBag): ?\DateTimeInterface
6666
{
6767
$birthdayArray = $dataBag->get(self::PUI_CUSTOMER_DATA_BIRTHDAY);
6868

69-
if (!($birthdayArray instanceof DataBag)) {
69+
if (!$birthdayArray instanceof DataBag) {
7070
return null;
7171
}
7272

src/Checkout/Payment/Service/VaultTokenService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function getAvailableToken(PaymentTransactionStruct $struct, OrderTransac
6868
if ($subscriptions = $this->getSubscriptions($struct)) {
6969
$customFieldKey = $this->getSubscriptionCustomFieldKey($orderTransaction->getPaymentMethodId());
7070
$tokenIds = \array_unique(\array_values(
71-
$subscriptions->fmap(fn (SubscriptionEntity $subscription): string => (string) $subscription->getCustomFieldsValue($customFieldKey))
71+
$subscriptions->fmap(static fn (SubscriptionEntity $subscription): string => (string) $subscription->getCustomFieldsValue($customFieldKey))
7272
));
7373

7474
if (\count($tokenIds) > 1) {

src/DevOps/Command/LocaleScraperCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
3636
$crawler = new Crawler($html);
3737
$locales = [];
3838

39-
$crawler->filter('table tbody tr')->each(function (Crawler $row) use (&$locales): void {
39+
$crawler->filter('table tbody tr')->each(static function (Crawler $row) use (&$locales): void {
4040
$columns = $row->filter('td');
4141
if ($columns->count() < 3) {
4242
return;

src/Pos/Sync/Context/InventoryContextFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function updateLocal(InventoryContext $inventoryContext): void
9898
$criteria->addFilter(new EqualsAnyFilter('productId', $productIds));
9999
}
100100
$inventory = $this->inventoryRepository->search($criteria, $inventoryContext->getContext())->getEntities();
101-
if (!($inventory instanceof PosSalesChannelInventoryCollection)) {
101+
if (!$inventory instanceof PosSalesChannelInventoryCollection) {
102102
throw new EntityRepositoryNotFoundException('swag_paypal_pos_sales_channel_inventory');
103103
}
104104

src/Pos/Sync/Context/ProductContextFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ public function getContext(SalesChannelEntity $salesChannel, Context $context, ?
4242
$posProductCollection = $this->getPosProductCollection(
4343
$salesChannel->getId(),
4444
$context,
45-
$productCollection !== null ? $productCollection->fmap(function (ProductEntity $product) {
45+
$productCollection !== null ? $productCollection->fmap(static function (ProductEntity $product) {
4646
return $product->getId();
4747
}) : null
4848
);
4949

5050
$posMediaCollection = $this->getPosMediaCollection(
5151
$salesChannel->getId(),
5252
$context,
53-
$productCollection !== null ? $productCollection->fmap(function (ProductEntity $product) {
53+
$productCollection !== null ? $productCollection->fmap(static function (ProductEntity $product) {
5454
$cover = $product->getCover();
5555

5656
return $cover !== null ? $cover->getMediaId() : null;

src/Pos/Sync/Product/Util/ProductGroupingCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ProductGroupingCollection extends Collection
2121
public function addProducts(ProductCollection $products): void
2222
{
2323
foreach ($products as $product) {
24-
if (!($product instanceof SalesChannelProductEntity)) {
24+
if (!$product instanceof SalesChannelProductEntity) {
2525
continue;
2626
}
2727

src/Util/Lifecycle/Method/PaymentMethodDataRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function getEntityFromData(AbstractMethodData $method, Context $context):
9393
public function getPaymentHandlers(): array
9494
{
9595
return \array_map(
96-
fn (AbstractMethodData $method) => $method->getHandler(),
96+
static fn (AbstractMethodData $method) => $method->getHandler(),
9797
$this->getPaymentMethods()
9898
);
9999
}

src/Util/Lifecycle/State/PosStateService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function checkPosSalesChannels(Context $context): void
9999
$result = $this->salesChannelRepository->search($criteria, $context);
100100

101101
if ($result->getTotal() > 0) {
102-
$names = $result->getEntities()->map(function (SalesChannelEntity $item): string {
102+
$names = $result->getEntities()->map(static function (SalesChannelEntity $item): string {
103103
return (string) $item->getName();
104104
});
105105

0 commit comments

Comments
 (0)