Skip to content

Commit

Permalink
Enable new shipmonk phpstan rules
Browse files Browse the repository at this point in the history
  • Loading branch information
xificurk committed Oct 23, 2022
1 parent db1227a commit b6de769
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -26,7 +26,7 @@
"phpstan/phpstan-strict-rules": "1.4.4",
"nepada/phpstan-nette-tester": "1.0.0",
"spaze/phpstan-disallowed-calls": "2.5.0",
"shipmonk/phpstan-rules": "1.1.1",
"shipmonk/phpstan-rules": "1.2.0",
"phpstan/phpstan-mockery": "1.1.0",
"php-parallel-lint/php-parallel-lint": "1.3.2",
"nepada/coding-standard": "7.5.2",
Expand Down
4 changes: 4 additions & 0 deletions phpstan.neon.dist
Expand Up @@ -30,3 +30,7 @@ parameters:
-
message: '#Parameter \#1 \$value .* of method Nepada\\PhoneNumberDoctrine\\PhoneNumberType::convertToDatabaseValue\(\) should be contravariant with parameter \$value .* of method Doctrine\\DBAL\\Types\\Type::convertToDatabaseValue\(\)#'
path: src/PhoneNumberDoctrine/PhoneNumberType.php
- # conditional type narrowing
message: "#^Overwriting variable \\$value while changing its type from string to Brick\\\\PhoneNumber\\\\PhoneNumber$#"
count: 1
path: src/PhoneNumberDoctrine/PhoneNumberType.php
2 changes: 1 addition & 1 deletion phpstan.tests.neon.dist
Expand Up @@ -23,4 +23,4 @@ parameters:
- tests/temp/*

ignoreErrors:
- '~Call to static method Tester\\Assert::(type|count|same|notSame)\(\) with .* and .* will always evaluate to true\.~'
# - '~Call to static method Tester\\Assert::(type|count|same|notSame)\(\) with .* and .* will always evaluate to true\.~'
9 changes: 9 additions & 0 deletions tests/PHPStan/shipmonk.neon
@@ -1,14 +1,23 @@
rules:
- ShipMonk\PHPStan\Rule\BackedEnumGenericsRule
- ShipMonk\PHPStan\Rule\ForbidAssignmentNotMatchingVarDocRule
- ShipMonk\PHPStan\Rule\ForbidEnumInFunctionArgumentsRule
- ShipMonk\PHPStan\Rule\ForbidFetchOnMixedRule
- ShipMonk\PHPStan\Rule\ForbidMatchDefaultArmForEnumsRule
- ShipMonk\PHPStan\Rule\ForbidMethodCallOnMixedRule
- ShipMonk\PHPStan\Rule\ForbidReturnInConstructorRule
- ShipMonk\PHPStan\Rule\ForbidUnsetClassFieldRule
- ShipMonk\PHPStan\Rule\ForbidUnusedExceptionRule
- ShipMonk\PHPStan\Rule\ForbidUnusedMatchResultRule
- ShipMonk\PHPStan\Rule\ForbidVariableTypeOverwritingRule
- ShipMonk\PHPStan\Rule\RequirePreviousExceptionPassRule

services:
-
type: ShipMonk\PHPStan\Visitor\UnusedExceptionVisitor
tags:
- phpstan.parser.richParserNodeVisitor
-
class: ShipMonk\PHPStan\Visitor\UnusedMatchVisitor
tags:
- phpstan.parser.richParserNodeVisitor
1 change: 0 additions & 1 deletion tests/PhoneNumberDoctrine/PhoneNumberTypeTest.phpt
Expand Up @@ -39,7 +39,6 @@ class PhoneNumberTypeTest extends TestCase
Type::addType(PhoneNumber::class, PhoneNumberType::class);
}

/** @var PhoneNumberType $type */
$type = Type::getType(PhoneNumber::class);
Assert::type(PhoneNumberType::class, $type);
$this->type = $type;
Expand Down

0 comments on commit b6de769

Please sign in to comment.