Skip to content

Commit 696a57f

Browse files
committed
coding style: fixes in code
1 parent a16ae63 commit 696a57f

26 files changed

+41
-43
lines changed

examples/custom-control.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
class DateInput extends Nette\Forms\Controls\BaseControl
2020
{
2121
/** @var string */
22-
private
23-
$day = '',
24-
$month = '',
25-
$year = '';
22+
private $day = '';
23+
private $month = '';
24+
private $year = '';
2625

2726

2827
public function __construct($label = null)

examples/custom-validator.php

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

examples/localization.php

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

2626

27-
function __construct(array $table)
27+
public function __construct(array $table)
2828
{
2929
$this->table = $table;
3030
}

src/Bridges/FormsLatte/FormMacros.php

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

src/Forms/Container.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
*/
2222
class Container extends Nette\ComponentModel\Container implements \ArrayAccess
2323
{
24-
/** @var callable[] extension methods */
25-
private static $extMethods = [];
26-
2724
/** @var callable[] function (Container $sender); Occurs when the form is validated */
2825
public $onValidate;
2926

3027
/** @var ControlGroup|null */
3128
protected $currentGroup;
3229

30+
/** @var callable[] extension methods */
31+
private static $extMethods = [];
32+
3333
/** @var bool */
3434
private $validated;
3535

src/Forms/Controls/BaseControl.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ abstract class BaseControl extends Nette\ComponentModel\Component implements ICo
4141
/** @var string */
4242
public static $idMask = 'frm-%s';
4343

44-
/** @var callable[][] extension methods */
45-
private static $extMethods = [];
46-
47-
/** @var string|object textual caption or label */
48-
private $caption;
49-
5044
/** @var mixed current control value */
5145
protected $value;
5246

@@ -56,12 +50,18 @@ abstract class BaseControl extends Nette\ComponentModel\Component implements ICo
5650
/** @var Html label element template */
5751
protected $label;
5852

59-
/** @var array */
60-
private $errors = [];
61-
6253
/** @var bool */
6354
protected $disabled = false;
6455

56+
/** @var callable[][] extension methods */
57+
private static $extMethods = [];
58+
59+
/** @var string|object textual caption or label */
60+
private $caption;
61+
62+
/** @var array */
63+
private $errors = [];
64+
6565
/** @var bool|null */
6666
private $omitted;
6767

src/Forms/Form.php

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

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

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

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

@@ -629,7 +629,7 @@ public function __toString(): string
629629
if (func_num_args()) {
630630
throw $e;
631631
}
632-
trigger_error("Exception in " . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
632+
trigger_error('Exception in ' . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
633633
}
634634
}
635635

src/Forms/Rendering/DefaultFormRenderer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class DefaultFormRenderer implements Nette\Forms\IFormRenderer
5656
* \---
5757
* \---
5858
* \--
59-
*
6059
* @var array of HTML tags */
6160
public $wrappers = [
6261
'form' => [

tests/Forms.Latte/FormMacros.forms.phpt

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

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

2424

25-
function getControl()
25+
public function getControl()
2626
{
2727
return '<input name=My>';
2828
}

tests/Forms/Controls.Button.render.phpt

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

1717
class Translator implements Nette\Localization\ITranslator
1818
{
19-
function translate($s, int $count = null): string
19+
public function translate($s, int $count = null): string
2020
{
2121
return strtoupper($s);
2222
}

0 commit comments

Comments
 (0)