Skip to content

Commit

Permalink
minor #34267 Skip validation of services that make the CI fail (nicol…
Browse files Browse the repository at this point in the history
…as-grekas)

This PR was merged into the 4.4 branch.

Discussion
----------

Skip validation of services that make the CI fail

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

403fdf4 Skip validation of services that make the CI fail
  • Loading branch information
nicolas-grekas committed Nov 6, 2019
2 parents a1155ea + 403fdf4 commit 88759a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class TestBundle extends Bundle
Expand All @@ -29,6 +30,12 @@ public function build(ContainerBuilder $container)
/** @var $extension DependencyInjection\TestExtension */
$extension = $container->getExtension('test');

if (!$container->getParameterBag() instanceof FrozenParameterBag) {
$container->setParameter('container.build_hash', 'test_bundle');
$container->setParameter('container.build_time', time());
$container->setParameter('container.build_id', 'test_bundle');
}

$extension->setCustomConfig(new CustomConfig());

$container->addCompilerPass(new AnnotationReaderPass(), PassConfig::TYPE_AFTER_REMOVING);
Expand All @@ -42,6 +49,6 @@ public function process(ContainerBuilder $container)
}
});

$container->addCompilerPass(new CheckTypeDeclarationsPass(true), PassConfig::TYPE_AFTER_REMOVING, -100);
$container->addCompilerPass(new CheckTypeDeclarationsPass(true, ['http_client', '.debug.http_client']), PassConfig::TYPE_AFTER_REMOVING, -100);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
return [
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\TestBundle(),
];
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,24 @@ final class CheckTypeDeclarationsPass extends AbstractRecursivePass
private const SCALAR_TYPES = ['int', 'float', 'bool', 'string'];

private $autoload;
private $ignoredServices;

/**
* @param bool $autoload Whether services who's class in not loaded should be checked or not.
* Defaults to false to save loading code during compilation.
*/
public function __construct(bool $autoload = false)
public function __construct(bool $autoload = false, array $ignoredServices = [])
{
$this->autoload = $autoload;
$this->ignoredServices = array_flip($ignoredServices);
}

/**
* {@inheritdoc}
*/
protected function processValue($value, $isRoot = false)
{
if (!$value instanceof Definition) {
if (!$value instanceof Definition || isset($this->ignoredServices[$this->currentId])) {
return parent::processValue($value, $isRoot);
}

Expand Down

0 comments on commit 88759a3

Please sign in to comment.