Skip to content

Commit 11052a4

Browse files
committed
Restore Psalm
1 parent c4103c6 commit 11052a4

10 files changed

Lines changed: 61 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ jobs:
137137
- name: Run PHPStan
138138
run: vendor/bin/phpstan analyse
139139

140+
- name: Run Psalm
141+
run: vendor/bin/psalm
142+
140143
- name: Run PHPSpec
141144
run: vendor/bin/phpspec run --ansi -f progress --no-interaction
142145

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"symfony/dotenv": "^6.4 || ^7.3",
6868
"symfony/flex": "^2.2.2",
6969
"symfony/intl": "^6.4 || ^7.3",
70-
"symfony/web-profiler-bundle": "^6.4 || ^7.3"
70+
"symfony/web-profiler-bundle": "^6.4 || ^7.3",
71+
"vimeo/psalm": "^6.13"
7172
},
7273
"conflict": {
7374
"symfony/framework-bundle": "6.2.8"

psalm.xml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0"?>
2+
<psalm
3+
errorLevel="1"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns="https://getpsalm.org/schema/config"
6+
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
7+
>
8+
<projectFiles>
9+
<directory name="src" />
10+
<ignoreFiles>
11+
<directory name="vendor" />
12+
</ignoreFiles>
13+
</projectFiles>
14+
15+
<issueHandlers>
16+
<MissingOverrideAttribute>
17+
<errorLevel type="suppress">
18+
<directory name="src"/>
19+
<directory name="src"/>
20+
</errorLevel>
21+
</MissingOverrideAttribute>
22+
<PossiblyUnusedMethod>
23+
<errorLevel type="suppress">
24+
<directory name="src"/>
25+
</errorLevel>
26+
</PossiblyUnusedMethod>
27+
<UnusedClass>
28+
<errorLevel type="suppress">
29+
<directory name="src"/>
30+
</errorLevel>
31+
</UnusedClass>
32+
<PossiblyUnusedProperty>
33+
<errorLevel type="suppress">
34+
<file name="src/Twig/Component/AddNotificationComponent.php"/>
35+
</errorLevel>
36+
</PossiblyUnusedProperty>
37+
</issueHandlers>
38+
</psalm>

src/Command/AlertCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ private function sendEmail(
7878
ProductVariantInterface $productVariant,
7979
ChannelInterface $channel,
8080
): void {
81+
/** @psalm-suppress DeprecatedMethod */
8182
$this->sender->send(
8283
'webgriffe_back_in_stock_notification_alert',
8384
[$subscription->getEmail()],

src/Controller/SubscriptionController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Symfony\Contracts\Translation\TranslatorInterface;
1111
use Webgriffe\SyliusBackInStockNotificationPlugin\Repository\SubscriptionRepositoryInterface;
1212

13+
/**
14+
* @psalm-suppress PropertyNotSetInConstructor
15+
*/
1316
final class SubscriptionController extends AbstractController
1417
{
1518
public function __construct(

src/Entity/Subscription.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Sylius\Component\Customer\Model\CustomerInterface;
1010
use Sylius\Component\Resource\Model\TimestampableTrait;
1111

12+
/**
13+
* @psalm-suppress ClassMustBeFinal
14+
*/
1215
class Subscription implements SubscriptionInterface
1316
{
1417
use TimestampableTrait;

src/Factory/SubscriptionFactory.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
final readonly class SubscriptionFactory implements SubscriptionFactoryInterface
1414
{
15+
/**
16+
* @param class-string $className
17+
*/
1518
public function __construct(private string $className)
1619
{
1720
}
@@ -28,6 +31,7 @@ public function createWithData(
2831
string $localeCode,
2932
?CustomerInterface $customer = null,
3033
): SubscriptionInterface {
34+
/** @psalm-suppress MixedMethodCall */
3135
$subscription = new $this->className();
3236
Assert::isInstanceOf($subscription, SubscriptionInterface::class);
3337

src/Factory/SubscriptionFactoryInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Sylius\Resource\Factory\FactoryInterface;
1111
use Webgriffe\SyliusBackInStockNotificationPlugin\Entity\SubscriptionInterface;
1212

13+
/**
14+
* @extends FactoryInterface<SubscriptionInterface>
15+
*/
1316
interface SubscriptionFactoryInterface extends FactoryInterface
1417
{
1518
public function createWithData(

src/Processor/SubscriptionProcessor.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public function process(
4141
);
4242

4343
$this->backInStockNotificationRepository->add($subscription);
44+
/** @psalm-suppress DeprecatedMethod */
4445
$this->sender->send(
4546
'webgriffe_back_in_stock_notification_success_subscription',
4647
[$subscription->getEmail()],

src/Processor/SubscriptionProcessorInterface.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010

1111
interface SubscriptionProcessorInterface
1212
{
13+
/**
14+
* @psalm-suppress PossiblyUnusedReturnValue
15+
*/
1316
public function process(ProductVariantInterface $productVariant, string $email, ?CustomerInterface $customer = null): SubscriptionInterface;
1417
}

0 commit comments

Comments
 (0)