Skip to content

Commit

Permalink
coding style: fixes in code
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jul 13, 2017
1 parent f59098e commit 85eedf2
Show file tree
Hide file tree
Showing 26 changed files with 34 additions and 36 deletions.
7 changes: 3 additions & 4 deletions examples/custom-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
class DateInput extends Nette\Forms\Controls\BaseControl
{
/** @var string */
private
$day = '',
$month = '',
$year = '';
private $day = '';
private $month = '';
private $year = '';


public function __construct($label = null)
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// Define custom validator
class MyValidators
{
static function divisibilityValidator($item, $arg)
public static function divisibilityValidator($item, $arg)
{
return $item->value % $arg === 0;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MyTranslator implements Nette\Localization\ITranslator
private $table;


function __construct(array $table)
public function __construct(array $table)
{
$this->table = $table;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bridges/FormsLatte/FormMacros.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function macroNameEnd(MacroNode $node, PhpWriter $writer)
$node->innerContent .= '<?php echo Nette\Bridges\FormsLatte\Runtime::renderFormEnd(array_pop($this->global->formsStack), false); ?>';
} elseif ($tagName === 'label') {
if ($node->htmlNode->empty) {
$node->innerContent = "<?php echo \$_input->getLabelPart()->getHtml() ?>";
$node->innerContent = '<?php echo $_input->getLabelPart()->getHtml() ?>';
}
} elseif ($tagName === 'button') {
if ($node->htmlNode->empty) {
Expand Down
6 changes: 3 additions & 3 deletions src/Forms/Controls/BaseControl.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ abstract class BaseControl extends Nette\ComponentModel\Component implements ICo
/** @var Html label element template */
protected $label;

/** @var array */
private $errors = [];

/** @var bool */
protected $disabled = false;

/** @var array */
private $errors = [];

/** @var bool|null */
private $omitted;

Expand Down
10 changes: 5 additions & 5 deletions src/Forms/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ class Form extends Container implements Nette\Utils\IHtmlString
/** @var callable[] function (Form $sender); Occurs before the form is rendered */
public $onRender;

/** @var Nette\Http\IRequest used only by standalone form */
public $httpRequest;

/** @var mixed or null meaning: not detected yet */
private $submittedBy;

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

/** @var Nette\Http\IRequest used only by standalone form */
public $httpRequest;

/** @var bool */
private $beforeRenderCalled;

Expand Down Expand Up @@ -667,14 +667,14 @@ public function __toString()
$this->fireRenderEvents();
return $this->getRenderer()->render($this);

} catch (\Throwable $e) {
} catch (\Exception $e) {
} catch (\Throwable $e) {
}
if (isset($e)) {
if (func_num_args()) {
throw $e;
}
trigger_error("Exception in " . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
trigger_error('Exception in ' . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/Forms/Rendering/DefaultFormRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class DefaultFormRenderer implements Nette\Forms\IFormRenderer
* \---
* \---
* \--
*
* @var array of HTML tags */
public $wrappers = [
'form' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Forms/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,4 @@ private static function getCallback(Rule $rule)
}
}

Rules::$defaultMessages = & Validator::$messages;
Rules::$defaultMessages = &Validator::$messages;
4 changes: 2 additions & 2 deletions tests/Forms.Latte/FormMacros.forms.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ require __DIR__ . '/../bootstrap.php';

class MyControl extends Nette\Forms\Controls\BaseControl
{
function getLabel($c = null)
public function getLabel($c = null)
{
return '<label>My</label>';
}


function getControl()
public function getControl()
{
return '<input name=My>';
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.Button.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.Checkbox.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.CheckboxList.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.HiddenField.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.ImageButton.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.MultiSelectBox.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.RadioList.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.SelectBox.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.TextArea.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.TextInput.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.UploadControl.render.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements Nette\Localization\ITranslator
{
function translate($s, $plural = null)
public function translate($s, $plural = null)
{
return strtoupper($s);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Controls.translate().phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements \Nette\Localization\ITranslator
{
function translate($message, $count = null)
public function translate($message, $count = null)
{
return is_object($message) ? get_class($message) : $message;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Forms.renderer.1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require __DIR__ . '/../bootstrap.php';


$_SERVER['REQUEST_METHOD'] = 'POST';
$_POST = ['name' => 'John Doe ','age' => '','email' => ' @ ','send' => 'on','street' => '','city' => '','country' => 'HU','password' => 'xxx','password2' => '','note' => '','submit1' => 'Send','userid' => '231'];
$_POST = ['name' => 'John Doe ', 'age' => '', 'email' => ' @ ', 'send' => 'on', 'street' => '', 'city' => '', 'country' => 'HU', 'password' => 'xxx', 'password2' => '', 'note' => '', 'submit1' => 'Send', 'userid' => '231'];


$countries = [
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Forms.renderer.2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require __DIR__ . '/../bootstrap.php';


$_SERVER['REQUEST_METHOD'] = 'POST';
$_POST = ['name' => 'John Doe ','age' => '9.9','email' => '@','street' => '','city' => 'Troubsko','country' => '0','password' => 'xx','password2' => 'xx','note' => '','submit1' => 'Send','userid' => '231'];
$_POST = ['name' => 'John Doe ', 'age' => '9.9', 'email' => '@', 'street' => '', 'city' => 'Troubsko', 'country' => '0', 'password' => 'xx', 'password2' => 'xx', 'note' => '', 'submit1' => 'Send', 'userid' => '231'];


$countries = [
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Forms.renderer.translate.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';

class Translator implements ITranslator
{
function translate($message, $count = null)
public function translate($message, $count = null)
{
return strtoupper($message);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Forms/Helpers.exportRules.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test(function () {
$input = $form->addText('text');
$input->addRule(Form::EMAIL);
Assert::same([
['op' => ':email', 'msg' => 'Please enter a valid email address.']
['op' => ':email', 'msg' => 'Please enter a valid email address.'],
], Helpers::exportRules($input->getRules()));
});

Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function before(\Closure $function = null)
{
static $val;
if (!func_num_args()) {
return ($val ? $val() : null);
return $val ? $val() : null;
}
$val = $function;
}
Expand Down

0 comments on commit 85eedf2

Please sign in to comment.