Skip to content

Commit 40eb4d5

Browse files
Adjust ECS
1 parent 4604c7d commit 40eb4d5

18 files changed

+45
-38
lines changed

ecs.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,4 @@
2727

2828
$containerConfigurator->import(SetList::CONTROL_STRUCTURES);
2929
$containerConfigurator->import(SetList::PSR_12);
30-
$containerConfigurator->import(SetList::COMMON);
31-
$containerConfigurator->import(SetList::SYMPLIFY);
3230
};

src/Bridge/Transformer/AbstractTextInputBasedTransformer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Matthias\SymfonyConsoleForm\Bridge\Transformer;

src/Bridge/Transformer/IntegerTransformer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Matthias\SymfonyConsoleForm\Bridge\Transformer;

src/Bridge/Transformer/NumberTransformer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
declare(strict_types=1);
34

45
namespace Matthias\SymfonyConsoleForm\Bridge\Transformer;

src/Console/Command/DynamicFormBasedCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ public function formType(): string
2929

3030
protected function configure(): void
3131
{
32-
$this->setName('form:'.$this->commandName);
32+
$this->setName('form:' . $this->commandName);
3333
}
3434
}

src/Console/Command/FormBasedCommandCapabilities.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ trait FormBasedCommandCapabilities
1111
*/
1212
private $formData;
1313

14+
/**
15+
* @param mixed $data
16+
*/
17+
public function setFormData($data): void
18+
{
19+
$this->formData = $data;
20+
}
21+
1422
/**
1523
* @return mixed
1624
*/
@@ -28,12 +36,4 @@ protected function formData()
2836

2937
return $this->formData;
3038
}
31-
32-
/**
33-
* @param mixed $data
34-
*/
35-
public function setFormData($data): void
36-
{
37-
$this->formData = $data;
38-
}
3939
}

src/Console/Command/FormBasedCommandWithDefault.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types = 1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace Matthias\SymfonyConsoleForm\Console\Command;
46

src/Console/EventListener/RegisterHelpersEventListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function onConsoleCommand(ConsoleCommandEvent $event): void
2222
{
2323
$command = $event->getCommand();
2424

25-
if (null === $command) {
25+
if ($command === null) {
2626
throw new RuntimeException('Received ConsoleCommandEvent without Command instance!');
2727
}
2828

src/Console/Helper/FormHelper.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ final class FormHelper extends Helper
1818
private $formFactory;
1919
private $formInteractor;
2020

21-
public function getName(): string
22-
{
23-
return 'form';
24-
}
25-
2621
public function __construct(
2722
ConsoleFormFactory $formFactory,
2823
FormInteractor $formInteractor
@@ -31,6 +26,11 @@ public function __construct(
3126
$this->formInteractor = $formInteractor;
3227
}
3328

29+
public function getName(): string
30+
{
31+
return 'form';
32+
}
33+
3434
/**
3535
* @param mixed $data
3636
*
@@ -66,7 +66,7 @@ public function interactUsingForm(
6666
$output->write(sprintf('Invalid data provided: %s', $formErrors));
6767
if ($this->noErrorsCanBeFixed($formErrors)) {
6868
$violationPaths = $this->constraintViolationPaths($formErrors);
69-
$hint = (count($violationPaths) > 0 ? ' (Violations on unused fields: '.implode(', ', $violationPaths).')' : '');
69+
$hint = (count($violationPaths) > 0 ? ' (Violations on unused fields: ' . implode(', ', $violationPaths) . ')' : '');
7070
throw new RuntimeException(
7171
'Errors out of the form\'s scope - do you have validation constraints on properties not used in the form?'
7272
. $hint
@@ -94,9 +94,9 @@ protected function noErrorsCanBeFixed(FormErrorIterator $errors): bool
9494
{
9595
// none of the remaining errors is related to a value of a form field
9696
return $errors->count() > 0 &&
97-
0 === count(array_filter(iterator_to_array($errors), function ($error) {
97+
count(array_filter(iterator_to_array($errors), function ($error) {
9898
return $error instanceof FormErrorIterator;
99-
}));
99+
})) === 0;
100100
}
101101

102102
protected function constraintViolationPaths(FormErrorIterator $errors): array

src/Console/Helper/Question/AlwaysReturnKeyOfChoiceQuestion.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,6 @@ private function assertFlatChoiceViewsArray(array $choiceViews)
170170
*/
171171
private function canBeConvertedToString($value)
172172
{
173-
return null === $value || is_scalar($value) || (\is_object($value) && method_exists($value, '__toString'));
173+
return $value === null || is_scalar($value) || (\is_object($value) && method_exists($value, '__toString'));
174174
}
175175
}

0 commit comments

Comments
 (0)