@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | //Reload form, so the SIUnitType entries use the new part unit |
86 | 86 | $form = $this->createForm(PartBaseType::class, $part); |
87 | - } elseif ($form->isSubmitted() && ! $form->isValid()) { |
|
87 | + } elseif ($form->isSubmitted() && !$form->isValid()) { |
|
88 | 88 | $this->addFlash('error', $translator->trans('part.edited_flash.invalid')); |
89 | 89 | } |
90 | 90 | |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $this->addFlash('success', $translator->trans('part.created_flash')); |
125 | 125 | |
126 | 126 | return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]); |
127 | - } elseif ($form->isSubmitted() && ! $form->isValid()) { |
|
127 | + } elseif ($form->isSubmitted() && !$form->isValid()) { |
|
128 | 128 | $this->addFlash('error', $translator->trans('part.created_flash.invalid')); |
129 | 129 | } |
130 | 130 |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ->add('description', CKEditorType::class, ['required' => false, 'empty_data' => '', |
78 | 78 | 'label' => 'description.label', 'help' => 'bbcode.hint', 'config_name' => 'description_config', |
79 | 79 | 'attr' => ['placeholder' => 'part.description.placeholder', 'rows' => 2], |
80 | - 'disabled' => !$this->security->isGranted('description.edit', $part) ]) |
|
80 | + 'disabled' => !$this->security->isGranted('description.edit', $part)]) |
|
81 | 81 | ->add('minAmount', SIUnitType::class, |
82 | 82 | ['attr' => ['min' => 0, 'placeholder' => 'part.mininstock.placeholder'], 'label' => 'mininstock.label', |
83 | 83 | 'measurement_unit' => $part->getPartUnit(), |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 'disabled' => !$this->security->isGranted('move', $part), ]) |
91 | 91 | ->add('tags', TextType::class, ['required' => false, 'label' => 'part.tags', 'empty_data' => "", |
92 | 92 | 'attr' => ['data-role' => 'tagsinput'], |
93 | - 'disabled' => !$this->security->isGranted('edit', $part) ]); |
|
93 | + 'disabled' => !$this->security->isGranted('edit', $part)]); |
|
94 | 94 | |
95 | 95 | //Manufacturer section |
96 | 96 | $builder->add('manufacturer', StructuralEntityType::class, ['class' => Manufacturer::class, |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | protected function configureOptions(OptionsResolver $resolver) |
53 | 53 | { |
54 | 54 | $resolver->setDefaults([ |
55 | - 'show_prefix' => function (Options $options) { |
|
55 | + 'show_prefix' => function(Options $options) { |
|
56 | 56 | if ($options['measurement_unit'] !== null) { |
57 | 57 | /** @var MeasurementUnit $unit */ |
58 | 58 | $unit = $options['measurement_unit']; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | return true; |
62 | 62 | }, |
63 | - 'is_integer' => function (Options $options) { |
|
63 | + 'is_integer' => function(Options $options) { |
|
64 | 64 | if ($options['measurement_unit'] !== null) { |
65 | 65 | /** @var MeasurementUnit $unit */ |
66 | 66 | $unit = $options['measurement_unit']; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | return true; |
70 | 70 | }, |
71 | - 'unit' => function (Options $options) { |
|
71 | + 'unit' => function(Options $options) { |
|
72 | 72 | if ($options['measurement_unit'] !== null) { |
73 | 73 | /** @var MeasurementUnit $unit */ |
74 | 74 | $unit = $options['measurement_unit']; |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | return ''; |
78 | 78 | }, |
79 | 79 | 'decimals' => 2, |
80 | - 'error_mapping' => [ '.' => 'value'] |
|
80 | + 'error_mapping' => ['.' => 'value'] |
|
81 | 81 | ]); |
82 | 82 | |
83 | 83 | $resolver->setAllowedTypes('decimals', 'int'); |
84 | 84 | |
85 | - $resolver->setNormalizer('decimals', function (Options $options, $value) { |
|
85 | + $resolver->setNormalizer('decimals', function(Options $options, $value) { |
|
86 | 86 | // If the unit is integer based, then dont show any decimals |
87 | 87 | if ($options['is_integer']) { |
88 | 88 | return 0; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | //Otherwise just output it |
128 | - $format_string = '%.' . $options['decimals'] . 'f ' . $options['unit']; |
|
128 | + $format_string = '%.'.$options['decimals'].'f '.$options['unit']; |
|
129 | 129 | return sprintf($format_string, $value); |
130 | 130 | } |
131 | 131 | } |
132 | 132 | \ No newline at end of file |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | { |
59 | 59 | $resolver->setDefaults([ |
60 | 60 | 'measurement_unit' => null, |
61 | - 'show_prefix' => function (Options $options) { |
|
61 | + 'show_prefix' => function(Options $options) { |
|
62 | 62 | if ($options['measurement_unit'] !== null) { |
63 | 63 | /** @var MeasurementUnit $unit */ |
64 | 64 | $unit = $options['measurement_unit']; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | return true; |
68 | 68 | }, |
69 | - 'is_integer' => function (Options $options) { |
|
69 | + 'is_integer' => function(Options $options) { |
|
70 | 70 | if ($options['measurement_unit'] !== null) { |
71 | 71 | /** @var MeasurementUnit $unit */ |
72 | 72 | $unit = $options['measurement_unit']; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | return false; |
76 | 76 | }, |
77 | - 'unit' => function (Options $options) { |
|
77 | + 'unit' => function(Options $options) { |
|
78 | 78 | if ($options['measurement_unit'] !== null) { |
79 | 79 | /** @var MeasurementUnit $unit */ |
80 | 80 | $unit = $options['measurement_unit']; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | } |
83 | 83 | return null; |
84 | 84 | }, |
85 | - 'error_mapping' => [ '.' => 'value'] |
|
85 | + 'error_mapping' => ['.' => 'value'] |
|
86 | 86 | ]); |
87 | 87 | |
88 | 88 | $resolver->setAllowedTypes('measurement_unit', [MeasurementUnit::class, 'null']); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $resolver->setDefaults([ |
93 | 93 | 'min' => 0, |
94 | 94 | 'max' => '', |
95 | - 'step' => function (Options $options) { |
|
95 | + 'step' => function(Options $options) { |
|
96 | 96 | if ($options['is_integer'] === true) { |
97 | 97 | return 1; |
98 | 98 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | if ($options['show_prefix']) { |
119 | 119 | $builder->add('prefix', ChoiceType::class, [ |
120 | - 'choices' => ['M' => 6, 'k' => 3, '' => 0, 'm' => -3, 'µ' => -6 ] |
|
120 | + 'choices' => ['M' => 6, 'k' => 3, '' => 0, 'm' => -3, 'µ' => -6] |
|
121 | 121 | ]); |
122 | 122 | } |
123 | 123 |