Skip to content

Commit 41624ee

Browse files
committed
coding style: fixes in code
1 parent 7afc088 commit 41624ee

33 files changed

+134
-130
lines changed

src/Application/Responses/FileResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ class FileResponse implements Nette\Application\IResponse
1919
{
2020
use Nette\SmartObject;
2121

22+
/** @var bool */
23+
public $resuming = true;
24+
2225
/** @var string */
2326
private $file;
2427

@@ -28,9 +31,6 @@ class FileResponse implements Nette\Application\IResponse
2831
/** @var string */
2932
private $name;
3033

31-
/** @var bool */
32-
public $resuming = true;
33-
3434
/** @var bool */
3535
private $forceDownload;
3636

src/Application/Routers/Route.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ class Route implements Application\IRouter
2626
PRESENTER_KEY = 'presenter',
2727
MODULE_KEY = 'module';
2828

29-
/** url type */
30-
private const
31-
HOST = 1,
32-
PATH = 2,
33-
RELATIVE = 3;
34-
3529
/** key used in {@link Route::$styles} or metadata {@link Route::__construct} */
3630
public const
3731
VALUE = 'value',
@@ -41,6 +35,12 @@ class Route implements Application\IRouter
4135
FILTER_TABLE = 'filterTable',
4236
FILTER_STRICT = 'filterStrict';
4337

38+
/** url type */
39+
private const
40+
HOST = 1,
41+
PATH = 2,
42+
RELATIVE = 3;
43+
4444
/** fixity types - how to handle default value? {@link Route::$metadata} */
4545
private const
4646
OPTIONAL = 0,
@@ -53,7 +53,7 @@ class Route implements Application\IRouter
5353
self::PATTERN => '[^/]+',
5454
self::FILTER_OUT => [__CLASS__, 'param2path'],
5555
],
56-
'?#' => [ // default style for query parameters
56+
'?#' => [// default style for query parameters
5757
],
5858
'module' => [
5959
self::PATTERN => '[a-z][a-z0-9.-]*',
@@ -348,7 +348,7 @@ public function constructUrl(Application\Request $appRequest, Nette\Http\Url $re
348348
}
349349
$i--;
350350

351-
$name = $sequence[$i]; $i--; // parameter name
351+
$name = $sequence[$i--]; // parameter name
352352

353353
if ($name === ']') { // opening optional part
354354
$brackets[] = $url;
@@ -523,9 +523,9 @@ private function setMask(string $mask, array $metadata): void
523523
continue;
524524
}
525525

526-
$pattern = trim($parts[$i]); $i--; // validation condition (as regexp)
527-
$default = $parts[$i]; $i--; // default value
528-
$name = $parts[$i]; $i--; // parameter name
526+
$pattern = trim($parts[$i--]); // validation condition (as regexp)
527+
$default = $parts[$i--]; // default value
528+
$name = $parts[$i--]; // parameter name
529529
array_unshift($sequence, $name);
530530

531531
if ($name[0] === '?') { // "foo" parameter

src/Application/UI/Component.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function getParameterId(string $name): string
213213

214214

215215
/** @deprecated */
216-
function getParam($name = null, $default = null)
216+
public function getParam($name = null, $default = null)
217217
{
218218
trigger_error(__METHOD__ . '() is deprecated; use getParameter() or getParameters() instead.', E_USER_DEPRECATED);
219219
return func_num_args() ? $this->getParameter($name, $default) : $this->getParameters();

src/Application/UI/ComponentReflection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ComponentReflection extends \ReflectionClass
3535
public function getPersistentParams(string $class = null): array
3636
{
3737
$class = $class === null ? $this->getName() : $class;
38-
$params = & self::$ppCache[$class];
38+
$params = &self::$ppCache[$class];
3939
if ($params !== null) {
4040
return $params;
4141
}
@@ -68,7 +68,7 @@ public function getPersistentParams(string $class = null): array
6868
public function getPersistentComponents(string $class = null): array
6969
{
7070
$class = $class === null ? $this->getName() : $class;
71-
$components = & self::$pcCache[$class];
71+
$components = &self::$pcCache[$class];
7272
if ($components !== null) {
7373
return $components;
7474
}
@@ -93,7 +93,7 @@ public function getPersistentComponents(string $class = null): array
9393
public function hasCallableMethod(string $method): bool
9494
{
9595
$class = $this->getName();
96-
$cache = & self::$mcCache[strtolower($class . ':' . $method)];
96+
$cache = &self::$mcCache[strtolower($class . ':' . $method)];
9797
if ($cache === null) {
9898
try {
9999
$cache = false;

src/Application/UI/Control.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
*/
2020
abstract class Control extends Component implements IRenderable
2121
{
22+
/** @var bool */
23+
public $snippetMode;
24+
2225
/** @var ITemplateFactory */
2326
private $templateFactory;
2427

@@ -28,9 +31,6 @@ abstract class Control extends Component implements IRenderable
2831
/** @var array */
2932
private $invalidSnippets = [];
3033

31-
/** @var bool */
32-
public $snippetMode;
33-
3434

3535
/********************* template factory ****************d*g**/
3636

src/Application/UI/Link.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function __toString(): string
9292
if (func_num_args()) {
9393
throw $e;
9494
}
95-
trigger_error("Exception in " . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
95+
trigger_error('Exception in ' . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
9696
}
9797
}
9898
}

src/Application/UI/Presenter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ abstract class Presenter extends Control implements Application\IPresenter
5050
/** @var callable[] function (Presenter $sender, IResponse $response = null); Occurs when the presenter is shutting down */
5151
public $onShutdown;
5252

53-
/** @var Nette\Application\Request|null */
54-
private $request;
55-
56-
/** @var Nette\Application\IResponse */
57-
private $response;
58-
5953
/** @var bool automatically call canonicalize() */
6054
public $autoCanonicalize = true;
6155

6256
/** @var bool use absolute Urls or paths? */
6357
public $absoluteUrls = false;
6458

59+
/** @var Nette\Application\Request|null */
60+
private $request;
61+
62+
/** @var Nette\Application\IResponse */
63+
private $response;
64+
6565
/** @var array */
6666
private $globalParams;
6767

src/Application/templates/error.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* @param int $code
66
*/
77

8+
declare(strict_types=1);
9+
810
namespace NetteModule;
911

1012
$messages = [
@@ -15,7 +17,7 @@ $messages = [
1517
410 => ['Page Not Found', 'The page you requested has been taken off the site. We apologize for the inconvenience.'],
1618
500 => ['Server Error', 'We\'re sorry! The server encountered an internal error and was unable to complete your request. Please try again later.'],
1719
];
18-
$message = isset($messages[$code]) ? $messages[$code] : $messages[0];
20+
$message = $messages[$code] ?? $messages[0];
1921

2022
?>
2123
<!DOCTYPE html><!-- "' --></textarea></script></style></pre></xmp></a></audio></button></canvas></datalist></details></dialog></iframe></listing></meter></noembed></noframes></noscript></optgroup></option></progress></rp></select></table></template></title></video>

src/Bridges/ApplicationDI/PresenterFactoryCallback.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(Nette\DI\Container $container, $invalidLinkMode, $to
3838

3939
public function __invoke($class): Nette\Application\IPresenter
4040
{
41-
$services = array_keys($this->container->findByTag('nette.presenter'), $class);
41+
$services = array_keys($this->container->findByTag('nette.presenter'), $class, true);
4242
if (count($services) > 1) {
4343
throw new Nette\Application\InvalidPresenterException("Multiple services of type $class found: " . implode(', ', $services) . '.');
4444

src/Bridges/ApplicationLatte/Template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function __toString(): string
6363
if (func_num_args()) {
6464
throw $e;
6565
}
66-
trigger_error("Exception in " . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
66+
trigger_error('Exception in ' . __METHOD__ . "(): {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", E_USER_ERROR);
6767
}
6868
}
6969

0 commit comments

Comments
 (0)