Skip to content

Commit 5521894

Browse files
authored
Merge pull request #1863 from atishamte/typos
Module wise Typos changes
2 parents b5c3f18 + bc69e18 commit 5521894

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+252
-244
lines changed

system/Autoloader/Autoloader.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php namespace CodeIgniter\Autoloader;
22

3-
use Composer\Autoload\ClassLoader;
4-
53
/**
64
* CodeIgniter
75
*

system/CLI/CLI.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ public static function input(string $prefix = null): string
204204
* $email = CLI::prompt('What is your email?', null, 'required|valid_email');
205205
*
206206
* @param string $field Output "field" question
207-
* @param string|array $options String to a defaul value, array to a list of options (the first option will be the default value)
207+
* @param string|array $options String to a default value, array to a list of options (the first option will be the default value)
208208
* @param string $validation Validation rules
209209
*
210210
* @return string The user input
211211
* @codeCoverageIgnore
212212
*/
213-
public static function prompt($field, $options = null, $validation = null): string
213+
public static function prompt(string $field, $options = null, string $validation = null): string
214214
{
215215
$extra_output = '';
216216
$default = '';
@@ -270,7 +270,7 @@ public static function prompt($field, $options = null, $validation = null): stri
270270
* @return boolean
271271
* @codeCoverageIgnore
272272
*/
273-
protected static function validate($field, $value, $rules)
273+
protected static function validate(string $field, string $value, string $rules): bool
274274
{
275275
$validation = \Config\Services::validation(null, false);
276276
$validation->setRule($field, null, $rules);
@@ -380,10 +380,12 @@ public static function wait(int $seconds, bool $countdown = false)
380380

381381
/**
382382
* if operating system === windows
383+
*
384+
* @return boolean
383385
*/
384-
public static function isWindows()
386+
public static function isWindows(): bool
385387
{
386-
return stripos(PHP_OS, 'WIN') === 0;
388+
return stripos(PHP_OS, 'WIN') === 0;
387389
}
388390

389391
//--------------------------------------------------------------------
@@ -436,7 +438,7 @@ public static function clearScreen()
436438
*
437439
* @return string The color coded string
438440
*/
439-
public static function color(string $text, string $foreground, string $background = null, string $format = null)
441+
public static function color(string $text, string $foreground, string $background = null, string $format = null): string
440442
{
441443
if (static::isWindows() && ! isset($_SERVER['ANSICON']))
442444
{
@@ -655,7 +657,7 @@ public static function wrap(string $string = null, int $max = 0, int $pad_left =
655657
* Parses the command line it was called from and collects all
656658
* options and valid segments.
657659
*
658-
* I tried to use getopt but had it fail occassionally to find any
660+
* I tried to use getopt but had it fail occasionally to find any
659661
* options but argc has always had our back. We don't have all of the power
660662
* of getopt but this does us just fine.
661663
*/
@@ -706,7 +708,7 @@ protected static function parseCommandLine()
706708
*
707709
* @return string
708710
*/
709-
public static function getURI()
711+
public static function getURI(): string
710712
{
711713
return implode('/', static::$segments);
712714
}
@@ -743,7 +745,7 @@ public static function getSegment(int $index)
743745
*
744746
* @return array
745747
*/
746-
public static function getSegments()
748+
public static function getSegments(): array
747749
{
748750
return static::$segments;
749751
}
@@ -779,7 +781,7 @@ public static function getOption(string $name)
779781
*
780782
* @return array
781783
*/
782-
public static function getOptions()
784+
public static function getOptions(): array
783785
{
784786
return static::$options;
785787
}
@@ -819,12 +821,12 @@ public static function getOptionString(): string
819821
//--------------------------------------------------------------------
820822

821823
/**
822-
* Returns a well formated table
824+
* Returns a well formatted table
823825
*
824826
* @param array $tbody List of rows
825827
* @param array $thead List of columns
826828
*
827-
* @return string
829+
* @return void
828830
*/
829831
public static function table(array $tbody, array $thead = [])
830832
{

system/CLI/CommandRunner.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class CommandRunner extends Controller
6363
*
6464
* @param string $method
6565
* @param array ...$params
66+
*
67+
* @throws \ReflectionException
6668
*/
6769
public function _remap($method, ...$params)
6870
{
@@ -81,6 +83,7 @@ public function _remap($method, ...$params)
8183
* @param array $params
8284
*
8385
* @return mixed
86+
* @throws \ReflectionException
8487
*/
8588
public function index(array $params)
8689
{
@@ -128,6 +131,8 @@ protected function runCommand(string $command, array $params)
128131
/**
129132
* Scans all Commands directories and prepares a list
130133
* of each command with it's group and file.
134+
*
135+
* @throws \ReflectionException
131136
*/
132137
protected function createCommandList()
133138
{

system/CLI/Console.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(CodeIgniter $app)
6868
* @param boolean $useSafeOutput
6969
*
7070
* @return \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\Response|\CodeIgniter\HTTP\ResponseInterface|mixed
71-
* @throws \CodeIgniter\HTTP\RedirectException
71+
* @throws \CodeIgniter\Router\RedirectException
7272
*/
7373
public function run(bool $useSafeOutput = false)
7474
{

system/Cache/Handlers/PredisHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*/
3838

3939
use CodeIgniter\Cache\CacheInterface;
40-
use CodeIgniter\CriticalError;
40+
use CodeIgniter\Exceptions\CriticalError;
4141

4242
class PredisHandler implements CacheInterface
4343
{

system/Cache/Handlers/RedisHandler.php

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
* @filesource
3737
*/
3838

39-
use CodeIgniter\Exceptions\CriticalError;
4039
use CodeIgniter\Cache\CacheInterface;
4140

4241
class RedisHandler implements CacheInterface
@@ -106,28 +105,19 @@ public function initialize()
106105
$config = $this->config;
107106

108107
$this->redis = new \Redis();
108+
if (!$this->redis->connect($config['host'], ($config['host'][0] === '/' ? 0 : $config['port']), $config['timeout']))
109+
{
110+
log_message('error', 'Cache: Redis connection failed. Check your configuration.');
111+
}
109112

110-
try
113+
if (isset($config['password']) && !$this->redis->auth($config['password']))
111114
{
112-
if (! $this->redis->connect($config['host'], ($config['host'][0] === '/' ? 0 : $config['port']), $config['timeout'])
113-
)
114-
{
115-
// log_message('error', 'Cache: Redis connection failed. Check your configuration.');
116-
}
117-
118-
if (isset($config['password']) && ! $this->redis->auth($config['password']))
119-
{
120-
log_message('error', 'Cache: Redis authentication failed.');
121-
}
122-
123-
if (isset($config['database']) && ! $this->redis->select($config['database']))
124-
{
125-
log_message('error', 'Cache: Redis select database failed.');
126-
}
115+
log_message('error', 'Cache: Redis authentication failed.');
127116
}
128-
catch (\RedisException $e)
117+
118+
if (isset($config['database']) && !$this->redis->select($config['database']))
129119
{
130-
throw new CriticalError('Cache: Redis connection refused (' . $e->getMessage() . ')');
120+
log_message('error', 'Cache: Redis select database failed.');
131121
}
132122
}
133123

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ public function cachePage(Cache $config)
615615
*
616616
* @return array
617617
*/
618-
public function getPerformanceStats()
618+
public function getPerformanceStats(): array
619619
{
620620
return [
621621
'startTime' => $this->startTime,

system/Commands/Help.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
*/
3838

3939
use CodeIgniter\CLI\BaseCommand;
40-
use CodeIgniter\CLI\CLI;
4140

4241
/**
4342
* CI Help command for the spark script.

system/Commands/Utilities/Routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1616
* copies of the Software, and to permit persons to whom the Software is
1717
* furnished to do so, subject to the following conditions:
18-
*RouRouddfdf
18+
*
1919
* The above copyright notice and this permission notice shall be included in
2020
* all copies or substantial portions of the Software.
2121
*

system/Config/BaseConfig.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ protected function getEnvValue(string $property, string $prefix, string $shortPr
167167
/**
168168
* Provides external libraries a simple way to register one or more
169169
* options into a config file.
170+
*
171+
* @throws \ReflectionException
170172
*/
171173
protected function registerProperties()
172174
{

system/Debug/Exceptions.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ protected function render(\Throwable $exception, int $statusCode)
298298
*
299299
* @return array
300300
*/
301-
protected function collectVars(\Throwable $exception, int $statusCode)
301+
protected function collectVars(\Throwable $exception, int $statusCode): array
302302
{
303303
return [
304304
'title' => get_class($exception),
@@ -356,7 +356,7 @@ protected function determineCodes(\Throwable $exception): array
356356
*
357357
* @return string
358358
*/
359-
public static function cleanPath($file)
359+
public static function cleanPath(string $file): string
360360
{
361361
if (strpos($file, APPPATH) === 0)
362362
{
@@ -403,13 +403,13 @@ public static function describeMemory(int $bytes): string
403403
/**
404404
* Creates a syntax-highlighted version of a PHP file.
405405
*
406-
* @param $file
407-
* @param $lineNumber
408-
* @param integer $lines
406+
* @param string $file
407+
* @param integer $lineNumber
408+
* @param integer $lines
409409
*
410410
* @return boolean|string
411411
*/
412-
public static function highlightFile($file, $lineNumber, $lines = 15)
412+
public static function highlightFile(string $file, int $lineNumber, int $lines = 15)
413413
{
414414
if (empty($file) || ! is_readable($file))
415415
{

system/Debug/Iterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function run($iterations = 1000, $output = true)
129129
*
130130
* @return string
131131
*/
132-
public function getReport()
132+
public function getReport(): string
133133
{
134134
if (empty($this->results))
135135
{

system/Debug/Timer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function getElapsedTime(string $name, int $decimals = 4)
146146
*
147147
* @return array
148148
*/
149-
public function getTimers(int $decimals = 4)
149+
public function getTimers(int $decimals = 4): array
150150
{
151151
$timers = $this->timers;
152152

@@ -172,7 +172,7 @@ public function getTimers(int $decimals = 4)
172172
*
173173
* @return boolean
174174
*/
175-
public function has(string $name)
175+
public function has(string $name): bool
176176
{
177177
return array_key_exists(strtolower($name), $this->timers);
178178
}

system/Debug/Toolbar.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ protected function collectTimelineData($collectors): array
273273
*
274274
* @return array
275275
*/
276-
protected function collectVarData()// : array
276+
protected function collectVarData(): array
277277
{
278278
$data = [];
279279

@@ -300,7 +300,7 @@ protected function collectVarData()// : array
300300
*
301301
* @return float
302302
*/
303-
protected function roundTo($number, $increments = 5)
303+
protected function roundTo($number, $increments = 5): float
304304
{
305305
$increments = 1 / $increments;
306306

@@ -440,7 +440,7 @@ public function respond()
440440
*
441441
* @return string
442442
*/
443-
protected function format(string $data, string $format = 'html')
443+
protected function format(string $data, string $format = 'html'): string
444444
{
445445
$data = json_decode($data, true);
446446

system/Debug/Toolbar/Collectors/BaseCollector.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ public function timelineData(): array
172172
* Does this Collector have data that should be shown in the
173173
* 'Vars' tab?
174174
*
175-
* @return mixed
175+
* @return boolean
176176
*/
177-
public function hasVarData()
177+
public function hasVarData(): bool
178178
{
179179
return (bool) $this->hasVarData;
180180
}
@@ -249,7 +249,7 @@ public function display(): array
249249
*
250250
* @return string
251251
*/
252-
public function cleanPath($file)
252+
public function cleanPath(string $file): string
253253
{
254254
if (strpos($file, APPPATH) === 0)
255255
{
@@ -284,7 +284,7 @@ public function getBadgeValue()
284284
*
285285
* @return boolean
286286
*/
287-
public function isEmpty()
287+
public function isEmpty(): bool
288288
{
289289
return false;
290290
}
@@ -302,7 +302,7 @@ public function icon(): string
302302
return '';
303303
}
304304

305-
public function getAsArray()
305+
public function getAsArray(): array
306306
{
307307
return [
308308
'title' => $this->getTitle(),

system/Debug/Toolbar/Collectors/Config.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class Config
88
{
9-
public static function display()
9+
public static function display(): array
1010
{
1111
$config = config(App::class);
1212

system/Debug/Toolbar/Collectors/Database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public function display(): array
226226
*
227227
* @return integer
228228
*/
229-
public function getBadgeValue()
229+
public function getBadgeValue(): int
230230
{
231231
return count(static::$queries);
232232
}
@@ -251,7 +251,7 @@ public function getTitleDetails(): string
251251
*
252252
* @return boolean
253253
*/
254-
public function isEmpty()
254+
public function isEmpty(): bool
255255
{
256256
return empty(static::$queries);
257257
}

0 commit comments

Comments
 (0)