8000 Skip validation of services that make the CI fail by nicolas-grekas · Pull Request #34267 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Skip validation of services that make the CI fail #34267

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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