Passed
Push — master ( 9273d6...3d5492 )
by Jan
05:16
created
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/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.
tests/Repository/StructuralDBElementRepositoryTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
 
127 127
         $this->assertSame('Node 1', $nodes[0]->getName());
128 128
         //Node must be from DB
129
-        $this->assertNotNull( $nodes[0]->getID());
129
+        $this->assertNotNull($nodes[0]->getID());
130 130
 
131 131
         $this->assertSame('Node 1.1', $nodes[1]->getName());
132 132
         //Node must be from DB
133
-        $this->assertNotNull( $nodes[1]->getID());
133
+        $this->assertNotNull($nodes[1]->getID());
134 134
 
135 135
         $this->assertSame('Node 1.1.1', $nodes[2]->getName());
136 136
         //Node must be from DB
137
-        $this->assertNotNull( $nodes[2]->getID());
137
+        $this->assertNotNull($nodes[2]->getID());
138 138
     }
139 139
 
140 140
     public function testGetNewEntityNew(): void
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 
146 146
         $this->assertSame('Element 1', $nodes[0]->getName());
147 147
         //Node must not be from DB
148
-        $this->assertNull( $nodes[0]->getID());
148
+        $this->assertNull($nodes[0]->getID());
149 149
 
150 150
         $this->assertSame('Element 1.1', $nodes[1]->getName());
151 151
         //Node must not be from DB
152
-        $this->assertNull( $nodes[1]->getID());
152
+        $this->assertNull($nodes[1]->getID());
153 153
 
154 154
         $this->assertSame('Element 1.1.1', $nodes[2]->getName());
155 155
         //Node must not be from DB
156
-        $this->assertNull( $nodes[2]->getID());
156
+        $this->assertNull($nodes[2]->getID());
157 157
     }
158 158
 
159 159
     public function testGetNewEntityMixed(): void
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 
165 165
         $this->assertSame('Node 1', $nodes[0]->getName());
166 166
         //Node must be from DB
167
-        $this->assertNotNull( $nodes[0]->getID());
167
+        $this->assertNotNull($nodes[0]->getID());
168 168
 
169 169
         $this->assertSame('Node 1.1', $nodes[1]->getName());
170 170
         //Node must be from DB
171
-        $this->assertNotNull( $nodes[1]->getID());
171
+        $this->assertNotNull($nodes[1]->getID());
172 172
 
173 173
         $this->assertSame('New Node', $nodes[2]->getName());
174 174
         //Node must not be from DB
175
-        $this->assertNull( $nodes[2]->getID());
175
+        $this->assertNull($nodes[2]->getID());
176 176
     }
177 177
 }
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
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     public function buildForm(FormBuilderInterface $builder, array $options): void
73 73
     {
74
-        $builder->addEventListener(FormEvents::PRE_SUBMIT, function (PreSubmitEvent $event) {
74
+        $builder->addEventListener(FormEvents::PRE_SUBMIT, function(PreSubmitEvent $event) {
75 75
             //When the data contains non-digit characters, we assume that the user entered a new element.
76 76
             //In that case we add the new element to our choice_loader
77 77
 
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
         });
90 90
 
91 91
         $builder->addModelTransformer(new CallbackTransformer(
92
-            function ($value) use ($options) {
92
+            function($value) use ($options) {
93 93
                 return $this->modelTransform($value, $options);
94
-            }, function ($value) use ($options) {
94
+            }, function($value) use ($options) {
95 95
             return $this->modelReverseTransform($value, $options);
96 96
         }));
97 97
     }
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
         $resolver->setDefaults([
103 103
             'allow_add' => false,
104 104
             'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext
105
-            'subentities_of' => null,   //Only show entities with the given parent class
106
-            'disable_not_selectable' => false,  //Disable entries with not selectable property
107
-            'choice_value' => function (?AbstractStructuralDBElement $element) {
105
+            'subentities_of' => null, //Only show entities with the given parent class
106
+            'disable_not_selectable' => false, //Disable entries with not selectable property
107
+            'choice_value' => function(?AbstractStructuralDBElement $element) {
108 108
                 if ($element === null) {
109 109
                     return null;
110 110
                 }
@@ -116,20 +116,20 @@  discard block
 block discarded – undo
116 116
 
117 117
                 return $element->getID();
118 118
             }, //Use the element id as option value and for comparing items
119
-            'choice_loader' => function (Options $options) {
119
+            'choice_loader' => function(Options $options) {
120 120
                 return new StructuralEntityChoiceLoader($options, $this->builder, $this->em);
121 121
             },
122
-            'choice_label' => function (Options $options) {
123
-                return function ($choice, $key, $value) use ($options) {
122
+            'choice_label' => function(Options $options) {
123
+                return function($choice, $key, $value) use ($options) {
124 124
                     return $this->generateChoiceLabels($choice, $key, $value, $options);
125 125
                 };
126 126
             },
127
-            'choice_attr' => function (Options $options) {
128
-                return function ($choice, $key, $value) use ($options) {
127
+            'choice_attr' => function(Options $options) {
128
+                return function($choice, $key, $value) use ($options) {
129 129
                     return $this->generateChoiceAttr($choice, $key, $value, $options);
130 130
                 };
131 131
             },
132
-            'group_by' => function (AbstractStructuralDBElement $element)
132
+            'group_by' => function(AbstractStructuralDBElement $element)
133 133
             {
134 134
                 //Show entities that are not added to DB yet separately from other entities
135 135
                 if ($element->getID() === null) {
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
         ]);
143 143
 
144 144
         //Set the constraints for the case that allow add is enabled (we then have to check that the new element is valid)
145
-        $resolver->setNormalizer('constraints', function (Options $options, $value) {
145
+        $resolver->setNormalizer('constraints', function(Options $options, $value) {
146 146
             if ($options['allow_add']) {
147 147
                 $value[] = new Valid();
148 148
             }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 
155 155
         $resolver->setDefault('controller', 'elements--structural-entity-select');
156 156
 
157
-        $resolver->setDefault('attr', function (Options $options) {
157
+        $resolver->setDefault('attr', function(Options $options) {
158 158
             $tmp = [
159 159
                 'data-controller' => $options['controller'],
160 160
                 'data-allow-add' => $options['allow_add'] ? 'true' : 'false',
Please login to merge, or discard this patch.
src/Form/UserSettingsType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
             ->add('reset', ResetType::class, ['label' => 'reset']);
132 132
 
133 133
         //Add the remove_avatar button if the user has an avatar (we have to add this dynamically)
134
-        $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) {
134
+        $builder->addEventListener(FormEvents::PRE_SET_DATA, function(PreSetDataEvent $event) {
135 135
             $data = $event->getData();
136 136
             if (!$data instanceof User) {
137 137
                 return;
Please login to merge, or discard this patch.
src/Form/Type/PartLotSelectType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@
 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
-            'query_builder' => function (Options $options) {
51
-                return function (EntityRepository $er) use ($options) {
50
+            'query_builder' => function(Options $options) {
51
+                return function(EntityRepository $er) use ($options) {
52 52
                     return $er->createQueryBuilder('l')
53 53
                         ->where('l.part = :part')
54 54
                         ->setParameter('part', $options['part']);
Please login to merge, or discard this patch.
src/Form/Type/ThemeChoiceType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
     {
44 44
         $resolver->setDefaults([
45 45
             'choices' => $this->available_themes,
46
-            'choice_label' => static function ($entity, $key, $value) {
46
+            'choice_label' => static function($entity, $key, $value) {
47 47
                 return $value;
48 48
             },
49 49
             'choice_translation_domain' => false,
Please login to merge, or discard this patch.
src/Form/Type/MasterPictureAttachmentType.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
         $resolver->setDefaults([
43 43
             'filter' => 'picture',
44 44
             'choice_translation_domain' => false,
45
-            'choice_attr' => static function (Options $options) {
46
-                return  static function ($choice, $key, $value) use ($options) {
45
+            'choice_attr' => static function(Options $options) {
46
+                return  static function($choice, $key, $value) use ($options) {
47 47
                     /** @var Attachment $choice */
48 48
                     $tmp = ['data-subtext' => $choice->getFilename() ?? 'URL'];
49 49
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
                 };
58 58
             },
59 59
             'choice_label' => 'name',
60
-            'choice_loader' => static function (Options $options) {
60
+            'choice_loader' => static function(Options $options) {
61 61
                 return new CallbackChoiceLoader(
62
-                    static function () use ($options) {
62
+                    static function() use ($options) {
63 63
                         $entity = $options['entity'];
64 64
                         if (!$entity instanceof AttachmentContainingDBElement) {
65 65
                             throw new RuntimeException('$entity must have Attachments! (be of type AttachmentContainingDBElement)');
Please login to merge, or discard this patch.