Skip to content

Commit 9869b34

Browse files
committed
Update linting
1 parent 42a450a commit 9869b34

File tree

5 files changed

+47
-4
lines changed

5 files changed

+47
-4
lines changed

.github/workflows/run-linting.yml

+1
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,4 @@ jobs:
4040
- name: Execute linting
4141
run: |
4242
vendor/bin/php-cs-fixer fix --dry-run
43+
vendor/bin/phpcs --colors --report-full

.php-cs-fixer.php

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use AdamWojs\PhpCsFixerPhpdocForceFQCN\Fixer\Phpdoc\ForceFQCNFixer;
34
use PhpCsFixer\Config;
45
use PhpCsFixer\Finder;
56

@@ -177,6 +178,8 @@
177178
'unary_operator_spaces' => true,
178179
// In array declaration, there MUST be a whitespace after each comma.
179180
'whitespace_after_comma_in_array' => true,
181+
// Force Fully-Qualified Class Name in docblocks
182+
'AdamWojs/phpdoc_force_fqcn_fixer' => true,
180183
];
181184

182185
$finder = Finder::create()
@@ -191,5 +194,8 @@
191194
->ignoreVCS(true);
192195

193196
return (new Config())
197+
->registerCustomFixers([
198+
new ForceFQCNFixer(),
199+
])
194200
->setRules($rules)
195201
->setFinder($finder);

composer.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@
3434
"illuminate/support": "^7.0|^8.0|^9.0"
3535
},
3636
"require-dev": {
37+
"adamwojs/php-cs-fixer-phpdoc-force-fqcn": "^2.0",
3738
"friendsofphp/php-cs-fixer": "^3.0",
3839
"orchestra/testbench": "^5.0|^6.0|^7.0",
39-
"phpunit/phpunit": "^9.1"
40+
"phpunit/phpunit": "^9.1",
41+
"squizlabs/php_codesniffer": "^3.6"
4042
},
4143
"autoload": {
4244
"psr-4": {
@@ -51,8 +53,8 @@
5153
"scripts": {
5254
"test": "vendor/bin/phpunit",
5355
"test-coverage": "vendor/bin/phpunit --coverage-html coverage",
54-
"lint": "vendor/bin/php-cs-fixer fix",
55-
"lint-dry": "vendor/bin/php-cs-fixer fix --dry-run"
56+
"lint": "vendor/bin/php-cs-fixer fix && vendor/bin/phpcs --colors --report-full",
57+
"lint-dry": "vendor/bin/php-cs-fixer fix --dry-run && vendor/bin/phpcs --colors --report-full"
5658
},
5759
"config": {
5860
"sort-packages": true

phpcs.xml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="PSR2">
3+
<description>The PSR2 coding standard.</description>
4+
5+
<rule ref="PSR2"/>
6+
7+
<rule ref="PSR1.Methods.CamelCapsMethodName">
8+
<exclude-pattern>*/**/tests</exclude-pattern>
9+
</rule>
10+
11+
<rule ref="Generic.Files.LineLength.TooLong">
12+
<exclude-pattern>*/**/tests</exclude-pattern>
13+
<exclude-pattern>*/**/src/Console/InstallCommand.php</exclude-pattern>
14+
<exclude-pattern>*/**/src/*ServiceProvider.php</exclude-pattern>
15+
</rule>
16+
17+
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
18+
<exclude-pattern>*/**/tests</exclude-pattern>
19+
</rule>
20+
21+
<rule ref="Generic.PHP.ForbiddenFunctions">
22+
<properties>
23+
<property name="forbiddenFunctions" type="array" value="dd=>NULL,var_dump=>NULL,dump=>NULL"/>
24+
</properties>
25+
</rule>
26+
27+
<file>src/</file>
28+
<file>tests/</file>
29+
30+
<exclude-pattern>vendor/</exclude-pattern>
31+
<exclude-pattern>node_modules/</exclude-pattern>
32+
</ruleset>

src/VerificationCodeManager.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ protected function getNotificationClass()
115115
$notificationClass = config('verification-code.notification', VerificationCodeCreated::class);
116116

117117
if (! is_subclass_of($notificationClass, VerificationCodeCreatedInterface::class)) {
118-
throw new RuntimeException('The notification class must implement the `\NextApps\VerificationCode\Notifications\VerificationCodeCreatedInterface` interface');
118+
$interface = VerificationCodeCreatedInterface::class;
119+
120+
throw new RuntimeException('The notification class must implement the `{$interface}` interface');
119121
}
120122

121123
return $notificationClass;

0 commit comments

Comments
 (0)