Skip to content

Commit 32583d5

Browse files
author
Stephan Wentz
committed
fix: Upgrade brainbits coding standard, fix code style issues
1 parent 19ff4b2 commit 32583d5

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"phpstan/phpstan": "^1.0"
2424
},
2525
"require-dev": {
26-
"brainbits/phpcs-standard": "^4.0",
26+
"brainbits/phpcs-standard": "^7.0",
2727
"php-coveralls/php-coveralls": "^2.0",
2828
"phpstan/phpstan-php-parser": "^1.0",
2929
"phpstan/phpstan-phpunit": "^1.0",

src/CoversClassExistsRule.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,14 @@
2222
use function sha1;
2323
use function sprintf;
2424

25-
// phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
26-
27-
/**
28-
* @implements Rule<Class_>
29-
*/
25+
/** @implements Rule<Class_> */
3026
final class CoversClassExistsRule implements Rule
3127
{
32-
/** @var Broker */
33-
private $broker;
3428
/** @var bool[] */
35-
private $alreadyParsedDocComments = [];
29+
private array $alreadyParsedDocComments = [];
3630

37-
public function __construct(Broker $broker)
31+
public function __construct(private Broker $broker)
3832
{
39-
$this->broker = $broker;
4033
}
4134

4235
public function getNodeType(): string
@@ -57,9 +50,7 @@ public function processNode(Node $node, Scope $scope): array
5750
return array_merge($messagesAttribute, $messagesAnnotation);
5851
}
5952

60-
/**
61-
* @return RuleError[] errors
62-
*/
53+
/** @return RuleError[] errors */
6354
public function processNodeAttribute(Class_ $node, Scope $scope): array
6455
{
6556
$messages = [];
@@ -108,9 +99,7 @@ public function processNodeAttribute(Class_ $node, Scope $scope): array
10899
return $messages;
109100
}
110101

111-
/**
112-
* @return RuleError[] errors
113-
*/
102+
/** @return RuleError[] errors */
114103
public function processNodeAnnotation(Class_ $node, Scope $scope): array
115104
{
116105
$messages = [];
@@ -124,7 +113,7 @@ public function processNodeAnnotation(Class_ $node, Scope $scope): array
124113
$scope->getFile(),
125114
$docComment->getStartLine(),
126115
$docComment->getStartFilePos(),
127-
$docComment->getText()
116+
$docComment->getText(),
128117
));
129118
if (isset($this->alreadyParsedDocComments[$hash])) {
130119
return $messages;

src/CoversClassPresentRule.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121

2222
// phpcs:disable SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint
2323

24-
/**
25-
* @implements Rule<Class_>
26-
*/
24+
/** @implements Rule<Class_> */
2725
final class CoversClassPresentRule implements Rule
2826
{
2927
private const TEST_CLASS_ENDING_STRING = 'Test';
@@ -110,9 +108,7 @@ public function processNodeAttribute(Class_ $node, Scope $scope): bool
110108
return false;
111109
}
112110

113-
/**
114-
* @return array<string>
115-
*/
111+
/** @return array<string> */
116112
private function getAnnotationLines(Node $node, Scope $scope): array
117113
{
118114
$docComment = $node->getDocComment();
@@ -126,8 +122,8 @@ private function getAnnotationLines(Node $node, Scope $scope): array
126122
$scope->getFile(),
127123
$docComment->getStartLine(),
128124
$docComment->getStartFilePos(),
129-
$docComment->getText()
130-
)
125+
$docComment->getText(),
126+
),
131127
);
132128

133129
if (array_key_exists($hash, $this->alreadyParsedDocComments)) {

0 commit comments

Comments
 (0)