Skip to content

Commit

Permalink
Move ignored phpstan errors to phpstan.neon
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsFrank committed Sep 12, 2024
1 parent cba7cf0 commit 5b964e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ parameters:
reportWrongPhpDocTypeInVarTag: true
reportAnyTypeWideningInVarTag: true
checkMissingOverrideMethodAttribute: true
ignoreErrors:
- "#^Parameter \\#1 \\$id \\(class\\-string\\<T of object\\>\\) of method PrinsFrank\\\\Container\\\\Container\\:\\:get\\(\\) should be contravariant with parameter \\$id \\(string\\) of method Psr\\\\Container\\\\ContainerInterface\\:\\:get\\(\\)$#"
- "#^Parameter \\#1 \\$id \\(class\\-string\\<object\\>\\) of method PrinsFrank\\\\Container\\\\Container\\:\\:has\\(\\) should be contravariant with parameter \\$id \\(string\\) of method Psr\\\\Container\\\\ContainerInterface\\:\\:has\\(\\)$#"
includes:
- phar://phpstan.phar/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
8 changes: 1 addition & 7 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ public function __construct(bool $allowSelfResolve = true, private readonly bool
* @param class-string<T> $id
* @throws UnresolvableException|InvalidServiceProviderException|InvalidMethodException|MissingDefinitionException
* @return T|null
*
* @phpstan-ignore method.childParameterType
*/
#[Override]
public function get(string $id): ?object {
Expand Down Expand Up @@ -60,11 +58,7 @@ public function get(string $id): ?object {
throw new UnresolvableException(sprintf('Id "%s" is not resolvable', $id));
}

/**
* @param class-string<object> $id
*
* @phpstan-ignore method.childParameterType
*/
/** @param class-string<object> $id */
#[Override]
public function has(string $id): bool {
if ($this->autowire === true) {
Expand Down

0 comments on commit 5b964e2

Please sign in to comment.