Skip to content

Commit 131f7d2

Browse files
committed
used PHP 5.4 array syntax
1 parent efe9c43 commit 131f7d2

File tree

81 files changed

+877
-877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+877
-877
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ matrix:
1515

1616
script:
1717
- vendor/bin/tester tests -s -p php -c tests/php-unix.ini
18-
- php code-checker/src/code-checker.php -i netteForms
18+
- php temp/code-checker/src/code-checker.php --short-arrays -i netteForms
1919
- if [ $TRAVIS_PHP_VERSION == "5.6" ]; then grunt --gruntfile tests/netteForms/Gruntfile.js test; fi
2020

2121
after_failure:
@@ -25,5 +25,5 @@ after_failure:
2525
before_script:
2626
# Install Nette Tester & Code Checker
2727
- composer install --no-interaction --prefer-source
28-
- composer create-project nette/code-checker code-checker ~2.3 --no-interaction --prefer-source
28+
- composer create-project nette/code-checker temp/code-checker ~2.5 --no-interaction --prefer-source
2929
- if [ $TRAVIS_PHP_VERSION == "5.6" ]; then npm install -g grunt-cli; cd tests/netteForms; npm install; bower install; cd ../..; fi

examples/basic-example.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@
2929
$form->addText('age', 'Your age:')
3030
->setRequired('Enter your age')
3131
->addRule($form::INTEGER, 'Age must be numeric value')
32-
->addRule($form::RANGE, 'Age must be in range from %d to %d', array(10, 100));
32+
->addRule($form::RANGE, 'Age must be in range from %d to %d', [10, 100]);
3333

34-
$form->addRadioList('gender', 'Your gender:', array(
34+
$form->addRadioList('gender', 'Your gender:', [
3535
'm' => 'male',
3636
'f' => 'female',
37-
));
37+
]);
3838

39-
$form->addCheckboxList('colors', 'Favorite colors:', array(
39+
$form->addCheckboxList('colors', 'Favorite colors:', [
4040
'r' => 'red',
4141
'g' => 'green',
4242
'b' => 'blue',
43-
));
43+
]);
4444

4545
$form->addText('email', 'Email:')
4646
->setEmptyValue('@')
@@ -67,14 +67,14 @@
6767
->addConditionOn($form['send'], $form::FILLED)
6868
->setRequired('Enter your shipping address');
6969

70-
$countries = array(
71-
'World' => array(
70+
$countries = [
71+
'World' => [
7272
'bu' => 'Buranda',
7373
'qu' => 'Qumran',
7474
'st' => 'Saint Georges Island',
75-
),
75+
],
7676
'?' => 'other',
77-
);
77+
];
7878
$form->addSelect('country', 'Country:', $countries)
7979
->setPrompt('Select your country')
8080
->addConditionOn($form['send'], $form::FILLED)
@@ -106,10 +106,10 @@
106106
$form->addSubmit('submit', 'Send');
107107

108108

109-
$form->setDefaults(array(
109+
$form->setDefaults([
110110
'name' => 'John Doe',
111111
'userid' => 231,
112-
));
112+
]);
113113

114114

115115
if ($form->isSuccess()) {

examples/bootstrap2-rendering.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
$form->addText('name', 'Your name')
2424
->setRequired('Enter your name');
2525

26-
$form->addRadioList('gender', 'Your gender', array(
26+
$form->addRadioList('gender', 'Your gender', [
2727
'male', 'female',
28-
));
28+
]);
2929

30-
$form->addCheckboxList('colors', 'Favorite colors:', array(
30+
$form->addCheckboxList('colors', 'Favorite colors:', [
3131
'red', 'green', 'blue',
32-
));
32+
]);
3333

34-
$form->addSelect('country', 'Country', array(
34+
$form->addSelect('country', 'Country', [
3535
'Buranda', 'Qumran', 'Saint Georges Island',
36-
));
36+
]);
3737

3838
$form->addCheckbox('send', 'Ship to address');
3939

examples/bootstrap3-rendering.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@
2323
$form->addText('name', 'Your name')
2424
->setRequired('Enter your name');
2525

26-
$form->addRadioList('gender', 'Your gender', array(
26+
$form->addRadioList('gender', 'Your gender', [
2727
'male', 'female',
28-
));
28+
]);
2929

30-
$form->addCheckboxList('colors', 'Favorite colors:', array(
30+
$form->addCheckboxList('colors', 'Favorite colors:', [
3131
'red', 'green', 'blue',
32-
));
32+
]);
3333

34-
$form->addSelect('country', 'Country', array(
34+
$form->addSelect('country', 'Country', [
3535
'Buranda', 'Qumran', 'Saint Georges Island',
36-
));
36+
]);
3737

3838
$form->addCheckbox('send', 'Ship to address');
3939

examples/custom-control.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ public function getControl()
6666
return Html::el()
6767
->add(Html::el('input')->name($name . '[day]')->id($this->getHtmlId())->value($this->day))
6868
->add(Nette\Forms\Helpers::createSelectBox(
69-
array(1 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12),
70-
array('selected?' => $this->month)
69+
[1 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
70+
['selected?' => $this->month]
7171
)->name($name . '[month]'))
7272
->add(Html::el('input')->name($name . '[year]')->value($this->year));
7373
}

examples/custom-rendering.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@
3636
$form->addText('name', 'Your name')
3737
->setRequired('Enter your name');
3838

39-
$form->addRadioList('gender', 'Your gender', array(
39+
$form->addRadioList('gender', 'Your gender', [
4040
'm' => Html::el('option', 'male')->style('color: #248bd3'),
4141
'f' => Html::el('option', 'female')->style('color: #e948d4'),
42-
));
42+
]);
4343

44-
$form->addSelect('country', 'Country', array(
44+
$form->addSelect('country', 'Country', [
4545
'Buranda', 'Qumran', 'Saint Georges Island',
46-
));
46+
]);
4747

4848
$form->addCheckbox('send', 'Ship to address');
4949

examples/html5.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
->setType('number')
2929
->setDefaultValue(10)
3030
->addRule($form::INTEGER, 'Must be numeric value')
31-
->addRule($form::RANGE, 'Must be in range from %d to %d', array(1, 100));
31+
->addRule($form::RANGE, 'Must be in range from %d to %d', [1, 100]);
3232

3333
$form->addText('precision', 'Precision:')
3434
->setType('range')
3535
->setDefaultValue(50)
3636
->addRule($form::INTEGER, 'Precision must be numeric value')
37-
->addRule($form::RANGE, 'Precision must be in range from %d to %d', array(0, 100));
37+
->addRule($form::RANGE, 'Precision must be in range from %d to %d', [0, 100]);
3838

3939
$form->addText('email', 'Send to email:')
4040
->setType('email')

examples/localization.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ public function translate($message, $count = NULL)
4949
$form->addText('age', 'Your age:')
5050
->setRequired('Enter your age')
5151
->addRule($form::INTEGER, 'Age must be numeric value')
52-
->addRule($form::RANGE, 'Age must be in range from %d to %d', array(10, 100));
52+
->addRule($form::RANGE, 'Age must be in range from %d to %d', [10, 100]);
5353

54-
$countries = array(
55-
'World' => array(
54+
$countries = [
55+
'World' => [
5656
'bu' => 'Buranda',
5757
'qu' => 'Qumran',
5858
'st' => 'Saint Georges Island',
59-
),
59+
],
6060
'?' => 'other',
61-
);
61+
];
6262
$form->addSelect('country', 'Country:', $countries)
6363
->setPrompt('Select your country');
6464

examples/manual-rendering.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
$form->addText('age')
2424
->setRequired('Enter your age');
2525

26-
$form->addRadioList('gender', NULL, array(
26+
$form->addRadioList('gender', NULL, [
2727
'm' => 'male',
2828
'f' => 'female',
29-
));
29+
]);
3030

3131
$form->addText('email')
3232
->addCondition($form::FILLED)

src/Bridges/FormsDI/FormsExtension.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
*/
1919
class FormsExtension extends Nette\DI\CompilerExtension
2020
{
21-
public $defaults = array(
22-
'messages' => array()
23-
);
21+
public $defaults = [
22+
'messages' => []
23+
];
2424

2525

2626
public function afterCompile(Nette\PhpGenerator\ClassType $class)
@@ -30,9 +30,9 @@ public function afterCompile(Nette\PhpGenerator\ClassType $class)
3030

3131
foreach ((array) $config['messages'] as $name => $text) {
3232
if (defined('Nette\Forms\Form::' . $name)) {
33-
$initialize->addBody('Nette\Forms\Validator::$messages[Nette\Forms\Form::?] = ?;', array($name, $text));
33+
$initialize->addBody('Nette\Forms\Validator::$messages[Nette\Forms\Form::?] = ?;', [$name, $text]);
3434
} elseif (defined($name)) {
35-
$initialize->addBody('Nette\Forms\Validator::$messages[' . $name . '] = ?;', array($text));
35+
$initialize->addBody('Nette\Forms\Validator::$messages[' . $name . '] = ?;', [$text]);
3636
} else {
3737
throw new Nette\InvalidArgumentException('Constant Nette\Forms\Form::' . $name . ' or constant ' . $name . ' does not exist.');
3838
}

0 commit comments

Comments
 (0)