Skip to content

Commit a57a557

Browse files
committed
improved coding style
1 parent 48aa5d2 commit a57a557

File tree

62 files changed

+1004
-1004
lines changed

Some content is hidden

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

62 files changed

+1004
-1004
lines changed

examples/basic-example.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
'qu' => 'Qumran',
7474
'st' => 'Saint Georges Island',
7575
],
76-
'?' => 'other',
76+
'?' => 'other',
7777
];
7878
$form->addSelect('country', 'Country:', $countries)
7979
->setPrompt('Select your country')
@@ -107,8 +107,8 @@
107107

108108

109109
$form->setDefaults([
110-
'name' => 'John Doe',
111-
'userid' => 231,
110+
'name' => 'John Doe',
111+
'userid' => 231,
112112
]);
113113

114114

examples/localization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function translate($message, $count = NULL)
5757
'qu' => 'Qumran',
5858
'st' => 'Saint Georges Island',
5959
],
60-
'?' => 'other',
60+
'?' => 'other',
6161
];
6262
$form->addSelect('country', 'Country:', $countries)
6363
->setPrompt('Select your country');

src/Bridges/FormsDI/FormsExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class FormsExtension extends Nette\DI\CompilerExtension
2020
{
2121
public $defaults = [
22-
'messages' => []
22+
'messages' => [],
2323
];
2424

2525

src/Forms/Container.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
*/
2525
class Container extends Nette\ComponentModel\Container implements \ArrayAccess
2626
{
27-
/** @var callable[] function(Container $sender); Occurs when the form is validated */
27+
/** @var callable[] function (Container $sender); Occurs when the form is validated */
2828
public $onValidate;
2929

3030
/** @var ControlGroup */
@@ -77,7 +77,7 @@ public function setValues($values, $erase = FALSE)
7777
$control->setValue(NULL);
7878
}
7979

80-
} elseif ($control instanceof Container) {
80+
} elseif ($control instanceof self) {
8181
if (array_key_exists($name, $values)) {
8282
$control->setValues($values[$name], $erase);
8383

@@ -102,7 +102,7 @@ public function getValues($asArray = FALSE)
102102
if ($control instanceof IControl && !$control->isOmitted()) {
103103
$values[$name] = $control->getValue();
104104

105-
} elseif ($control instanceof Container) {
105+
} elseif ($control instanceof self) {
106106
$values[$name] = $control->getValues($asArray);
107107
}
108108
}
@@ -429,7 +429,7 @@ public function addImage($name, $src = NULL, $alt = NULL)
429429
*/
430430
public function addContainer($name)
431431
{
432-
$control = new Container;
432+
$control = new self;
433433
$control->currentGroup = $this->currentGroup;
434434
return $this[$name] = $control;
435435
}

src/Forms/Controls/ChoiceControl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function loadHttpData()
5959
public function setValue($value)
6060
{
6161
if ($value !== NULL && !array_key_exists((string) $value, $this->items)) {
62-
$range = Nette\Utils\Strings::truncate(implode(', ', array_map(function($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');
62+
$range = Nette\Utils\Strings::truncate(implode(', ', array_map(function ($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');
6363
throw new Nette\InvalidArgumentException("Value '$value' is out of allowed range [$range] in field '{$this->name}'.");
6464
}
6565
$this->value = $value === NULL ? NULL : key([(string) $value => NULL]);

src/Forms/Controls/MultiChoiceControl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function setValue($values)
6868
}
6969
$values = array_keys($flip);
7070
if ($diff = array_diff($values, array_keys($this->items))) {
71-
$range = Nette\Utils\Strings::truncate(implode(', ', array_map(function($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');
71+
$range = Nette\Utils\Strings::truncate(implode(', ', array_map(function ($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');
7272
$vals = (count($diff) > 1 ? 's' : '') . " '" . implode("', '", $diff) . "'";
7373
throw new Nette\InvalidArgumentException("Value$vals are out of allowed range [$range] in field '{$this->name}'.");
7474
}

src/Forms/Controls/MultiSelectBox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function getControl()
6161
$items,
6262
[
6363
'selected?' => $this->value,
64-
'disabled:' => is_array($this->disabled) ? $this->disabled : NULL
64+
'disabled:' => is_array($this->disabled) ? $this->disabled : NULL,
6565
]
6666
)->addAttributes(parent::getControl()->attrs)->multiple(TRUE);
6767
}

src/Forms/Controls/SelectBox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getControl()
9191
$items,
9292
[
9393
'selected?' => $this->value,
94-
'disabled:' => is_array($this->disabled) ? $this->disabled : NULL
94+
'disabled:' => is_array($this->disabled) ? $this->disabled : NULL,
9595
]
9696
)->addAttributes(parent::getControl()->attrs);
9797
}

src/Forms/Controls/SubmitButton.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
*/
2121
class SubmitButton extends Button implements Nette\Forms\ISubmitterControl
2222
{
23-
/** @var callable[] function(SubmitButton $sender); Occurs when the button is clicked and form is successfully validated */
23+
/** @var callable[] function (SubmitButton $sender); Occurs when the button is clicked and form is successfully validated */
2424
public $onClick;
2525

26-
/** @var callable[] function(SubmitButton $sender); Occurs when the button is clicked and form is not validated */
26+
/** @var callable[] function (SubmitButton $sender); Occurs when the button is clicked and form is not validated */
2727
public $onInvalidClick;
2828

2929
/** @var array */

src/Forms/Form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ class Form extends Container implements Nette\Utils\IHtmlString
8383
/** @internal protection token ID */
8484
const PROTECTOR_ID = '_token_';
8585

86-
/** @var callable[] function(Form $sender); Occurs when the form is submitted and successfully validated */
86+
/** @var callable[] function (Form $sender); Occurs when the form is submitted and successfully validated */
8787
public $onSuccess;
8888

89-
/** @var callable[] function(Form $sender); Occurs when the form is submitted and is not valid */
89+
/** @var callable[] function (Form $sender); Occurs when the form is submitted and is not valid */
9090
public $onError;
9191

92-
/** @var callable[] function(Form $sender); Occurs when the form is submitted */
92+
/** @var callable[] function (Form $sender); Occurs when the form is submitted */
9393
public $onSubmit;
9494

9595
/** @var mixed or NULL meaning: not detected yet */

0 commit comments

Comments
 (0)