From 72657ab02db3e7369c0f4914efe404974e0eb59e Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 5 Aug 2018 18:35:58 +0700 Subject: [PATCH 1/2] remove unneeded (int) casting as already use int type hint or certainly an int --- system/CodeIgniter.php | 2 +- system/HTTP/URI.php | 2 +- system/View/Filters.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 34e8c3a0c940..cb03cedf5e79 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -552,7 +552,7 @@ public function displayCache($config) */ public static function cache(int $time) { - self::$cacheTTL = (int) $time; + self::$cacheTTL = $time; } //-------------------------------------------------------------------- diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php index cd82a884f6e4..99a5599119df 100644 --- a/system/HTTP/URI.php +++ b/system/HTTP/URI.php @@ -952,7 +952,7 @@ protected function applyParts($parts) if ( ! is_null($parts['port'])) { // Valid port numbers are enforced by earlier parse_url or setPort() - $port = (int) $parts['port']; + $port = $parts['port']; $this->port = $port; } } diff --git a/system/View/Filters.php b/system/View/Filters.php index c0078525d0d3..dc450c24f78f 100644 --- a/system/View/Filters.php +++ b/system/View/Filters.php @@ -222,7 +222,7 @@ public static function limit_words($value, int $limit = 100): string * * @return string */ - public static function local_number($value, string $type='decimal', $precision=4, string $locale = null): string + public static function local_number($value, string $type='decimal', int $precision=4, string $locale = null): string { helper('number'); @@ -236,7 +236,7 @@ public static function local_number($value, string $type='decimal', $precision=4 'duration' => \NumberFormatter::DURATION, ]; - return format_number($value, (int)$precision, $locale, ['type' => $types[$type]]); + return format_number($value, $precision, $locale, ['type' => $types[$type]]); } //-------------------------------------------------------------------- From cc216b596fd34a9a4b333f75014a09e03eb00cfb Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Sun, 5 Aug 2018 18:42:50 +0700 Subject: [PATCH 2/2] int port null default value --- system/HTTP/URI.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php index 99a5599119df..691a3059c978 100644 --- a/system/HTTP/URI.php +++ b/system/HTTP/URI.php @@ -633,7 +633,7 @@ public function setHost(string $str) * * @return $this */ - public function setPort($port) + public function setPort(int $port = null) { if (is_null($port)) {