From 848b9801b08d691def50f7f4a6ca39298a91107a Mon Sep 17 00:00:00 2001 From: kenjis Date: Tue, 14 Nov 2023 14:24:53 +0900 Subject: [PATCH] refactor: run rector --- system/CLI/InputOutput.php | 2 +- .../Utilities/Routes/SampleURIGenerator.php | 2 +- system/Filters/Filters.php | 2 +- system/Filters/PageCache.php | 2 +- system/HTTP/Method.php | 18 +++++++++--------- system/Validation/Rules.php | 2 +- system/Validation/StrictRules/Rules.php | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/system/CLI/InputOutput.php b/system/CLI/InputOutput.php index 5b6c1da02f4d..b69c19e2eee1 100644 --- a/system/CLI/InputOutput.php +++ b/system/CLI/InputOutput.php @@ -21,7 +21,7 @@ class InputOutput /** * Is the readline library on the system? */ - private bool $readlineSupport; + private readonly bool $readlineSupport; public function __construct() { diff --git a/system/Commands/Utilities/Routes/SampleURIGenerator.php b/system/Commands/Utilities/Routes/SampleURIGenerator.php index 4c4cf0c9112e..c0832a382eff 100644 --- a/system/Commands/Utilities/Routes/SampleURIGenerator.php +++ b/system/Commands/Utilities/Routes/SampleURIGenerator.php @@ -52,7 +52,7 @@ public function get(string $routeKey): string { $sampleUri = $routeKey; - if (strpos($routeKey, '{locale}') !== false) { + if (str_contains($routeKey, '{locale}')) { $sampleUri = str_replace( '{locale}', config(App::class)->defaultLocale, diff --git a/system/Filters/Filters.php b/system/Filters/Filters.php index 6816e72ab482..acfc9970c522 100644 --- a/system/Filters/Filters.php +++ b/system/Filters/Filters.php @@ -230,7 +230,7 @@ private function runAfter(array $filterClasses): ResponseInterface $class = new $className(); if (! $class instanceof FilterInterface) { - throw FilterException::forIncorrectInterface(get_class($class)); + throw FilterException::forIncorrectInterface($class::class); } $result = $class->after( diff --git a/system/Filters/PageCache.php b/system/Filters/PageCache.php index d6fa407f5a0d..c3bb2af90dd6 100644 --- a/system/Filters/PageCache.php +++ b/system/Filters/PageCache.php @@ -25,7 +25,7 @@ */ class PageCache implements FilterInterface { - private ResponseCache $pageCache; + private readonly ResponseCache $pageCache; public function __construct() { diff --git a/system/HTTP/Method.php b/system/HTTP/Method.php index 7aae162b3cba..6ad3847cc2f7 100644 --- a/system/HTTP/Method.php +++ b/system/HTTP/Method.php @@ -19,59 +19,59 @@ class Method /** * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/CONNECT */ - public const CONNECT = 'CONNECT'; + final public const CONNECT = 'CONNECT'; /** * Idempotent * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE */ - public const DELETE = 'DELETE'; + final public const DELETE = 'DELETE'; /** * Safe, Idempotent, Cacheable * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET */ - public const GET = 'GET'; + final public const GET = 'GET'; /** * Safe, Idempotent, Cacheable * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/HEAD */ - public const HEAD = 'HEAD'; + final public const HEAD = 'HEAD'; /** * Safe, Idempotent * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS */ - public const OPTIONS = 'OPTIONS'; + final public const OPTIONS = 'OPTIONS'; /** * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PATCH */ - public const PATCH = 'PATCH'; + final public const PATCH = 'PATCH'; /** * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/POST */ - public const POST = 'POST'; + final public const POST = 'POST'; /** * Idempotent * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT */ - public const PUT = 'PUT'; + final public const PUT = 'PUT'; /** * Safe, Idempotent * * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/TRACE */ - public const TRACE = 'TRACE'; + final public const TRACE = 'TRACE'; /** * Returns all HTTP methods. diff --git a/system/Validation/Rules.php b/system/Validation/Rules.php index 00a4480676f4..d0c609e84699 100644 --- a/system/Validation/Rules.php +++ b/system/Validation/Rules.php @@ -444,7 +444,7 @@ public function field_exists( ?string $error = null, ?string $field = null ): bool { - if (strpos($field, '.') !== false) { + if (str_contains($field, '.')) { return ArrayHelper::dotKeyExists($field, $data); } diff --git a/system/Validation/StrictRules/Rules.php b/system/Validation/StrictRules/Rules.php index 712200321764..abb0a6033c1f 100644 --- a/system/Validation/StrictRules/Rules.php +++ b/system/Validation/StrictRules/Rules.php @@ -44,7 +44,7 @@ public function differs( ?string $error = null, ?string $field = null ): bool { - if (strpos($otherField, '.') !== false) { + if (str_contains($otherField, '.')) { return $str !== dot_array_search($otherField, $data); } @@ -275,7 +275,7 @@ public function matches( ?string $error = null, ?string $field = null ): bool { - if (strpos($otherField, '.') !== false) { + if (str_contains($otherField, '.')) { return $str === dot_array_search($otherField, $data); } @@ -420,7 +420,7 @@ public function field_exists( ?string $error = null, ?string $field = null ): bool { - if (strpos($field, '.') !== false) { + if (str_contains($field, '.')) { return ArrayHelper::dotKeyExists($field, $data); }