Skip to content

Commit 85eedf2

Browse files
committed
coding style: fixes in code
1 parent f59098e commit 85eedf2

26 files changed

+34
-36
lines changed

examples/custom-control.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
class DateInput extends Nette\Forms\Controls\BaseControl
1818
{
1919
/** @var string */
20-
private
21-
$day = '',
22-
$month = '',
23-
$year = '';
20+
private $day = '';
21+
private $month = '';
22+
private $year = '';
2423

2524

2625
public function __construct($label = null)

examples/custom-validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
// Define custom validator
2020
class MyValidators
2121
{
22-
static function divisibilityValidator($item, $arg)
22+
public static function divisibilityValidator($item, $arg)
2323
{
2424
return $item->value % $arg === 0;
2525
}

examples/localization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MyTranslator implements Nette\Localization\ITranslator
2222
private $table;
2323

2424

25-
function __construct(array $table)
25+
public function __construct(array $table)
2626
{
2727
$this->table = $table;
2828
}

src/Bridges/FormsLatte/FormMacros.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public function macroNameEnd(MacroNode $node, PhpWriter $writer)
205205
$node->innerContent .= '<?php echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack), false); ?>';
206206
} elseif ($tagName === 'label') {
207207
if ($node->htmlNode->empty) {
208-
$node->innerContent = "<?php echo \$_input->getLabelPart()->getHtml() ?>";
208+
$node->innerContent = '<?php echo $_input->getLabelPart()->getHtml() ?>';
209209
}
210210
} elseif ($tagName === 'button') {
211211
if ($node->htmlNode->empty) {

src/Forms/Controls/BaseControl.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ abstract class BaseControl extends Nette\ComponentModel\Component implements ICo
5050
/** @var Html label element template */
5151
protected $label;
5252

53-
/** @var array */
54-
private $errors = [];
55-
5653
/** @var bool */
5754
protected $disabled = false;
5855

56+
/** @var array */
57+
private $errors = [];
58+
5959
/** @var bool|null */
6060
private $omitted;
6161

src/Forms/Form.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ class Form extends Container implements Nette\Utils\IHtmlString
9393
/** @var callable[] function (Form $sender); Occurs before the form is rendered */
9494
public $onRender;
9595

96+
/** @var Nette\Http\IRequest used only by standalone form */
97+
public $httpRequest;
98+
9699
/** @var mixed or null meaning: not detected yet */
97100
private $submittedBy;
98101

@@ -114,9 +117,6 @@ class Form extends Container implements Nette\Utils\IHtmlString
114117
/** @var array */
115118
private $errors = [];
116119

117-
/** @var Nette\Http\IRequest used only by standalone form */
118-
public $httpRequest;
119-
120120
/** @var bool */
121121
private $beforeRenderCalled;
122122

@@ -667,14 +667,14 @@ public function __toString()
667667
$this->fireRenderEvents();
668668
return $this->getRenderer()->render($this);
669669

670-
} catch (\Throwable $e) {
671670
} catch (\Exception $e) {
671+
} catch (\Throwable $e) {
672672
}
673673
if (isset($e)) {
674674
if (func_num_args()) {
675675
throw $e;
676676
}
677-
trigger_error("Exception in " . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
677+
trigger_error('Exception in ' . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
678678
}
679679
}
680680

src/Forms/Rendering/DefaultFormRenderer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class DefaultFormRenderer implements Nette\Forms\IFormRenderer
5454
* \---
5555
* \---
5656
* \--
57-
*
5857
* @var array of HTML tags */
5958
public $wrappers = [
6059
'form' => [

src/Forms/Rules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,4 +344,4 @@ private static function getCallback(Rule $rule)
344344
}
345345
}
346346

347-
Rules::$defaultMessages = & Validator::$messages;
347+
Rules::$defaultMessages = &Validator::$messages;

tests/Forms.Latte/FormMacros.forms.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ require __DIR__ . '/../bootstrap.php';
1414

1515
class MyControl extends Nette\Forms\Controls\BaseControl
1616
{
17-
function getLabel($c = null)
17+
public function getLabel($c = null)
1818
{
1919
return '<label>My</label>';
2020
}
2121

2222

23-
function getControl()
23+
public function getControl()
2424
{
2525
return '<input name=My>';
2626
}

tests/Forms/Controls.Button.render.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';
1414

1515
class Translator implements Nette\Localization\ITranslator
1616
{
17-
function translate($s, $plural = null)
17+
public function translate($s, $plural = null)
1818
{
1919
return strtoupper($s);
2020
}

0 commit comments

Comments
 (0)