Skip to content

Commit df632a4

Browse files
committed
Changed private static array-properties to const
1 parent 8445c3a commit df632a4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

HttpCache/ResponseCacheStrategy.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
2727
/**
2828
* Cache-Control headers that are sent to the final response if they appear in ANY of the responses.
2929
*/
30-
private static $overrideDirectives = ['private', 'no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate'];
30+
private const OVERRIDE_DIRECTIVES = ['private', 'no-cache', 'no-store', 'no-transform', 'must-revalidate', 'proxy-revalidate'];
3131

3232
/**
3333
* Cache-Control headers that are sent to the final response if they appear in ALL of the responses.
3434
*/
35-
private static $inheritDirectives = ['public', 'immutable'];
35+
private const INHERIT_DIRECTIVES = ['public', 'immutable'];
3636

3737
private $embeddedResponses = 0;
3838
private $isNotCacheableResponseEmbedded = false;
@@ -60,13 +60,13 @@ public function add(Response $response)
6060
{
6161
++$this->embeddedResponses;
6262

63-
foreach (self::$overrideDirectives as $directive) {
63+
foreach (self::OVERRIDE_DIRECTIVES as $directive) {
6464
if ($response->headers->hasCacheControlDirective($directive)) {
6565
$this->flagDirectives[$directive] = true;
6666
}
6767
}
6868

69-
foreach (self::$inheritDirectives as $directive) {
69+
foreach (self::INHERIT_DIRECTIVES as $directive) {
7070
if (false !== $this->flagDirectives[$directive]) {
7171
$this->flagDirectives[$directive] = $response->headers->hasCacheControlDirective($directive);
7272
}

Log/Logger.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class Logger extends AbstractLogger
2424
{
25-
private static $levels = [
25+
private const LEVELS = [
2626
LogLevel::DEBUG => 0,
2727
LogLevel::INFO => 1,
2828
LogLevel::NOTICE => 2,
@@ -52,11 +52,11 @@ public function __construct(string $minLevel = null, $output = null, callable $f
5252
}
5353
}
5454

55-
if (!isset(self::$levels[$minLevel])) {
55+
if (!isset(self::LEVELS[$minLevel])) {
5656
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $minLevel));
5757
}
5858

59-
$this->minLevelIndex = self::$levels[$minLevel];
59+
$this->minLevelIndex = self::LEVELS[$minLevel];
6060
$this->formatter = $formatter ?: [$this, 'format'];
6161
if ($output && false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) {
6262
throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output));
@@ -70,11 +70,11 @@ public function __construct(string $minLevel = null, $output = null, callable $f
7070
*/
7171
public function log($level, $message, array $context = [])
7272
{
73-
if (!isset(self::$levels[$level])) {
73+
if (!isset(self::LEVELS[$level])) {
7474
throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
7575
}
7676

77-
if (self::$levels[$level] < $this->minLevelIndex) {
77+
if (self::LEVELS[$level] < $this->minLevelIndex) {
7878
return;
7979
}
8080

0 commit comments

Comments
 (0)