Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dab1493

Browse files
authored
bug #12213 Upgrade psalm (Tomanhez)
This PR was merged into the 1.9-dev branch. Discussion ---------- | Q | A | --------------- | ----- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | License | MIT <!-- - Bug fixes must be submitted against the 1.7 or 1.8 branch (the lowest possible) - Features and deprecations must be submitted against the master branch - Make sure that the correct base branch is set To be sure you are not breaking any Backward Compatibilities, check the documentation: https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html --> Commits ------- b0fcc2c Upgrade psalm and add fixes
2 parents 0ca11c2 + b0fcc2c commit dab1493

8 files changed

Lines changed: 9 additions & 6 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"symfony/flex": "^1.7",
147147
"symfony/web-profiler-bundle": "^4.4",
148148
"symplify/package-builder": "^8.0 <8.3",
149-
"vimeo/psalm": "4.1.1"
149+
"vimeo/psalm": "4.3.2"
150150
},
151151
"replace": {
152152
"sylius/addressing": "self.version",

src/Sylius/Bundle/CoreBundle/Fixture/Factory/ChannelExampleFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ protected function configureOptions(OptionsResolver $resolver): void
149149
return $options['code'] . '.localhost';
150150
})
151151
->setDefault('color', function (Options $options): string {
152-
return (string) $this->faker->colorName;
152+
return $this->faker->colorName;
153153
})
154154
->setDefault('enabled', function (Options $options): bool {
155-
return (bool) $this->faker->boolean(90);
155+
return $this->faker->boolean(90);
156156
})
157157
->setAllowedTypes('enabled', 'bool')
158158
->setDefault('skipping_shipping_step_allowed', false)

src/Sylius/Bundle/CoreBundle/Form/Extension/LocaleTypeExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
4444
if ($locale instanceof LocaleInterface && null !== $locale->getCode()) {
4545
$options['disabled'] = true;
4646

47+
/** @psalm-suppress InvalidArrayOffset */
4748
$options['choices'] = [$this->getLocaleName($locale->getCode()) => $locale->getCode()];
4849
} else {
4950
$options['choices'] = array_flip($this->getAvailableLocales());

src/Sylius/Bundle/CoreBundle/Installer/Provider/DatabaseSetupCommandsProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ private function isSchemaPresent(): bool
114114

115115
private function getDatabaseName(): string
116116
{
117-
return (string) $this->getEntityManager()->getConnection()->getDatabase();
117+
return $this->getEntityManager()->getConnection()->getDatabase();
118118
}
119119

120120
private function getSchemaManager(): AbstractSchemaManager

src/Sylius/Component/Core/Customer/Statistics/CustomerStatistics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(array $perChannelStatistics)
3232

3333
public function getAllOrdersCount(): int
3434
{
35-
return (int) array_sum(array_map(function (PerChannelCustomerStatistics $statistics) {
35+
return array_sum(array_map(function (PerChannelCustomerStatistics $statistics) {
3636
return $statistics->getOrdersCount();
3737
}, $this->perChannelsStatistics));
3838
}

src/Sylius/Component/Core/Customer/Statistics/CustomerStatisticsProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function getCustomerStatistics(CustomerInterface $customer): CustomerStat
6464
*/
6565
private function getOrdersSummedTotal(array $orders): int
6666
{
67-
return (int) array_sum(
67+
return array_sum(
6868
array_map(function (OrderInterface $order) {
6969
return $order->getTotal();
7070
}, $orders)

src/Sylius/Component/Taxation/Model/TaxRate.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function setName(?string $name): void
8080
$this->name = $name;
8181
}
8282

83+
/** @psalm-suppress RedundantCastGivenDocblockType */
8384
public function getAmount(): float
8485
{
8586
return (float) $this->amount;

src/Sylius/Component/User/Model/User.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function __construct()
124124
$this->enabled = false;
125125
}
126126

127+
/** @psalm-suppress RedundantCastGivenDocblockType */
127128
public function __toString(): string
128129
{
129130
return (string) $this->getUsername();

0 commit comments

Comments
 (0)