Skip to content

Commit df79c70

Browse files
authored
Merge pull request #696 from patchlevel/replace-phinal-with-phpat
Replace psalm plugin "phinal" with phpstan extension "phpat"
2 parents 5ca0c53 + dd85d28 commit df79c70

File tree

7 files changed

+92
-66
lines changed

7 files changed

+92
-66
lines changed

baseline.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@
2424
<code><![CDATA[$service::{$handler->method}(...)]]></code>
2525
</MixedMethodCall>
2626
</file>
27-
<file src="src/Console/DoctrineHelper.php">
28-
<ClassNotFinal>
29-
<code><![CDATA[class DoctrineHelper]]></code>
30-
</ClassNotFinal>
31-
</file>
3227
<file src="src/Cryptography/DoctrineCipherKeyStore.php">
3328
<ArgumentTypeCoercion>
3429
<code><![CDATA[base64_decode($result['crypto_iv'])]]></code>

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
},
3838
"require-dev": {
3939
"ext-pdo_sqlite": "~8.2.0 || ~8.3.0 || ~8.4.0",
40-
"cspray/phinal": "dev-main#9826c3407056a4618f8bba303800403e47ccb3a7",
4140
"doctrine/orm": "^2.18.0 || ^3.0.0",
4241
"infection/infection": "^0.29.12",
4342
"jangregor/phpstan-prophecy": "^2.0",
4443
"league/commonmark": "^2.6.1",
4544
"patchlevel/coding-standard": "^1.3.0",
4645
"patchlevel/event-sourcing-psalm-plugin": "^3.1.0",
46+
"phpat/phpat": "^0.11.3",
4747
"phpbench/phpbench": "^1.4.1",
4848
"phpspec/prophecy-phpunit": "^2.3.0",
4949
"phpstan/phpstan": "^2.1.11",

composer.lock

Lines changed: 58 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ includes:
22
- phpstan-baseline.neon
33
- vendor/phpstan/phpstan-phpunit/extension.neon
44
- vendor/jangregor/phpstan-prophecy/extension.neon
5+
- vendor/phpat/phpat/extension.neon
56

67
parameters:
78
level: max
@@ -13,3 +14,8 @@ parameters:
1314
identifier: missingType.generics
1415
reportUnmatchedIgnoredErrors: false
1516

17+
services:
18+
-
19+
class: Patchlevel\EventSourcing\Tests\Architecture\FinalClassesTest
20+
tags:
21+
- phpat.test

psalm.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@
1818

1919
<plugins>
2020
<pluginClass class="Patchlevel\EventSourcingPsalmPlugin\Plugin"/>
21-
<pluginClass class="Cspray\Phinal\Plugin"/>
2221
</plugins>
2322
</psalm>

src/Attribute/Subscriber.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
namespace Patchlevel\EventSourcing\Attribute;
66

77
use Attribute;
8-
use Cspray\Phinal\AllowInheritance;
98
use Patchlevel\EventSourcing\Subscription\RunMode;
109

1110
#[Attribute(Attribute::TARGET_CLASS)]
12-
#[AllowInheritance('You can create specific attributes with default group and run mode')]
1311
class Subscriber
1412
{
1513
public function __construct(
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Patchlevel\EventSourcing\Tests\Architecture;
6+
7+
use Patchlevel\EventSourcing\Attribute\Subscriber;
8+
use PHPat\Selector\Selector;
9+
use PHPat\Test\Builder\Rule;
10+
use PHPat\Test\PHPat;
11+
12+
final class FinalClassesTest
13+
{
14+
public function testFinalClasses(): Rule
15+
{
16+
return PHPat::rule()
17+
->classes(
18+
Selector::AllOf(
19+
Selector::inNamespace('Patchlevel\EventSourcing'),
20+
Selector::NOT(Selector::isAbstract()),
21+
Selector::NOT(Selector::isInterface()),
22+
Selector::NOT(Selector::classname(Subscriber::class)),
23+
),
24+
)
25+
->shouldBeFinal();
26+
}
27+
}

0 commit comments

Comments
 (0)