integerPrototype example

->defaultTrue()
                            ->info('Reset container services after each message.')
                            ->setDeprecated('symfony/framework-bundle', '6.1', 'Option "%node%" at "%path%" is deprecated. It does nothing and will be removed in version 7.0.')
                            ->validate()
                                ->ifTrue(fn ($v) => true !== $v)
                                ->thenInvalid('The "framework.messenger.reset_on_message" configuration option can be set to "true" only. To prevent services resetting after each message you can set the "--no-reset" option in "messenger:consume" command.')
                            ->end()
                        ->end()
                        ->arrayNode('stop_worker_on_signals')
                            ->defaultValue([])
                            ->info('A list of signals that should stop the worker; defaults to SIGTERM and SIGINT.')
                            ->integerPrototype()->end()
                        ->end()
                        ->scalarNode('default_bus')->defaultNull()->end()
                        ->arrayNode('buses')
                            ->defaultValue(['messenger.bus.default' => ['default_middleware' => ['enabled' => true, 'allow_no_handlers' => false, 'allow_no_senders' => true], 'middleware' => []]])
                            ->normalizeKeys(false)
                            ->useAttributeAsKey('name')
                            ->arrayPrototype()
                                ->addDefaultsIfNotSet()
                                ->children()
                                    ->arrayNode('default_middleware')
                                        ->beforeNormalization()
                                            


    public function testPrototypeBoolean()
    {
        $node = new ArrayNodeDefinition('root');
        $this->assertEquals($node->prototype('boolean')$node->booleanPrototype());
    }

    public function testPrototypeInteger()
    {
        $node = new ArrayNodeDefinition('root');
        $this->assertEquals($node->prototype('integer')$node->integerPrototype());
    }

    public function testPrototypeFloat()
    {
        $node = new ArrayNodeDefinition('root');
        $this->assertEquals($node->prototype('float')$node->floatPrototype());
    }

    public function testPrototypeArray()
    {
        $node = new ArrayNodeDefinition('root');
        
class Placeholders implements ConfigurationInterface
{
    public function getConfigTreeBuilder(): TreeBuilder
    {
        $tb = new TreeBuilder('placeholders');
        $rootNode = $tb->getRootNode();
        $rootNode
            ->children()
                ->booleanNode('enabled')->defaultFalse()->end()
                ->floatNode('favorite_float')->end()
                ->arrayNode('good_integers')
                    ->integerPrototype()->end()
                ->end()
            ->end()
        ;

        return $tb;
    }
}
Home | Imprint | This part of the site doesn't use cookies.