1 | <?php |
||||||
2 | |||||||
3 | declare(strict_types=1); |
||||||
4 | |||||||
5 | namespace Setono\SyliusStockMovementPlugin\DependencyInjection; |
||||||
6 | |||||||
7 | use Setono\SyliusStockMovementPlugin\Doctrine\ORM\ReportRepository; |
||||||
8 | use Setono\SyliusStockMovementPlugin\Form\Type\ReportConfigurationFilterType; |
||||||
9 | use Setono\SyliusStockMovementPlugin\Form\Type\ReportConfigurationTransportType; |
||||||
10 | use Setono\SyliusStockMovementPlugin\Form\Type\ReportConfigurationType; |
||||||
11 | use Setono\SyliusStockMovementPlugin\Model\Error; |
||||||
12 | use Setono\SyliusStockMovementPlugin\Model\Report; |
||||||
13 | use Setono\SyliusStockMovementPlugin\Model\ReportConfiguration; |
||||||
14 | use Setono\SyliusStockMovementPlugin\Model\ReportConfigurationFilter; |
||||||
15 | use Setono\SyliusStockMovementPlugin\Model\ReportConfigurationTransport; |
||||||
16 | use Setono\SyliusStockMovementPlugin\Model\StockMovement; |
||||||
17 | use Sylius\Bundle\ResourceBundle\Controller\ResourceController; |
||||||
18 | use Sylius\Bundle\ResourceBundle\Form\Type\DefaultResourceType; |
||||||
19 | use Sylius\Bundle\ResourceBundle\SyliusResourceBundle; |
||||||
20 | use Sylius\Component\Resource\Factory\Factory; |
||||||
21 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||||||
22 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||||||
23 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
||||||
24 | |||||||
25 | final class Configuration implements ConfigurationInterface |
||||||
26 | { |
||||||
27 | public function getConfigTreeBuilder(): TreeBuilder |
||||||
28 | { |
||||||
29 | if (method_exists(TreeBuilder::class, 'getRootNode')) { |
||||||
30 | $treeBuilder = new TreeBuilder('setono_sylius_stock_movement'); |
||||||
31 | $rootNode = $treeBuilder->getRootNode(); |
||||||
32 | } else { |
||||||
33 | // BC layer for symfony/config 4.1 and older |
||||||
34 | $treeBuilder = new TreeBuilder(); |
||||||
35 | $rootNode = $treeBuilder->root('setono_sylius_stock_movement'); |
||||||
0 ignored issues
–
show
|
|||||||
36 | } |
||||||
37 | |||||||
38 | $rootNode |
||||||
39 | ->addDefaultsIfNotSet() |
||||||
0 ignored issues
–
show
The method
addDefaultsIfNotSet() does not exist on Symfony\Component\Config...\Builder\NodeDefinition . It seems like you code against a sub-type of Symfony\Component\Config...\Builder\NodeDefinition such as Symfony\Component\Config...der\ArrayNodeDefinition .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
40 | ->fixXmlConfig('template') |
||||||
41 | ->children() |
||||||
42 | ->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end() |
||||||
43 | ->scalarNode('report_filesystem') |
||||||
44 | ->info('The service id of the Flysystem filesystem to use when saving reports') |
||||||
45 | ->cannotBeEmpty() |
||||||
46 | ->defaultValue('setono_sylius_stock_movement.storage.local.report') |
||||||
47 | ->end() |
||||||
48 | ->arrayNode('templates') |
||||||
49 | ->isRequired() |
||||||
50 | ->requiresAtLeastOneElement() |
||||||
51 | ->useAttributeAsKey('template') |
||||||
52 | ->arrayPrototype() |
||||||
53 | ->children() |
||||||
54 | ->scalarNode('label')->end() |
||||||
55 | ->scalarNode('template')->end() |
||||||
56 | ->end() |
||||||
57 | ->end() |
||||||
58 | ->end() |
||||||
59 | ->end() |
||||||
60 | ; |
||||||
61 | |||||||
62 | $this->addResourcesSection($rootNode); |
||||||
63 | |||||||
64 | return $treeBuilder; |
||||||
65 | } |
||||||
66 | |||||||
67 | private function addResourcesSection(ArrayNodeDefinition $node): void |
||||||
68 | { |
||||||
69 | $node |
||||||
70 | ->children() |
||||||
71 | ->arrayNode('resources') |
||||||
72 | ->addDefaultsIfNotSet() |
||||||
73 | ->children() |
||||||
74 | ->arrayNode('error') |
||||||
75 | ->addDefaultsIfNotSet() |
||||||
76 | ->children() |
||||||
77 | ->variableNode('options')->end() |
||||||
78 | ->arrayNode('classes') |
||||||
0 ignored issues
–
show
The method
arrayNode() does not exist on Symfony\Component\Config...der\NodeParentInterface . It seems like you code against a sub-type of Symfony\Component\Config...der\NodeParentInterface such as Symfony\Component\Config...ion\Builder\NodeBuilder .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
79 | ->addDefaultsIfNotSet() |
||||||
80 | ->children() |
||||||
81 | ->scalarNode('model')->defaultValue(Error::class)->cannotBeEmpty()->end() |
||||||
82 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||||||
83 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||||||
84 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||||||
85 | ->scalarNode('form')->defaultValue(DefaultResourceType::class)->cannotBeEmpty()->end() |
||||||
86 | ->end() |
||||||
87 | ->end() |
||||||
88 | ->end() |
||||||
89 | ->end() |
||||||
90 | ->arrayNode('report') |
||||||
91 | ->addDefaultsIfNotSet() |
||||||
92 | ->children() |
||||||
93 | ->variableNode('options')->end() |
||||||
94 | ->arrayNode('classes') |
||||||
95 | ->addDefaultsIfNotSet() |
||||||
96 | ->children() |
||||||
97 | ->scalarNode('model')->defaultValue(Report::class)->cannotBeEmpty()->end() |
||||||
98 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||||||
99 | ->scalarNode('repository')->defaultValue(ReportRepository::class)->cannotBeEmpty()->end() |
||||||
100 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||||||
101 | ->scalarNode('form')->defaultValue(DefaultResourceType::class)->cannotBeEmpty()->end() |
||||||
102 | ->end() |
||||||
103 | ->end() |
||||||
104 | ->end() |
||||||
105 | ->end() |
||||||
106 | ->arrayNode('report_configuration') |
||||||
107 | ->addDefaultsIfNotSet() |
||||||
108 | ->children() |
||||||
109 | ->variableNode('options')->end() |
||||||
110 | ->arrayNode('classes') |
||||||
111 | ->addDefaultsIfNotSet() |
||||||
112 | ->children() |
||||||
113 | ->scalarNode('model')->defaultValue(ReportConfiguration::class)->cannotBeEmpty()->end() |
||||||
114 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||||||
115 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||||||
116 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||||||
117 | ->scalarNode('form')->defaultValue(ReportConfigurationType::class)->cannotBeEmpty()->end() |
||||||
118 | ->end() |
||||||
119 | ->end() |
||||||
120 | ->end() |
||||||
121 | ->end() |
||||||
122 | ->arrayNode('report_configuration_filter') |
||||||
123 | ->addDefaultsIfNotSet() |
||||||
124 | ->children() |
||||||
125 | ->variableNode('options')->end() |
||||||
126 | ->arrayNode('classes') |
||||||
127 | ->addDefaultsIfNotSet() |
||||||
128 | ->children() |
||||||
129 | ->scalarNode('model')->defaultValue(ReportConfigurationFilter::class)->cannotBeEmpty()->end() |
||||||
130 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||||||
131 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||||||
132 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||||||
133 | ->scalarNode('form')->defaultValue(ReportConfigurationFilterType::class)->cannotBeEmpty()->end() |
||||||
134 | ->end() |
||||||
135 | ->end() |
||||||
136 | ->end() |
||||||
137 | ->end() |
||||||
138 | ->arrayNode('report_configuration_transport') |
||||||
139 | ->addDefaultsIfNotSet() |
||||||
140 | ->children() |
||||||
141 | ->variableNode('options')->end() |
||||||
142 | ->arrayNode('classes') |
||||||
143 | ->addDefaultsIfNotSet() |
||||||
144 | ->children() |
||||||
145 | ->scalarNode('model')->defaultValue(ReportConfigurationTransport::class)->cannotBeEmpty()->end() |
||||||
146 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||||||
147 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||||||
148 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||||||
149 | ->scalarNode('form')->defaultValue(ReportConfigurationTransportType::class)->cannotBeEmpty()->end() |
||||||
150 | ->end() |
||||||
151 | ->end() |
||||||
152 | ->end() |
||||||
153 | ->end() |
||||||
154 | ->arrayNode('stock_movement') |
||||||
155 | ->addDefaultsIfNotSet() |
||||||
156 | ->children() |
||||||
157 | ->variableNode('options')->end() |
||||||
158 | ->arrayNode('classes') |
||||||
159 | ->addDefaultsIfNotSet() |
||||||
160 | ->children() |
||||||
161 | ->scalarNode('model')->defaultValue(StockMovement::class)->cannotBeEmpty()->end() |
||||||
162 | ->scalarNode('controller')->defaultValue(ResourceController::class)->cannotBeEmpty()->end() |
||||||
163 | ->scalarNode('repository')->cannotBeEmpty()->end() |
||||||
164 | ->scalarNode('factory')->defaultValue(Factory::class)->end() |
||||||
165 | ->scalarNode('form')->defaultValue(DefaultResourceType::class)->cannotBeEmpty()->end() |
||||||
166 | ->end() |
||||||
167 | ->end() |
||||||
168 | ->end() |
||||||
169 | ->end() |
||||||
170 | ->end() |
||||||
171 | ->end() |
||||||
172 | ->end() |
||||||
173 | ; |
||||||
174 | } |
||||||
175 | } |
||||||
176 |
This function has been deprecated. The supplier of the function has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.