Skip to content

Commit 1f43e8c

Browse files
authored
Merge pull request #1138 from samsonasik/int-cast-rem
remove unneeded (int) casting as use int type hint or certainly an int
2 parents 0f98889 + cc216b5 commit 1f43e8c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ public function displayCache($config)
552552
*/
553553
public static function cache(int $time)
554554
{
555-
self::$cacheTTL = (int) $time;
555+
self::$cacheTTL = $time;
556556
}
557557

558558
//--------------------------------------------------------------------

system/HTTP/URI.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ public function setHost(string $str)
633633
*
634634
* @return $this
635635
*/
636-
public function setPort($port)
636+
public function setPort(int $port = null)
637637
{
638638
if (is_null($port))
639639
{
@@ -952,7 +952,7 @@ protected function applyParts($parts)
952952
if ( ! is_null($parts['port']))
953953
{
954954
// Valid port numbers are enforced by earlier parse_url or setPort()
955-
$port = (int) $parts['port'];
955+
$port = $parts['port'];
956956
$this->port = $port;
957957
}
958958
}

system/View/Filters.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public static function limit_words($value, int $limit = 100): string
222222
*
223223
* @return string
224224
*/
225-
public static function local_number($value, string $type='decimal', $precision=4, string $locale = null): string
225+
public static function local_number($value, string $type='decimal', int $precision=4, string $locale = null): string
226226
{
227227
helper('number');
228228

@@ -236,7 +236,7 @@ public static function local_number($value, string $type='decimal', $precision=4
236236
'duration' => \NumberFormatter::DURATION,
237237
];
238238

239-
return format_number($value, (int)$precision, $locale, ['type' => $types[$type]]);
239+
return format_number($value, $precision, $locale, ['type' => $types[$type]]);
240240
}
241241

242242
//--------------------------------------------------------------------

0 commit comments

Comments
 (0)