Skip to content

Commit

Permalink
phpstan-strict-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Oct 9, 2024
1 parent 74edd1e commit 16f32b7
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^1.0.0",
"php-parallel-lint/php-parallel-lint": "^1.2",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-strict-rules": "^2.0",
"phpunit/phpunit": "^9.5",
"slevomat/coding-standard": "^8.8.0",
"squizlabs/php_codesniffer": "^3.5.3"
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
includes:
- rules.neon
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/phpstan/phpstan-phpunit/extension.neon

parameters:
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/NoPrivate/CallToPrivateFunctionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function processNode(Node $node, Scope $scope): array

$docComment = $function->getDocComment();

if (!$docComment) {
if ($docComment === null) {
return [];
}

Expand Down
2 changes: 1 addition & 1 deletion src/Rules/NoPrivate/CallToPrivateMethodRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function processNode(Node $node, Scope $scope): array

$docComment = $methodReflection->getDocComment();

if (!$docComment) {
if ($docComment === null) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/Rules/NoPrivate/CallToPrivateStaticMethodRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static function (Type $type) use ($methodName): bool {
}

$resolvedPhpDoc = $class->getResolvedPhpDoc();
if ($resolvedPhpDoc && PrivateAnnotationHelper::isPrivate($resolvedPhpDoc)) {
if ($resolvedPhpDoc !== null && PrivateAnnotationHelper::isPrivate($resolvedPhpDoc)) {
$errors[] = RuleErrorBuilder::message(
sprintf(
'Call to method %s() of private/internal class %s.',
Expand All @@ -105,7 +105,7 @@ static function (Type $type) use ($methodName): bool {

$docComment = $methodReflection->getDocComment();

if (!$docComment) {
if ($docComment === null) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Rules/NoPrivate/InheritanceOfPrivateClassRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function processNode(Node $node, Scope $scope): array
try {
$parentClass = $this->reflectionProvider->getClass($parentClassName);
$resolvedPhpDoc = $parentClass->getResolvedPhpDoc();
if (!$resolvedPhpDoc || !PrivateAnnotationHelper::isPrivate($resolvedPhpDoc)) {
if ($resolvedPhpDoc === null || !PrivateAnnotationHelper::isPrivate($resolvedPhpDoc)) {
return $errors;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Rules/NoPrivate/InstantiationOfPrivateClassRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static function (): bool {
}

$resolvedPhpDoc = $class->getResolvedPhpDoc();
if (!$resolvedPhpDoc || !PrivateAnnotationHelper::isPrivate($resolvedPhpDoc)) {
if ($resolvedPhpDoc === null || !PrivateAnnotationHelper::isPrivate($resolvedPhpDoc)) {
continue;
}

Expand Down

0 comments on commit 16f32b7

Please sign in to comment.