Skip to content

Commit eab2f01

Browse files
committed
private constants are PascalCase
1 parent 9e5fca9 commit eab2f01

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Http/RequestFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RequestFactory
2121
use Nette\SmartObject;
2222

2323
/** @internal */
24-
private const CHARS = '\x09\x0A\x0D\x20-\x7E\xA0-\x{10FFFF}';
24+
private const ValidChars = '\x09\x0A\x0D\x20-\x7E\xA0-\x{10FFFF}';
2525

2626
/** @var array */
2727
public $urlFilters = [
@@ -156,7 +156,7 @@ private function getGetPostCookie(Url $url): array
156156
: (empty($_COOKIE) ? [] : $_COOKIE);
157157

158158
// remove invalid characters
159-
$reChars = '#^[' . self::CHARS . ']*+$#Du';
159+
$reChars = '#^[' . self::ValidChars . ']*+$#Du';
160160
if (!$this->binary) {
161161
$list = [&$query, &$post, &$cookies];
162162
foreach ($list as $key => &$val) {
@@ -169,7 +169,7 @@ private function getGetPostCookie(Url $url): array
169169
$list[] = &$list[$key][$k];
170170

171171
} elseif (is_string($v)) {
172-
$list[$key][$k] = (string) preg_replace('#[^' . self::CHARS . ']+#u', '', $v);
172+
$list[$key][$k] = (string) preg_replace('#[^' . self::ValidChars . ']+#u', '', $v);
173173

174174
} else {
175175
throw new Nette\InvalidStateException(sprintf('Invalid value in $_POST/$_COOKIE in key %s, expected string, %s given.', "'$k'", gettype($v)));
@@ -187,7 +187,7 @@ private function getGetPostCookie(Url $url): array
187187

188188
private function getFiles(): array
189189
{
190-
$reChars = '#^[' . self::CHARS . ']*+$#Du';
190+
$reChars = '#^[' . self::ValidChars . ']*+$#Du';
191191
$files = [];
192192
$list = [];
193193
foreach ($_FILES ?? [] as $k => $v) {

src/Http/Session.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class Session
2020
use Nette\SmartObject;
2121

2222
/** Default file lifetime */
23-
private const DEFAULT_FILE_LIFETIME = 3 * Nette\Utils\DateTime::HOUR;
23+
private const DefaultFileLifetime = 3 * Nette\Utils\DateTime::HOUR;
2424

25-
private const SECURITY_OPTIONS = [
25+
private const SecurityOptions = [
2626
'referer_check' => '', // must be disabled because PHP implementation is invalid
2727
'use_cookies' => 1, // must be enabled to prevent Session Hijacking and Fixation
2828
'use_only_cookies' => 1, // must be enabled to prevent Session Fixation
@@ -47,7 +47,7 @@ class Session
4747
private $options = [
4848
'cookie_samesite' => IResponse::SAME_SITE_LAX,
4949
'cookie_lifetime' => 0, // for a maximum of 3 hours or until the browser is closed
50-
'gc_maxlifetime' => self::DEFAULT_FILE_LIFETIME, // 3 hours
50+
'gc_maxlifetime' => self::DefaultFileLifetime, // 3 hours
5151
];
5252

5353
/** @var IRequest */
@@ -93,14 +93,14 @@ private function doStart($mustExists = false): void
9393
{
9494
if (session_status() === PHP_SESSION_ACTIVE) { // adapt an existing session
9595
if (!$this->started) {
96-
$this->configure(self::SECURITY_OPTIONS);
96+
$this->configure(self::SecurityOptions);
9797
$this->initialize();
9898
}
9999

100100
return;
101101
}
102102

103-
$this->configure(self::SECURITY_OPTIONS + $this->options);
103+
$this->configure(self::SecurityOptions + $this->options);
104104

105105
if (!session_id()) { // session is started for first time
106106
$id = $this->request->getCookie(session_name());
@@ -500,7 +500,7 @@ public function setExpiration(?string $time)
500500
{
501501
if ($time === null) {
502502
return $this->setOptions([
503-
'gc_maxlifetime' => self::DEFAULT_FILE_LIFETIME,
503+
'gc_maxlifetime' => self::DefaultFileLifetime,
504504
'cookie_lifetime' => 0,
505505
]);
506506

0 commit comments

Comments
 (0)