Skip to content

Commit 8554cdf

Browse files
End support of Symfony <2.8
1 parent cca0cd4 commit 8554cdf

26 files changed

+79
-212
lines changed

.travis.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ matrix:
1010
allow_failures:
1111
- php: hhvm
1212
include:
13-
- php: 5.5
14-
env: SYMFONY_VERSION=2.5.*
15-
- php: 5.5
16-
env: SYMFONY_VERSION=2.7.*
1713
- php: 5.5
1814
env: SYMFONY_VERSION=2.8.*
1915
- php: 5.5
@@ -39,12 +35,7 @@ install:
3935

4036
script:
4137
- vendor/bin/php-cs-fixer fix -v --diff --dry-run
42-
- >
43-
if [ "$SYMFONY_VERSION" == "2.5.*" ]; then
44-
vendor/bin/behat --tags=~symfony27
45-
else
46-
vendor/bin/behat
47-
fi
38+
- vendor/bin/behat
4839

4940
notifications:
5041

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@
2424
},
2525
"require": {
2626
"php": ">=5.5",
27-
"symfony/form": "~2.5|~3.0",
28-
"symfony/console": "~2.5|~3.0"
27+
"symfony/form": "~2.8|~3.0",
28+
"symfony/console": "~2.8|~3.0"
2929
},
3030
"require-dev": {
3131
"beberlei/assert": "~2.1",
3232
"behat/behat": "~3.0",
3333
"fabpot/php-cs-fixer": "^1.10",
34-
"symfony/console": "~2.5|~3.0",
35-
"symfony/finder": "~2.5|~3.0",
36-
"symfony/form": "~2.5|~3.0",
37-
"symfony/framework-bundle": "~2.5|~3.0",
38-
"symfony/validator": "~2.5|~3.0",
39-
"symfony/yaml": "~2.5|~3.0"
34+
"symfony/console": "~2.8|~3.0",
35+
"symfony/finder": "~2.8|~3.0",
36+
"symfony/form": "~2.8|~3.0",
37+
"symfony/framework-bundle": "~2.8|~3.0",
38+
"symfony/validator": "~2.8|~3.0",
39+
"symfony/yaml": "~2.8|~3.0"
4040
}
4141
}

features/interactive.feature

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ Feature: It is possible to interactively fill in a form from the CLI
7373
)
7474
"""
7575

76-
@symfony27
7776
Scenario: Select a value
7877
When I run the command "form:color_with_choices_as_values" and I provide as input
7978
"""
@@ -92,7 +91,6 @@ Feature: It is possible to interactively fill in a form from the CLI
9291
)
9392
"""
9493

95-
@symfony27
9694
Scenario: Select a value by its underlying data
9795
When I run the command "form:color_with_choices_as_values" and I provide as input
9896
"""

src/Bridge/FormFactory/ConsoleFormFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Symfony\Component\Console\Input\InputInterface;
66
use Symfony\Component\Form\FormInterface;
7+
use Symfony\Component\Form\FormTypeInterface;
78

89
interface ConsoleFormFactory
910
{

src/Bridge/FormFactory/ConsoleFormWithDefaultValuesAndOptionsFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Matthias\SymfonyConsoleForm\Bridge\FormFactory;
44

5-
use Matthias\SymfonyConsoleForm\LegacyFormHelper;
65
use Symfony\Component\Console\Input\InputInterface;
76
use Symfony\Component\Form\Extension\Core\Type\FormType;
87
use Symfony\Component\Form\Extension\Csrf\Type\FormTypeCsrfExtension;
98
use Symfony\Component\Form\FormFactoryInterface;
109
use Symfony\Component\Form\FormRegistryInterface;
10+
use Symfony\Component\Form\FormTypeInterface;
1111
use Symfony\Component\Form\Test\FormBuilderInterface;
1212

1313
class ConsoleFormWithDefaultValuesAndOptionsFactory implements ConsoleFormFactory
@@ -72,7 +72,7 @@ private function addDefaultOptions(array $options)
7272
$defaultOptions = [];
7373
// hack to prevent validation error "The CSRF token is invalid."
7474
foreach ($this->formRegistry->getExtensions() as $extension) {
75-
foreach ($extension->getTypeExtensions(LegacyFormHelper::getType(FormType::class)) as $typeExtension) {
75+
foreach ($extension->getTypeExtensions(FormType::class) as $typeExtension) {
7676
if ($typeExtension instanceof FormTypeCsrfExtension) {
7777
$defaultOptions['csrf_protection'] = false;
7878
}

src/Bridge/Interaction/CollectionInteractor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Symfony\Component\Console\Input\InputInterface;
1212
use Symfony\Component\Console\Output\OutputInterface;
1313
use Symfony\Component\Console\Question\ConfirmationQuestion;
14+
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
1415
use Symfony\Component\Form\FormInterface;
1516

1617
class CollectionInteractor implements FormInteractor
@@ -49,7 +50,7 @@ public function interactWith(
4950
throw new CanNotInteractWithForm('This interactor only works with interactive input');
5051
}
5152

52-
if (!FormUtil::isTypeInAncestry($form, 'collection')) {
53+
if (!FormUtil::isTypeInAncestry($form, CollectionType::class)) {
5354
throw new CanNotInteractWithForm('Expected a "collection" form');
5455
}
5556

src/Bridge/Interaction/FieldWithNoInteractionInteractor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use Matthias\SymfonyConsoleForm\Bridge\Interaction\Exception\CanNotInteractWithForm;
66
use Matthias\SymfonyConsoleForm\Bridge\Interaction\Exception\NoNeedToInteractWithForm;
77
use Matthias\SymfonyConsoleForm\Form\FormUtil;
8-
use Matthias\SymfonyConsoleForm\LegacyFormHelper;
98
use Symfony\Component\Console\Helper\HelperSet;
109
use Symfony\Component\Console\Input\InputInterface;
1110
use Symfony\Component\Console\Output\OutputInterface;
@@ -29,7 +28,7 @@ public function interactWith(
2928
InputInterface $input,
3029
OutputInterface $output
3130
) {
32-
if (FormUtil::isTypeInAncestry($form, LegacyFormHelper::getType(ButtonType::class))) {
31+
if (FormUtil::isTypeInAncestry($form, ButtonType::class)) {
3332
throw new NoNeedToInteractWithForm();
3433
}
3534

src/Bridge/Transformer/ChoiceTransformer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Matthias\SymfonyConsoleForm\Bridge\Transformer;
44

55
use Matthias\SymfonyConsoleForm\Console\Helper\Question\AlwaysReturnKeyOfChoiceQuestion;
6+
use Symfony\Component\Console\Question\Question;
67
use Symfony\Component\Form\Form;
78

89
class ChoiceTransformer extends AbstractTransformer

src/Bridge/Transformer/TypeAncestryBasedTransformerResolver.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Matthias\SymfonyConsoleForm\Bridge\Transformer\Exception\CouldNotResolveTransformer;
66
use Matthias\SymfonyConsoleForm\Form\FormUtil;
7-
use Matthias\SymfonyConsoleForm\LegacyFormHelper;
87
use Symfony\Component\Form\FormInterface;
98

109
class TypeAncestryBasedTransformerResolver implements TransformerResolver
@@ -20,7 +19,7 @@ class TypeAncestryBasedTransformerResolver implements TransformerResolver
2019
*/
2120
public function addTransformer($formType, FormToQuestionTransformer $transformer)
2221
{
23-
$this->transformers[LegacyFormHelper::getType($formType)] = $transformer;
22+
$this->transformers[$formType] = $transformer;
2423
}
2524

2625
/**

src/Console/Command/DynamicFormBasedCommand.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Matthias\SymfonyConsoleForm\Console\Command;
44

5-
use Matthias\SymfonyConsoleForm\LegacyFormHelper;
6-
75
abstract class DynamicFormBasedCommand extends InteractiveFormCommand implements FormBasedCommand
86
{
97
/**
@@ -14,16 +12,16 @@ abstract class DynamicFormBasedCommand extends InteractiveFormCommand implements
1412
/**
1513
* @var string
1614
*/
17-
private $formTypeName;
15+
private $commandName;
1816

1917
/**
2018
* @param string $formType
21-
* @param string $formTypeName
19+
* @param string $commandName
2220
*/
23-
public function __construct($formType, $formTypeName)
21+
public function __construct($formType, $commandName)
2422
{
2523
$this->formType = $formType;
26-
$this->formTypeName = $formTypeName;
24+
$this->commandName = $commandName;
2725

2826
parent::__construct();
2927
}
@@ -33,14 +31,14 @@ public function __construct($formType, $formTypeName)
3331
*/
3432
public function formType()
3533
{
36-
return LegacyFormHelper::getType($this->formType, $this->formTypeName);
34+
return $this->formType;
3735
}
3836

3937
/**
4038
* @return string
4139
*/
4240
protected function configure()
4341
{
44-
$this->setName('form:'.$this->formTypeName);
42+
$this->setName('form:'.$this->commandName);
4543
}
4644
}

0 commit comments

Comments
 (0)