| Conditions | 4 |
| Paths | 6 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function process(ContainerBuilder $container): void |
||
| 25 | { |
||
| 26 | $configs = $container->getExtensionConfig('webpack_encore'); |
||
| 27 | |||
| 28 | $entries = []; |
||
| 29 | foreach ($configs as $config) { |
||
| 30 | if (!isset($config['builds'])) { |
||
| 31 | continue; |
||
| 32 | } |
||
| 33 | |||
| 34 | $entries = array_merge($entries, $config['builds']); |
||
| 35 | } |
||
| 36 | |||
| 37 | if (!$entries) { |
||
|
|
|||
| 38 | return; |
||
| 39 | } |
||
| 40 | |||
| 41 | $container->getDefinition('twig') |
||
| 42 | ->addMethodCall('addGlobal', ['sonata_admin_webpack_entries', $entries]); |
||
| 43 | } |
||
| 44 | } |
||
| 45 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.