Skip to content

Commit 442df2a

Browse files
Merge pull request #20 from DaveLiddament/bump/versions
BUMP Versions and add error identifiers
2 parents 8c7e672 + be5bb28 commit 442df2a

10 files changed

Lines changed: 30 additions & 33 deletions

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'phpdoc_align' => false,
2424
'phpdoc_to_comment' => false,
2525
'native_function_invocation' => false,
26+
'nullable_type_declaration_for_default_null_value' => true,
2627
]
2728
)
2829
->setFinder($finder)

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
{
22
"name": "dave-liddament/phpstan-php-language-extensions",
33
"description": "PHPStan rules to implement the language extensions provided by the php-language-extensions",
4-
"keywords": ["static analysis", "phpstan", "package attribute", "friend attribute"],
4+
"keywords": ["static analysis", "phpstan", "namespace visibility attribute", "friend attribute"],
55
"type": "phpstan-extension",
66
"require": {
77
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0",
8-
"phpstan/phpstan": "^1.10.34",
9-
"dave-liddament/php-language-extensions": "^0.5.0 || ^0.6.0"
8+
"phpstan/phpstan": "^1.11",
9+
"dave-liddament/php-language-extensions": "^0.7.0"
1010
},
1111
"require-dev": {
1212
"phpunit/phpunit": "^9.6.12",
1313
"friendsofphp/php-cs-fixer": "^3.26.1",
1414
"php-parallel-lint/php-parallel-lint": "^1.3.2",
15-
"dave-liddament/phpstan-rule-test-helper": "^0.1.0 || ^0.2.0"
15+
"dave-liddament/phpstan-rule-test-helper": "^0.3.0"
1616
},
1717
"license": "MIT",
1818
"autoload": {

composer.lock

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

src/Config/TestConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TestConfig
2121

2222
public function __construct(
2323
string $mode,
24-
string $testNamespace = null,
24+
?string $testNamespace = null,
2525
) {
2626
if (!in_array(
2727
needle: $mode,

src/Rules/AbstractFriendRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ protected function getErrorOrNull(
9292
implode('|', $allowedCallingClasses)
9393
);
9494

95-
return RuleErrorBuilder::message($message)->build();
95+
return RuleErrorBuilder::message($message)->identifier('phpExtensionLibrary.friend')->build();
9696
}
9797
}

src/Rules/AbstractNamespaceVisibilityRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected function getErrorOrNull(
108108
$subNamespaces,
109109
);
110110

111-
return RuleErrorBuilder::message($message)->build();
111+
return RuleErrorBuilder::message($message)->identifier('phpExtensionLibrary.namespace')->build();
112112
}
113113

114114
/**

src/Rules/AbstractPackageRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,6 @@ protected function getErrorOrNull(
8686
$scope->getNamespace() ?? '<none>'
8787
);
8888

89-
return RuleErrorBuilder::message($message)->build();
89+
return RuleErrorBuilder::message($message)->identifier('phpExtensionLibrary.package')->build();
9090
}
9191
}

src/Rules/AbstractTestTagRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ protected function getErrorOrNull(
7171
$fullMethodName,
7272
);
7373

74-
return RuleErrorBuilder::message($message)->build();
74+
return RuleErrorBuilder::message($message)->identifier('phpExtensionLibrary.testTag')->build();
7575
}
7676
}

src/Rules/InjectableVersionRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function processNode(Node $node, Scope $scope): array
8888
$classToUse
8989
);
9090

91-
$errors[] = RuleErrorBuilder::message($message)->build();
91+
$errors[] = RuleErrorBuilder::message($message)->identifier('phpExtensionLibrary.injectableVersion')->build();
9292
}
9393
}
9494
}

src/Rules/OverrideRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function processNode(Node $node, Scope $scope): array
4747
}
4848

4949
$message = "Method {$methodName} has the Override attribute, but no matching parent method exists";
50-
$errors[] = RuleErrorBuilder::message($message)->line($method->getLine())->build();
50+
$errors[] = RuleErrorBuilder::message($message)->identifier('phpExtensionLibrary.override')->line($method->getLine())->build();
5151
}
5252

5353
return $errors;

0 commit comments

Comments
 (0)