Passed
Push — master ( 1472c3...a27cf4 )
by Jan
17:49 queued 11:38
created
src/Form/Type/PartLotSelectType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,16 +43,16 @@
 block discarded – undo
43 43
 
44 44
         $resolver->setDefaults([
45 45
             'class' => PartLot::class,
46
-            'choice_label' => ChoiceList::label($this, function (PartLot $part_lot) {
46
+            'choice_label' => ChoiceList::label($this, function(PartLot $part_lot) {
47 47
                 return ($part_lot->getStorageLocation() ? $part_lot->getStorageLocation()->getFullPath() : '')
48
-                    . ' (' . $part_lot->getName() . '): ' . $part_lot->getAmount();
48
+                    . ' ('.$part_lot->getName().'): '.$part_lot->getAmount();
49 49
             }),
50 50
             'attr' => [
51 51
                 'data-controller' => 'elements--selectpicker',
52 52
                 'data-live-search' => true,
53 53
             ],
54
-            'query_builder' => function (Options $options) {
55
-                return function (EntityRepository $er) use ($options) {
54
+            'query_builder' => function(Options $options) {
55
+                return function(EntityRepository $er) use ($options) {
56 56
                     return $er->createQueryBuilder('l')
57 57
                         ->where('l.part = :part')
58 58
                         ->setParameter('part', $options['part']);
Please login to merge, or discard this patch.
src/Helpers/Projects/ProjectBuildRequest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
         $this->initializeArray();
57 57
 
58 58
         //By default, use the first available lot of builds part if there is one.
59
-        if($project->getBuildPart() !== null) {
59
+        if ($project->getBuildPart() !== null) {
60 60
             $this->add_build_to_builds_part = true;
61
-            foreach( $project->getBuildPart()->getPartLots() as $lot) {
61
+            foreach ($project->getBuildPart()->getPartLots() as $lot) {
62 62
                 if (!$lot->isInstockUnknown()) {
63 63
                     $this->builds_lot = $lot;
64 64
                     break;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         //Now create an array for each BOM entry
76 76
         foreach ($this->getPartBomEntries() as $bom_entry) {
77 77
             $remaining_amount = $this->getNeededAmountForBOMEntry($bom_entry);
78
-            foreach($this->getPartLotsForBOMEntry($bom_entry) as $lot) {
78
+            foreach ($this->getPartLotsForBOMEntry($bom_entry) as $lot) {
79 79
                 //If the lot has instock use it for the build
80 80
                 $this->withdraw_amounts[$lot->getID()] = min($remaining_amount, $lot->getAmount());
81 81
                 $remaining_amount -= max(0, $this->withdraw_amounts[$lot->getID()]);
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
             throw new \InvalidArgumentException('The given lot must be an instance of PartLot or an ID of a PartLot!');
185 185
         }
186 186
 
187
-        if (! array_key_exists($lot_id, $this->withdraw_amounts)) {
187
+        if (!array_key_exists($lot_id, $this->withdraw_amounts)) {
188 188
             throw new \InvalidArgumentException('The given lot is not in the withdraw amounts array!');
189 189
         }
190 190
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      */
278 278
     public function getPartBomEntries(): array
279 279
     {
280
-        return $this->project->getBomEntries()->filter(function (ProjectBOMEntry $entry) {
280
+        return $this->project->getBomEntries()->filter(function(ProjectBOMEntry $entry) {
281 281
             return $entry->isPartBomEntry();
282 282
         })->toArray();
283 283
     }
Please login to merge, or discard this patch.
Validator/Constraints/ProjectSystem/ValidProjectBuildRequestValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     private function buildViolationForLot(PartLot $partLot, string $message): ConstraintViolationBuilderInterface
33 33
     {
34 34
         return $this->context->buildViolation($message)
35
-            ->atPath('lot_' . $partLot->getID())
35
+            ->atPath('lot_'.$partLot->getID())
36 36
             ->setParameter('{{ lot }}', $partLot->getName());
37 37
     }
38 38
 
Please login to merge, or discard this patch.
src/Form/UserSettingsType.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
                 ],
123 123
                 'choice_translation_domain' => false,
124 124
                 'choices' => User::AVAILABLE_THEMES,
125
-                'choice_label' => static function ($entity, $key, $value) {
125
+                'choice_label' => static function($entity, $key, $value) {
126 126
                     return $value;
127 127
                 },
128 128
                 'placeholder' => 'user_settings.theme.placeholder',
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             ->add('reset', ResetType::class, ['label' => 'reset']);
140 140
 
141 141
         //Add the remove_avatar button if the user has an avatar (we have to add this dynamically)
142
-        $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) {
142
+        $builder->addEventListener(FormEvents::PRE_SET_DATA, function(PreSetDataEvent $event) {
143 143
             $data = $event->getData();
144 144
             if (!$data instanceof User) {
145 145
                 return;
Please login to merge, or discard this patch.
src/Services/ImportExportSystem/EntityImporter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 
80 80
         foreach ($names as $name) {
81 81
             //Count intendation level (whitespace characters at the beginning of the line)
82
-            $identSize = strlen($name)-strlen(ltrim($name));
82
+            $identSize = strlen($name) - strlen(ltrim($name));
83 83
 
84 84
             //If the line is intendet more than the last line, we have a new parent element
85 85
             if ($identSize > end($indentations)) {
Please login to merge, or discard this patch.
src/Command/BackupCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
         }
64 64
 
65 65
         //When all options are false, we abort and show an error message
66
-        if (! $backup_database && ! $backup_attachments && ! $backup_config) {
66
+        if (!$backup_database && !$backup_attachments && !$backup_config) {
67 67
             $io->error('You have to select at least one option what to backup! Use --full to backup everything.');
68 68
 
69 69
             return Command::FAILURE;
Please login to merge, or discard this patch.
src/Form/Type/Helper/StructuralEntityChoiceLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
 
93 93
         $results = [];
94 94
 
95
-        foreach($entities as $entity) {
95
+        foreach ($entities as $entity) {
96 96
             //If the entity is newly created (ID null), add it as result and persist it.
97 97
             if ($entity->getID() === null) {
98 98
                 $this->entityManager->persist($entity);
Please login to merge, or discard this patch.
src/Form/Type/StructuralEntityType.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
     public function buildForm(FormBuilderInterface $builder, array $options): void
70 70
     {
71
-        $builder->addEventListener(FormEvents::PRE_SUBMIT, function (PreSubmitEvent $event) {
71
+        $builder->addEventListener(FormEvents::PRE_SUBMIT, function(PreSubmitEvent $event) {
72 72
             //When the data contains non-digit characters, we assume that the user entered a new element.
73 73
             //In that case we add the new element to our choice_loader
74 74
 
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 
102 102
 
103 103
         $builder->addModelTransformer(new CallbackTransformer(
104
-            function ($value) use ($options) {
104
+            function($value) use ($options) {
105 105
                 return $this->modelTransform($value, $options);
106
-            }, function ($value) use ($options) {
106
+            }, function($value) use ($options) {
107 107
             return $this->modelReverseTransform($value, $options);
108 108
         }));
109 109
     }
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
         $resolver->setDefaults([
115 115
             'allow_add' => false,
116 116
             'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext
117
-            'subentities_of' => null,   //Only show entities with the given parent class
118
-            'disable_not_selectable' => false,  //Disable entries with not selectable property
119
-            'choice_value' => function (?AbstractStructuralDBElement $element) {
117
+            'subentities_of' => null, //Only show entities with the given parent class
118
+            'disable_not_selectable' => false, //Disable entries with not selectable property
119
+            'choice_value' => function(?AbstractStructuralDBElement $element) {
120 120
                 if ($element === null) {
121 121
                     return null;
122 122
                 }
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 
129 129
                 return $element->getID();
130 130
             }, //Use the element id as option value and for comparing items
131
-            'choice_loader' => function (Options $options) {
131
+            'choice_loader' => function(Options $options) {
132 132
                 return new StructuralEntityChoiceLoader($options, $this->builder, $this->em);
133 133
             },
134
-            'choice_label' => function (Options $options) {
135
-                return function ($choice, $key, $value) use ($options) {
134
+            'choice_label' => function(Options $options) {
135
+                return function($choice, $key, $value) use ($options) {
136 136
                     return $this->generateChoiceLabels($choice, $key, $value, $options);
137 137
                 };
138 138
             },
139
-            'choice_attr' => function (Options $options) {
140
-                return function ($choice, $key, $value) use ($options) {
139
+            'choice_attr' => function(Options $options) {
140
+                return function($choice, $key, $value) use ($options) {
141 141
                     return $this->generateChoiceAttr($choice, $key, $value, $options);
142 142
                 };
143 143
             },
144
-            'group_by' => function (AbstractStructuralDBElement $element)
144
+            'group_by' => function(AbstractStructuralDBElement $element)
145 145
             {
146 146
                 //Show entities that are not added to DB yet separately from other entities
147 147
                 if ($element->getID() === null) {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         ]);
155 155
 
156 156
         //Set the constraints for the case that allow add is enabled (we then have to check that the new element is valid)
157
-        $resolver->setNormalizer('constraints', function (Options $options, $value) {
157
+        $resolver->setNormalizer('constraints', function(Options $options, $value) {
158 158
             if ($options['allow_add']) {
159 159
                 $value[] = new Valid();
160 160
             }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         $resolver->setDefault('controller', 'elements--structural-entity-select');
168 168
 
169
-        $resolver->setDefault('attr', static function (Options $options) {
169
+        $resolver->setDefault('attr', static function(Options $options) {
170 170
             $tmp = [
171 171
                 'data-controller' => $options['controller'],
172 172
                 'data-allow-add' => $options['allow_add'] ? 'true' : 'false',
Please login to merge, or discard this patch.
src/Form/Type/CurrencyEntityType.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
         // This options allows you to override the currency shown for the null value
59 59
         $resolver->setDefault('base_currency', null);
60 60
 
61
-        $resolver->setDefault('empty_message', function (Options $options) {
61
+        $resolver->setDefault('empty_message', function(Options $options) {
62 62
             //By default we use the global base currency:
63 63
             $iso_code = $this->base_currency;
64 64
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             throw new RuntimeException('The choice must be an instance of '.Currency::class);
84 84
         }
85 85
 
86
-        if(!empty($choice->getIsoCode())) {
86
+        if (!empty($choice->getIsoCode())) {
87 87
             $symbol = Currencies::getSymbol($choice->getIsoCode());
88 88
         } else {
89 89
             $symbol = null;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
     protected function getChoiceContent(AbstractStructuralDBElement $choice, $key, $value, $options): string
106 106
     {
107
-        if(!$choice instanceof Currency) {
107
+        if (!$choice instanceof Currency) {
108 108
             throw new RuntimeException('$choice must be an instance of Currency!');
109 109
         }
110 110
 
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
         $tmp = str_repeat('<span class="picker-level"></span>', $level);
122 122
 
123 123
         //Show currency symbol or ISO code and the name of the currency
124
-        if(!empty($choice->getIsoCode())) {
124
+        if (!empty($choice->getIsoCode())) {
125 125
             $tmp .= Currencies::getSymbol($choice->getIsoCode());
126 126
             //Add currency name as badge
127
-            $tmp .= sprintf('<span class="badge bg-primary ms-2 %s">%s</span>', $options['short'] ? 'picker-hs' : '' , htmlspecialchars($choice->getName()));
127
+            $tmp .= sprintf('<span class="badge bg-primary ms-2 %s">%s</span>', $options['short'] ? 'picker-hs' : '', htmlspecialchars($choice->getName()));
128 128
         } else {
129 129
             $tmp .= htmlspecialchars($choice->getName());
130 130
         }
Please login to merge, or discard this patch.