diff --git a/system/Database/Database.php b/system/Database/Database.php index 4cb5dfaf1627..d84d65482536 100644 --- a/system/Database/Database.php +++ b/system/Database/Database.php @@ -58,7 +58,7 @@ public function load(array $params = [], string $alias = '') throw new InvalidArgumentException('You have not selected a database type to connect to.'); } - assert($this->checkDbExtension($params['DBDriver'])); + $this->checkDbExtension($params['DBDriver']); $this->connections[$alias] = $this->initDriver($params['DBDriver'], 'Connection', $params); @@ -158,11 +158,11 @@ protected function initDriver(string $driver, string $class, $argument): object * * @param string $driver DB driver or FQCN for custom driver */ - private function checkDbExtension(string $driver): bool + private function checkDbExtension(string $driver): void { if (str_contains($driver, '\\')) { // Cannot check a fully qualified classname for a custom driver. - return true; + return; } $extensionMap = [ @@ -183,7 +183,7 @@ private function checkDbExtension(string $driver): bool } if (extension_loaded($extension)) { - return true; + return; } $message = 'The required PHP extension "' . $extension . '" is not loaded.' diff --git a/system/HTTP/Files/FileCollection.php b/system/HTTP/Files/FileCollection.php index 058e86c3a4aa..c1c0582f6ff5 100644 --- a/system/HTTP/Files/FileCollection.php +++ b/system/HTTP/Files/FileCollection.php @@ -189,7 +189,7 @@ protected function createFileObject(array $array) return new UploadedFile( $array['tmp_name'] ?? null, - $array['name'] ?? null, + $array['name'], $array['type'] ?? null, ($array['size'] ?? null) === null ? null : (int) $array['size'], $array['error'] ?? null, diff --git a/system/HTTP/SiteURIFactory.php b/system/HTTP/SiteURIFactory.php index 73cc9fe84ee4..11dccce6c540 100644 --- a/system/HTTP/SiteURIFactory.php +++ b/system/HTTP/SiteURIFactory.php @@ -227,7 +227,7 @@ private function createURIFromRoutePath(string $routePath): SiteURI */ private function getHost(): ?string { - $httpHostPort = $this->superglobals->server('HTTP_HOST') ?? null; + $httpHostPort = $this->superglobals->server('HTTP_HOST'); if ($httpHostPort !== null) { [$httpHost] = explode(':', $httpHostPort, 2); diff --git a/system/Helpers/Array/ArrayHelper.php b/system/Helpers/Array/ArrayHelper.php index f70f6905ca5d..d370e1f1112f 100644 --- a/system/Helpers/Array/ArrayHelper.php +++ b/system/Helpers/Array/ArrayHelper.php @@ -324,7 +324,7 @@ public static function recursiveCount(array $array, int $counter = 0): int * @param list|string> $array * @param int|string|null $sortByIndex */ - public static function sortValuesByNatural(array &$array, $sortByIndex = null): bool + public static function sortValuesByNatural(array &$array, $sortByIndex = null): true { return usort($array, static function ($currentValue, $nextValue) use ($sortByIndex): int { if ($sortByIndex !== null) { diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 6ade80e6f9fc..c08c01530b79 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -1520,7 +1520,7 @@ private function checkSubdomains($subdomains): bool // Routes can be limited to any sub-domain. In that case, though, // it does require a sub-domain to be present. - if (! in_array($this->currentSubdomain, [null, ''], true) && in_array('*', $subdomains, true)) { + if ($this->currentSubdomain !== '' && in_array('*', $subdomains, true)) { return true; }