Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
[PhpstanPhpConfig] Add ignore error option (#2918)
Browse files Browse the repository at this point in the history
  • Loading branch information
gertvdb authored Feb 8, 2021
1 parent ca0d84a commit 5d85ccb
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ public function convertParameterBag(ParameterBagInterface $parameterBag): array
);
}

if ($parameterBag->has(OPTION::IGNORE_ERRORS)) {
$neonParameters[OPTION::IGNORE_ERRORS] = (array) $parameterBag->get(
OPTION::IGNORE_ERRORS
);
}

return $neonParameters;
}

Expand Down
7 changes: 7 additions & 0 deletions packages/phpstan-php-config/src/ValueObject/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,11 @@ final class Option
* @var string
*/
public const OUTPUT_FILE = 'output-file';

/**
* @api
* Do not change the value, it is internal PHPStan naming
* @var string
*/
public const IGNORE_ERRORS = 'ignoreErrors';
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\PHPStanPHPConfig\ValueObject\Option;

return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(
OPTION::IGNORE_ERRORS,
[
'#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\\:\\:children\\(\\)#',
'#Call to an undefined method Symfony\Component\Config\Definition\Builder\NodeDefinition\:\:children\(\)#',
'#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\:\:children\(\)#'
]
);
};

?>
-----
parameters:
ignoreErrors:
- "#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\\:\\:children\\(\\)#"
- "#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\\:\\:children\\(\\)#"
- "#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition\\:\\:children\\(\\)#"

0 comments on commit 5d85ccb

Please sign in to comment.