Skip to content

Commit ccc9495

Browse files
committed
coding style: TRUE/FALSE/NULL -> true/false/null
1 parent cd9c2a0 commit ccc9495

File tree

91 files changed

+646
-646
lines changed

Some content is hidden

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

91 files changed

+646
-646
lines changed

src/Application/Application.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Application
3131
/** @var callable[] function (Application $sender); Occurs before the application loads presenter */
3232
public $onStartup;
3333

34-
/** @var callable[] function (Application $sender, \Throwable $e = NULL); Occurs before the application shuts down */
34+
/** @var callable[] function (Application $sender, \Throwable $e = null); Occurs before the application shuts down */
3535
public $onShutdown;
3636

3737
/** @var callable[] function (Application $sender, Request $request); Occurs when a new request is received */
@@ -49,7 +49,7 @@ class Application
4949
/** @var Request[] */
5050
private $requests = [];
5151

52-
/** @var IPresenter|NULL */
52+
/** @var IPresenter|null */
5353
private $presenter;
5454

5555
/** @var Nette\Http\IRequest */
@@ -147,13 +147,13 @@ public function processRequest(Request $request): void
147147
public function processException(\Throwable $e): void
148148
{
149149
if (!$e instanceof BadRequestException && $this->httpResponse instanceof Nette\Http\Response) {
150-
$this->httpResponse->warnOnBuffer = FALSE;
150+
$this->httpResponse->warnOnBuffer = false;
151151
}
152152
if (!$this->httpResponse->isSent()) {
153153
$this->httpResponse->setCode($e instanceof BadRequestException ? ($e->getHttpCode() ?: 404) : 500);
154154
}
155155

156-
$args = ['exception' => $e, 'request' => end($this->requests) ?: NULL];
156+
$args = ['exception' => $e, 'request' => end($this->requests) ?: null];
157157
if ($this->presenter instanceof UI\Presenter) {
158158
try {
159159
$this->presenter->forward(":$this->errorPresenter:", $args);

src/Application/ErrorPresenter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ class ErrorPresenter implements Application\IPresenter
2121
{
2222
use Nette\SmartObject;
2323

24-
/** @var ILogger|NULL */
24+
/** @var ILogger|null */
2525
private $logger;
2626

2727

28-
public function __construct(ILogger $logger = NULL)
28+
public function __construct(ILogger $logger = null)
2929
{
3030
$this->logger = $logger;
3131
}

src/Application/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Helpers
2525
public static function splitName(string $name): array
2626
{
2727
$pos = strrpos($name, ':');
28-
return $pos === FALSE
28+
return $pos === false
2929
? ['', $name, '']
3030
: [substr($name, 0, $pos), substr($name, $pos + 1), ':'];
3131
}

src/Application/LinkGenerator.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class LinkGenerator
2525
/** @var Nette\Http\Url */
2626
private $refUrl;
2727

28-
/** @var IPresenterFactory|NULL */
28+
/** @var IPresenterFactory|null */
2929
private $presenterFactory;
3030

3131

32-
public function __construct(IRouter $router, Nette\Http\Url $refUrl, IPresenterFactory $presenterFactory = NULL)
32+
public function __construct(IRouter $router, Nette\Http\Url $refUrl, IPresenterFactory $presenterFactory = null)
3333
{
3434
$this->router = $router;
3535
$this->refUrl = $refUrl;
@@ -50,7 +50,7 @@ public function link(string $dest, array $params = []): string
5050
[, $presenter, $action, $frag] = $m;
5151

5252
try {
53-
$class = $this->presenterFactory ? $this->presenterFactory->getPresenterClass($presenter) : NULL;
53+
$class = $this->presenterFactory ? $this->presenterFactory->getPresenterClass($presenter) : null;
5454
} catch (InvalidPresenterException $e) {
5555
throw new UI\InvalidLinkException($e->getMessage(), 0, $e);
5656
}
@@ -77,8 +77,8 @@ public function link(string $dest, array $params = []): string
7777
$params[UI\Presenter::ACTION_KEY] = $action;
7878
}
7979

80-
$url = $this->router->constructUrl(new Request($presenter, NULL, $params), $this->refUrl);
81-
if ($url === NULL) {
80+
$url = $this->router->constructUrl(new Request($presenter, null, $params), $this->refUrl);
81+
if ($url === null) {
8282
unset($params[UI\Presenter::ACTION_KEY]);
8383
$params = urldecode(http_build_query($params, '', ', '));
8484
throw new UI\InvalidLinkException("No route for $dest($params)");

src/Application/MicroPresenter.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ class MicroPresenter implements Application\IPresenter
2323
{
2424
use Nette\SmartObject;
2525

26-
/** @var Nette\DI\Container|NULL */
26+
/** @var Nette\DI\Container|null */
2727
private $context;
2828

29-
/** @var Nette\Http\IRequest|NULL */
29+
/** @var Nette\Http\IRequest|null */
3030
private $httpRequest;
3131

32-
/** @var Application\IRouter|NULL */
32+
/** @var Application\IRouter|null */
3333
private $router;
3434

35-
/** @var Application\Request|NULL */
35+
/** @var Application\Request|null */
3636
private $request;
3737

3838

39-
public function __construct(Nette\DI\Container $context = NULL, Http\IRequest $httpRequest = NULL, Application\IRouter $router = NULL)
39+
public function __construct(Nette\DI\Container $context = null, Http\IRequest $httpRequest = null, Application\IRouter $router = null)
4040
{
4141
$this->context = $context;
4242
$this->httpRequest = $httpRequest;
@@ -60,7 +60,7 @@ public function run(Application\Request $request): Application\IResponse
6060
if ($this->httpRequest && $this->router && !$this->httpRequest->isAjax() && ($request->isMethod('get') || $request->isMethod('head'))) {
6161
$refUrl = clone $this->httpRequest->getUrl();
6262
$url = $this->router->constructUrl($request, $refUrl->setPath($refUrl->getScriptPath()));
63-
if ($url !== NULL && !$this->httpRequest->getUrl()->isEqual($url)) {
63+
if ($url !== null && !$this->httpRequest->getUrl()->isEqual($url)) {
6464
return new Responses\RedirectResponse($url, Http\IResponse::S301_MOVED_PERMANENTLY);
6565
}
6666
}
@@ -75,7 +75,7 @@ public function run(Application\Request $request): Application\IResponse
7575
if ($this->context) {
7676
foreach ($reflection->getParameters() as $param) {
7777
if ($param->getClass()) {
78-
$params[$param->getName()] = $this->context->getByType($param->getClass()->getName(), FALSE);
78+
$params[$param->getName()] = $this->context->getByType($param->getClass()->getName(), false);
7979
}
8080
}
8181
}
@@ -110,7 +110,7 @@ public function run(Application\Request $request): Application\IResponse
110110
/**
111111
* Template factory.
112112
*/
113-
public function createTemplate(string $class = NULL, callable $latteFactory = NULL): Application\UI\ITemplate
113+
public function createTemplate(string $class = null, callable $latteFactory = null): Application\UI\ITemplate
114114
{
115115
$latte = $latteFactory ? $latteFactory() : $this->getContext()->getByType(Nette\Bridges\ApplicationLatte\ILatteFactory::class)->create();
116116
$template = $class ? new $class : new Nette\Bridges\ApplicationLatte\Template($latte);
@@ -140,7 +140,7 @@ public function redirectUrl(string $url, int $httpCode = Http\IResponse::S302_FO
140140
* Throws HTTP error.
141141
* @throws Nette\Application\BadRequestException
142142
*/
143-
public function error(string $message = NULL, int $httpCode = Http\IResponse::S404_NOT_FOUND): void
143+
public function error(string $message = null, int $httpCode = Http\IResponse::S404_NOT_FOUND): void
144144
{
145145
throw new Application\BadRequestException((string) $message, (int) $httpCode);
146146
}

src/Application/PresenterFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class PresenterFactory implements IPresenterFactory
3535
/**
3636
* @param callable function (string $class): IPresenter
3737
*/
38-
public function __construct(callable $factory = NULL)
38+
public function __construct(callable $factory = null)
3939
{
4040
$this->factory = $factory ?: function ($class) { return new $class; };
4141
}
@@ -145,6 +145,6 @@ public function unformatPresenterClass(string $class): ?string
145145
. preg_replace("#$mapping[1]#iA", '$1:', $matches[1]) . $matches[3];
146146
}
147147
}
148-
return NULL;
148+
return null;
149149
}
150150
}

src/Application/Request.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @property array $parameters
2020
* @property array $post
2121
* @property array $files
22-
* @property string|NULL $method
22+
* @property string|null $method
2323
*/
2424
class Request
2525
{
@@ -34,7 +34,7 @@ class Request
3434
/** flag */
3535
public const RESTORED = 'restored';
3636

37-
/** @var string|NULL */
37+
/** @var string|null */
3838
private $method;
3939

4040
/** @var array */
@@ -59,7 +59,7 @@ class Request
5959
* @param array $post variables provided to the presenter via POST
6060
* @param array $files all uploaded files
6161
*/
62-
public function __construct(string $name, string $method = NULL, array $params = [], array $post = [], array $files = [], array $flags = [])
62+
public function __construct(string $name, string $method = null, array $params = [], array $post = [], array $files = [], array $flags = [])
6363
{
6464
$this->name = $name;
6565
$this->method = $method;
@@ -116,7 +116,7 @@ public function getParameters(): array
116116
*/
117117
public function getParameter(string $key)
118118
{
119-
return $this->params[$key] ?? NULL;
119+
return $this->params[$key] ?? null;
120120
}
121121

122122

@@ -136,11 +136,11 @@ public function setPost(array $params)
136136
* If no key is passed, returns the entire array.
137137
* @return mixed
138138
*/
139-
public function getPost(string $key = NULL)
139+
public function getPost(string $key = null)
140140
{
141141
return func_num_args() === 0
142142
? $this->post
143-
: ($this->post[$key] ?? NULL);
143+
: ($this->post[$key] ?? null);
144144
}
145145

146146

@@ -197,7 +197,7 @@ public function isMethod(string $method): bool
197197
* Sets the flag.
198198
* @return static
199199
*/
200-
public function setFlag(string $flag, bool $value = TRUE)
200+
public function setFlag(string $flag, bool $value = true)
201201
{
202202
$this->flags[$flag] = $value;
203203
return $this;

src/Application/Responses/FileResponse.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class FileResponse implements Nette\Application\IResponse
2929
private $name;
3030

3131
/** @var bool */
32-
public $resuming = TRUE;
32+
public $resuming = true;
3333

3434
/** @var bool */
3535
private $forceDownload;
3636

3737

38-
public function __construct(string $file, string $name = NULL, string $contentType = NULL, bool $forceDownload = TRUE)
38+
public function __construct(string $file, string $name = null, string $contentType = null, bool $forceDownload = true)
3939
{
4040
if (!is_file($file)) {
4141
throw new Nette\Application\BadRequestException("File '$file' doesn't exist.");

src/Application/Responses/JsonResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class JsonResponse implements Nette\Application\IResponse
2626
private $contentType;
2727

2828

29-
public function __construct($payload, string $contentType = NULL)
29+
public function __construct($payload, string $contentType = null)
3030
{
3131
$this->payload = $payload;
3232
$this->contentType = $contentType ? $contentType : 'application/json';

src/Application/Routers/CliRouter.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct(array $defaults = [])
4141
public function match(Nette\Http\IRequest $httpRequest): ?Application\Request
4242
{
4343
if (empty($_SERVER['argv']) || !is_array($_SERVER['argv'])) {
44-
return NULL;
44+
return null;
4545
}
4646

4747
$names = [self::PRESENTER_KEY];
@@ -58,13 +58,13 @@ public function match(Nette\Http\IRequest $httpRequest): ?Application\Request
5858
} else {
5959
$params[] = $arg;
6060
}
61-
$flag = NULL;
61+
$flag = null;
6262
continue;
6363
}
6464

6565
if (isset($flag)) {
66-
$params[$flag] = TRUE;
67-
$flag = NULL;
66+
$params[$flag] = true;
67+
$flag = null;
6868
}
6969

7070
if ($opt !== '') {
@@ -99,7 +99,7 @@ public function match(Nette\Http\IRequest $httpRequest): ?Application\Request
9999
*/
100100
public function constructUrl(Application\Request $appRequest, Nette\Http\Url $refUrl): ?string
101101
{
102-
return NULL;
102+
return null;
103103
}
104104

105105

0 commit comments

Comments
 (0)