Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit cf06a45

Browse files
authored
Merge pull request #14 from codete/bump-php
Bump PHP requirement to 5.6
2 parents 2ac0276 + ab6dfb4 commit cf06a45

17 files changed

+89
-95
lines changed

.travis.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
language: php
22

33
php:
4-
- 5.3
5-
- 5.4
6-
- 5.5
74
- 5.6
5+
- 7.0
86
- hhvm
97

108
env:
@@ -19,16 +17,11 @@ matrix:
1917
- env: SYMFONY_VERSION=dev-master
2018
- php: hhvm
2119
include:
22-
- php: 5.5
23-
env: SYMFONY_VERSION=2.7.*
24-
- php: 5.5
25-
env: SYMFONY_VERSION=2.8.*
2620
- php: 5.6
2721
env: SYMFONY_VERSION=2.8.*
28-
- php: 5.5
29-
env: SYMFONY_VERSION=3.0.*
3022
- php: 5.6
3123
env: SYMFONY_VERSION=3.0.*
24+
- php: 5.6
25+
env: SYMFONY_VERSION=3.1.*
3226
- php: 7.0
33-
env: SYMFONY_VERSION=3.0.*
34-
27+
env: SYMFONY_VERSION=3.1.*

Annotations/Form.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class Form extends \Doctrine\Common\Annotations\Annotation
1212
{
13-
private $forms = array();
13+
private $forms = [];
1414

1515
public function __set($name, $value)
1616
{
@@ -21,7 +21,7 @@ public function getForm($form)
2121
{
2222
if (!isset($this->forms[$form])) {
2323
if ($form === 'default') {
24-
return array();
24+
return [];
2525
}
2626
throw new \InvalidArgumentException("Unknown form '$form'");
2727
}

DependencyInjection/Compiler/ConfigurationModifiersCompilerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function process(ContainerBuilder $container)
2626
}
2727
$formGenerator->addMethodCall(
2828
'addFormConfigurationModifier',
29-
array(new Reference($id), (int) $attributes['priority'])
29+
[new Reference($id), (int) $attributes['priority']]
3030
);
3131
}
3232
}

DependencyInjection/Compiler/FieldResolversCompilerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function process(ContainerBuilder $container)
2626
}
2727
$formGenerator->addMethodCall(
2828
'addFormFieldResolver',
29-
array(new Reference($id), (int) $attributes['priority'])
29+
[new Reference($id), (int) $attributes['priority']]
3030
);
3131
}
3232
}

DependencyInjection/Compiler/ViewProvidersCompilerPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function process(ContainerBuilder $container)
2626
}
2727
$formGenerator->addMethodCall(
2828
'addFormViewProvider',
29-
array(new Reference($id), (int) $attributes['priority'])
29+
[new Reference($id), (int) $attributes['priority']]
3030
);
3131
}
3232
}

FieldTypeMapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ class FieldTypeMapper
66
{
77
private static $typeFQCN = null;
88

9-
private static $typeNS = array(
9+
private static $typeNS = [
1010
'Symfony\\Component\\Form\\Extension\\Core\\Type',
1111
'Symfony\\Bridge\\Doctrine\\Form\\Type',
12-
);
12+
];
1313

1414
/**
1515
* @param string $type

FormGenerator.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ class FormGenerator
2121
private $formFactory;
2222

2323
/** @var FormConfigurationModifierInterface[][] */
24-
private $formConfigurationModifiers = array();
24+
private $formConfigurationModifiers = [];
2525

2626
/** @var FormFieldResolverInterface[][] */
27-
private $formFieldResolvers = array();
27+
private $formFieldResolvers = [];
2828

2929
/** @var FormViewProviderInterface[][] */
30-
private $formViewProviders = array();
30+
private $formViewProviders = [];
3131

3232
/** @var bool */
3333
private $needsSorting = false;
3434

3535
/** @var FormConfigurationModifierInterface[] */
36-
private $sortedFormConfigurationModifiers = array();
36+
private $sortedFormConfigurationModifiers = [];
3737

3838
/** @var FormFieldResolverInterface[] */
39-
private $sortedFormFieldResolvers = array();
39+
private $sortedFormFieldResolvers = [];
4040

4141
/** @var FormViewProviderInterface[] */
42-
private $sortedFormViewProviders = array();
42+
private $sortedFormViewProviders = [];
4343

4444
public function __construct(FormFactoryInterface $formFactory)
4545
{
@@ -91,7 +91,7 @@ public function addFormViewProvider(FormViewProviderInterface $provider, $priori
9191
* @param array $context
9292
* @return FormBuilderInterface
9393
*/
94-
public function createFormBuilder($model, $form = 'default', $context = array())
94+
public function createFormBuilder($model, $form = 'default', $context = [])
9595
{
9696
$fb = $this->formFactory->createBuilder(FieldTypeMapper::map('form'), $model);
9797

@@ -108,7 +108,7 @@ public function createFormBuilder($model, $form = 'default', $context = array())
108108
* @param array $context
109109
* @return FormBuilderInterface
110110
*/
111-
public function createNamedFormBuilder($name, $model, $form = 'default', $context = array())
111+
public function createNamedFormBuilder($name, $model, $form = 'default', $context = [])
112112
{
113113
$fb = $this->formFactory->createNamedBuilder($name, FieldTypeMapper::map('form'), $model);
114114

@@ -124,7 +124,7 @@ public function createNamedFormBuilder($name, $model, $form = 'default', $contex
124124
* @param string $form view to generate
125125
* @param array $context
126126
*/
127-
public function populateFormBuilder(FormBuilderInterface $fb, $model, $form = 'default', $context = array())
127+
public function populateFormBuilder(FormBuilderInterface $fb, $model, $form = 'default', $context = [])
128128
{
129129
if ($this->needsSorting) {
130130
$this->sortRegisteredServices();
@@ -169,9 +169,9 @@ public function populateFormBuilder(FormBuilderInterface $fb, $model, $form = 'd
169169
* @param array $fields
170170
* @return array
171171
*/
172-
private function getFieldsConfiguration($model, $fields = array())
172+
private function getFieldsConfiguration($model, $fields = [])
173173
{
174-
$configuration = $properties = array();
174+
$configuration = $properties = [];
175175
$ro = new \ReflectionObject($model);
176176
if (empty($fields)) {
177177
$properties = $ro->getProperties();
@@ -219,7 +219,7 @@ private function getFields($model, $form)
219219
}
220220
}
221221
if ($formAnnotation === null) {
222-
$formAnnotation = new Annotations\Form(array());
222+
$formAnnotation = new Annotations\Form([]);
223223
}
224224
return $formAnnotation->getForm($form);
225225
}
@@ -232,12 +232,12 @@ private function getFields($model, $form)
232232
*/
233233
private function normalizeFields($_fields)
234234
{
235-
$fields = array();
235+
$fields = [];
236236
foreach ($_fields as $key => $value) {
237237
if (is_array($value)) {
238238
$fields[$key] = $value;
239239
} else {
240-
$fields[$value] = array();
240+
$fields[$value] = [];
241241
}
242242
}
243243
return $fields;

Tests/Annotations/FormTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ class FormTest extends \PHPUnit_Framework_TestCase
88
{
99
public function testDefaultAlwaysExists()
1010
{
11-
$f = new Form(array());
12-
$this->assertSame(array(), $f->getForm('default'));
11+
$f = new Form([]);
12+
$this->assertSame([], $f->getForm('default'));
1313
}
1414

1515
public function testDefaultCanBeOverwritten()
1616
{
17-
$d = array('foo' => 'bar');
18-
$f = new Form(array('default' => $d));
17+
$d = ['foo' => 'bar'];
18+
$f = new Form(['default' => $d]);
1919
$this->assertSame($d, $f->getForm('default'));
2020
}
2121

@@ -25,14 +25,14 @@ public function testDefaultCanBeOverwritten()
2525
*/
2626
public function testUnknownFormThrowsException()
2727
{
28-
$f = new Form(array());
28+
$f = new Form([]);
2929
$f->getForm('foo');
3030
}
3131

3232
public function testNonDefaultForm()
3333
{
34-
$foo = array('foo' => 'bar', 'baz');
35-
$f = new Form(array('foo' => $foo));
34+
$foo = ['foo' => 'bar', 'baz'];
35+
$f = new Form(['foo' => $foo]);
3636
$this->assertSame($foo, $f->getForm('foo'));
3737
}
3838
}

Tests/BaseTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ abstract class BaseTest extends \PHPUnit_Framework_TestCase
1414
public function setUp()
1515
{
1616
$loader = require __DIR__.'/../vendor/autoload.php';
17-
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
17+
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
1818
$this->formGenerator = new FormGenerator(
1919
Forms::createFormFactoryBuilder()->getFormFactory()
2020
);

Tests/CodeteFormGeneratorBundleTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public function testIfCompilerPassesAreLoaded()
1414
$container->expects($this->exactly(3))
1515
->method('addCompilerPass')
1616
->withConsecutive(
17-
array($this->isInstanceOf('Codete\FormGeneratorBundle\DependencyInjection\Compiler\ConfigurationModifiersCompilerPass')),
18-
array($this->isInstanceOf('Codete\FormGeneratorBundle\DependencyInjection\Compiler\FieldResolversCompilerPass')),
19-
array($this->isInstanceOf('Codete\FormGeneratorBundle\DependencyInjection\Compiler\ViewProvidersCompilerPass'))
17+
[$this->isInstanceOf('Codete\FormGeneratorBundle\DependencyInjection\Compiler\ConfigurationModifiersCompilerPass')],
18+
[$this->isInstanceOf('Codete\FormGeneratorBundle\DependencyInjection\Compiler\FieldResolversCompilerPass')],
19+
[$this->isInstanceOf('Codete\FormGeneratorBundle\DependencyInjection\Compiler\ViewProvidersCompilerPass')]
2020
);
2121
$bundle = new CodeteFormGeneratorBundle();
2222
$bundle->build($container);

0 commit comments

Comments
 (0)