Skip to content

Commit 11e1434

Browse files
committed
View typos changes
1 parent 3442404 commit 11e1434

2 files changed

Lines changed: 20 additions & 15 deletions

File tree

system/View/Cell.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
use CodeIgniter\Cache\CacheInterface;
4141
use CodeIgniter\View\Exceptions\ViewException;
42+
use ReflectionMethod;
4243

4344
/**
4445
* Class Cell
@@ -98,6 +99,7 @@ public function __construct(CacheInterface $cache)
9899
* @param string|null $cacheName
99100
*
100101
* @return string
102+
* @throws \ReflectionException
101103
*/
102104
public function render(string $library, $params = null, int $ttl = 0, string $cacheName = null): string
103105
{
@@ -122,7 +124,7 @@ public function render(string $library, $params = null, int $ttl = 0, string $ca
122124
// Try to match up the parameter list we were provided
123125
// with the parameter name in the callback method.
124126
$paramArray = $this->prepareParams($params);
125-
$refMethod = new \ReflectionMethod($instance, $method);
127+
$refMethod = new ReflectionMethod($instance, $method);
126128
$paramCount = $refMethod->getNumberOfParameters();
127129
$refParams = $refMethod->getParameters();
128130

@@ -237,7 +239,7 @@ public function prepareParams($params)
237239
*
238240
* @return array
239241
*/
240-
protected function determineClass(string $library)
242+
protected function determineClass(string $library): array
241243
{
242244
// We don't want to actually call static methods
243245
// by default, so convert any double colons.

system/View/Filters.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838

3939
namespace CodeIgniter\View;
4040

41+
use Config\Services;
42+
use NumberFormatter;
43+
4144
/**
4245
* View filters
4346
*/
@@ -183,7 +186,7 @@ public static function highlight_code($value): string
183186
//--------------------------------------------------------------------
184187

185188
/**
186-
* Limits the number of chracters to $limit, and trails of with an ellipsis.
189+
* Limits the number of characters to $limit, and trails of with an ellipsis.
187190
* Will break at word break so may be more or less than $limit.
188191
*
189192
* @param $value
@@ -232,13 +235,13 @@ public static function local_number($value, string $type = 'decimal', int $preci
232235
helper('number');
233236

234237
$types = [
235-
'decimal' => \NumberFormatter::DECIMAL,
236-
'currency' => \NumberFormatter::CURRENCY,
237-
'percent' => \NumberFormatter::PERCENT,
238-
'scientific' => \NumberFormatter::SCIENTIFIC,
239-
'spellout' => \NumberFormatter::SPELLOUT,
240-
'ordinal' => \NumberFormatter::ORDINAL,
241-
'duration' => \NumberFormatter::DURATION,
238+
'decimal' => NumberFormatter::DECIMAL,
239+
'currency' => NumberFormatter::CURRENCY,
240+
'percent' => NumberFormatter::PERCENT,
241+
'scientific' => NumberFormatter::SCIENTIFIC,
242+
'spellout' => NumberFormatter::SPELLOUT,
243+
'ordinal' => NumberFormatter::ORDINAL,
244+
'duration' => NumberFormatter::DURATION,
242245
];
243246

244247
return format_number($value, $precision, $locale, ['type' => $types[$type]]);
@@ -260,7 +263,7 @@ public static function local_currency($value, string $currency, string $locale =
260263
helper('number');
261264

262265
$options = [
263-
'type' => \NumberFormatter::CURRENCY,
266+
'type' => NumberFormatter::CURRENCY,
264267
'currency' => $currency,
265268
];
266269

@@ -277,7 +280,7 @@ public static function local_currency($value, string $currency, string $locale =
277280
*/
278281
public static function nl2br(string $value): string
279282
{
280-
$typography = \Config\Services::typography();
283+
$typography = Services::typography();
281284

282285
return $typography->nl2brExceptPre($value);
283286
}
@@ -294,7 +297,7 @@ public static function nl2br(string $value): string
294297
*/
295298
public static function prose(string $value): string
296299
{
297-
$typography = \Config\Services::typography();
300+
$typography = Services::typography();
298301

299302
return $typography->autoTypography($value);
300303
}
@@ -309,12 +312,12 @@ public static function prose(string $value): string
309312
* - floor always rounds down
310313
*
311314
* @param string $value
312-
* @param integer $precision
315+
* @param mixed $precision
313316
* @param string $type
314317
*
315318
* @return string
316319
*/
317-
public static function round($value, $precision = 2, $type = 'common'): string
320+
public static function round(string $value, $precision = 2, string $type = 'common'): string
318321
{
319322
if (! is_numeric($precision))
320323
{

0 commit comments

Comments
 (0)