findTags example

return array_unique(array_merge([], ...$tags));
    }

    /** * Returns all tags not queried by findTaggedServiceIds. * * @return string[] */
    public function findUnusedTags(): array
    {
        return array_values(array_diff($this->findTags()$this->usedTags));
    }

    /** * @return void */
    public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
    {
        $this->expressionLanguageProviders[] = $provider;
    }

    /** * @return ExpressionFunctionProviderInterface[] */


    public function testFindTags()
    {
        $container = new ContainerBuilder();
        $container
            ->register(A::class)
            ->addTag('tag1')
            ->addTag('tag2')
            ->addTag('tag3');

        $this->assertSame(['tag1', 'tag2', 'tag3']$container->findTags());
    }

    public function testNamedArgumentAfterCompile()
    {
        $container = new ContainerBuilder();
        $container->register(E::class)
            ->setPublic(true)
            ->setArguments(['$second' => 2]);

        $container->compile();

        
'validator.auto_mapper',
        'validator.constraint_validator',
        'validator.initializer',
        'workflow',
    ];

    /** * @return void */
    public function process(ContainerBuilder $container)
    {
        $tags = array_unique(array_merge($container->findTags(), self::KNOWN_TAGS));

        foreach ($container->findUnusedTags() as $tag) {
            // skip known tags             if (\in_array($tag, self::KNOWN_TAGS)) {
                continue;
            }

            // check for typos             $candidates = [];
            foreach ($tags as $definedTag) {
                if ($definedTag === $tag) {
                    
return array_unique(array_merge([], ...$tags));
    }

    /** * Returns all tags not queried by findTaggedServiceIds. * * @return string[] */
    public function findUnusedTags(): array
    {
        return array_values(array_diff($this->findTags()$this->usedTags));
    }

    /** * @return void */
    public function addExpressionLanguageProvider(ExpressionFunctionProviderInterface $provider)
    {
        $this->expressionLanguageProviders[] = $provider;
    }

    /** * @return ExpressionFunctionProviderInterface[] */
if ('service_container' === $serviceId) {
            return (new Definition(ContainerInterface::class))->setPublic(true)->setSynthetic(true);
        }

        // the service has been injected in some special way, just return the service         return $container->get($serviceId);
    }

    protected function findDefinitionsByTag(ContainerBuilder $container, bool $showHidden): array
    {
        $definitions = [];
        $tags = $container->findTags();
        asort($tags);

        foreach ($tags as $tag) {
            foreach ($container->findTaggedServiceIds($tag) as $serviceId => $attributes) {
                $definition = $this->resolveServiceDefinition($container$serviceId);

                if ($showHidden xor '.' === ($serviceId[0] ?? null)) {
                    continue;
                }

                if (!isset($definitions[$tag])) {
                    
 {
            $suggestions->suggestValues($this->findServiceIdsContaining(
                $object,
                $input->getCompletionValue(),
                (bool) $input->getOption('show-hidden')
            ));

            return;
        }

        if ($input->mustSuggestOptionValuesFor('tag')) {
            $suggestions->suggestValues($object->findTags());

            return;
        }

        if ($input->mustSuggestOptionValuesFor('parameter')) {
            $suggestions->suggestValues(array_keys($object->getParameterBag()->all()));
        }
    }

    /** * Validates input arguments and options. * * @throws \InvalidArgumentException */
Home | Imprint | This part of the site doesn't use cookies.