Skip to content

Commit e00c828

Browse files
committed
Correction in Methods and Spellings
1 parent 9d4ad84 commit e00c828

File tree

15 files changed

+49
-45
lines changed

15 files changed

+49
-45
lines changed

system/CodeIgniter.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public function initialize()
199199
* @param \CodeIgniter\Router\RouteCollectionInterface $routes
200200
* @param boolean $returnResponse
201201
*
202-
* @throws \CodeIgniter\HTTP\RedirectException
202+
* @throws \CodeIgniter\Filters\Exceptions\FilterException
203203
* @throws \Exception
204204
*/
205205
public function run(RouteCollectionInterface $routes = null, bool $returnResponse = false)
@@ -234,7 +234,7 @@ public function run(RouteCollectionInterface $routes = null, bool $returnRespons
234234
{
235235
return $this->handleRequest($routes, $cacheConfig, $returnResponse);
236236
}
237-
catch (Router\RedirectException $e)
237+
catch (\CodeIgniter\Filters\Exceptions\FilterException $e)
238238
{
239239
$logger = Services::logger();
240240
$logger->info('REDIRECTED ROUTE at ' . $e->getMessage());
@@ -280,7 +280,7 @@ public function useSafeOutput(bool $safe = true)
280280
* @return \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\Response|\CodeIgniter\HTTP\ResponseInterface|mixed
281281
* @throws \CodeIgniter\Filters\Exceptions\FilterException
282282
*/
283-
protected function handleRequest(RouteCollectionInterface $routes = null, $cacheConfig, bool $returnResponse = false)
283+
protected function handleRequest(RouteCollectionInterface $routes, $cacheConfig, bool $returnResponse = false)
284284
{
285285
$routeFilter = $this->tryToRouteIt($routes);
286286

@@ -533,7 +533,7 @@ protected function forceSecureAccess($duration = 31536000)
533533
*
534534
* @throws \Exception
535535
*
536-
* @return boolean
536+
* @return bool|\CodeIgniter\HTTP\ResponseInterface
537537
*/
538538
public function displayCache($config)
539539
{
@@ -564,7 +564,9 @@ public function displayCache($config)
564564
$this->response->setBody($output);
565565

566566
return $this->response;
567-
};
567+
}
568+
569+
return false;
568570
}
569571

570572
//--------------------------------------------------------------------
@@ -574,7 +576,7 @@ public function displayCache($config)
574576
*
575577
* @param integer $time
576578
*
577-
* @return $this
579+
* @return void
578580
*/
579581
public static function cache(int $time)
580582
{
@@ -683,7 +685,7 @@ public function displayPerformanceMetrics(string $output): string
683685
*
684686
* @return string
685687
*/
686-
protected function tryToRouteIt(RouteCollectionInterface $routes = null)
688+
protected function tryToRouteIt(RouteCollectionInterface $routes)
687689
{
688690
if (empty($routes) || ! $routes instanceof RouteCollectionInterface)
689691
{

system/Controller.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Controller
106106
* @param ResponseInterface $response
107107
* @param \Psr\Log\LoggerInterface $logger
108108
*
109-
* @throws \CodeIgniter\HTTP\RedirectException
109+
* @throws \CodeIgniter\HTTP\Exceptions\HTTPException
110110
*/
111111
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
112112
{
@@ -135,7 +135,7 @@ public function initController(RequestInterface $request, ResponseInterface $res
135135
* considered secure for. Only with HSTS header.
136136
* Default value is 1 year.
137137
*
138-
* @throws \CodeIgniter\HTTP\RedirectException
138+
* @throws \CodeIgniter\HTTP\Exceptions\HTTPException
139139
*/
140140
public function forceHTTPS(int $duration = 31536000)
141141
{
@@ -179,14 +179,14 @@ protected function loadHelpers()
179179
* A shortcut to performing validation on input data. If validation
180180
* is not successful, a $errors property will be set on this class.
181181
*
182-
* @param array $rules
183-
* @param array $messages An array of custom error messages
182+
* @param array|string $rules
183+
* @param array $messages An array of custom error messages
184184
*
185185
* @return boolean
186186
*/
187187
public function validate($rules, array $messages = []): bool
188188
{
189-
$this->validator = Services::validation();
189+
$this->validator = \Config\Services::validation();
190190

191191
// If you replace the $rules array with the name of the group
192192
if (is_string($rules))
@@ -211,9 +211,8 @@ public function validate($rules, array $messages = []): bool
211211
}
212212

213213
$success = $this->validator
214-
->withRequest($this->request)
215214
->setRules($rules, $messages)
216-
->run();
215+
->run($this->request->getPost());
217216

218217
return $success;
219218
}

system/Entity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ private function castAsJson($value, bool $asArray = false)
566566

567567
if (json_last_error() !== JSON_ERROR_NONE)
568568
{
569-
throw CastException::forInvalidJsonFormatException(json_last_error());
569+
throw \CodeIgniter\Exceptions\CastException::forInvalidJsonFormatException(json_last_error());
570570
}
571571
}
572572
}

system/HTTP/Header.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getName()
9191

9292
/**
9393
* Gets the raw value of the header. This may return either a string
94-
* of an array, depending on whether the header has mutliple values or not.
94+
* of an array, depending on whether the header has multiple values or not.
9595
*
9696
* @return array|null|string
9797
*/

system/HTTP/IncomingRequest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,19 @@ class IncomingRequest extends Request
152152
* @param string $body
153153
* @param \CodeIgniter\HTTP\UserAgent $userAgent
154154
*/
155-
public function __construct($config, $uri = null, $body = 'php://input', UserAgent $userAgent)
155+
public function __construct($config, $uri = null, $body = 'php://input', UserAgent $userAgent = null)
156156
{
157157
// Get our body from php://input
158158
if ($body === 'php://input')
159159
{
160160
$body = file_get_contents('php://input');
161161
}
162162

163+
if($userAgent === null)
164+
{
165+
$userAgent = new \CodeIgniter\HTTP\UserAgent();
166+
}
167+
163168
$this->body = $body;
164169
$this->config = $config;
165170
$this->userAgent = $userAgent;

system/Model.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,6 @@ public function find($id = null)
343343
$this->tempReturnType = $this->returnType;
344344
$this->tempUseSoftDeletes = $this->useSoftDeletes;
345345

346-
$this->reset();
347-
348346
return $row['data'];
349347
}
350348

system/Router/RouteCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class RouteCollection implements RouteCollectionInterface
223223
* Constructor
224224
*
225225
* @param FileLocator $locator
226-
* @param Config/Modules $moduleConfig
226+
* @param \Config\Modules $moduleConfig
227227
*/
228228
public function __construct(FileLocator $locator, $moduleConfig)
229229
{

system/Session/Session.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Session implements SessionInterface
5252
/**
5353
* Instance of the driver to use.
5454
*
55-
* @var HandlerInterface
55+
* @var \CodeIgniter\Log\Handlers\HandlerInterface
5656
*/
5757
protected $driver;
5858

system/Test/ControllerTester.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function controller(string $name)
109109
* @param string $method
110110
* @param array $params
111111
*
112-
* @return \CodeIgniter\TestControllerResponse
112+
* @return \CodeIgniter\Test\ControllerResponse|\InvalidArgumentException
113113
*/
114114
public function execute(string $method, ...$params)
115115
{

system/Validation/FormatRules.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function numeric(string $str = null): bool
196196
*
197197
* @return boolean
198198
*/
199-
public function regex_match(string $str = null, string $pattern, array $data): bool
199+
public function regex_match(string $str, string $pattern, array $data): bool
200200
{
201201
if (strpos($pattern, '/') !== 0)
202202
{
@@ -320,7 +320,7 @@ public function valid_emails(string $str = null): bool
320320
*
321321
* @return boolean
322322
*/
323-
public function valid_ip(string $ip = null, string $which = null, array $data): bool
323+
public function valid_ip(string $ip, string $which, array $data): bool
324324
{
325325
switch (strtolower($which))
326326
{

system/Validation/Rules.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Rules
5656
*
5757
* @return boolean
5858
*/
59-
public function differs(string $str = null, string $field, array $data): bool
59+
public function differs(string $str, string $field, array $data): bool
6060
{
6161
return array_key_exists($field, $data) ? ($str !== $data[$field]) : false;
6262
}
@@ -72,7 +72,7 @@ public function differs(string $str = null, string $field, array $data): bool
7272
*
7373
* @return boolean
7474
*/
75-
public function exact_length(string $str = null, string $val, array $data): bool
75+
public function exact_length(string $str, string $val, array $data): bool
7676
{
7777
if (! is_numeric($val))
7878
{
@@ -93,7 +93,7 @@ public function exact_length(string $str = null, string $val, array $data): bool
9393
*
9494
* @return boolean
9595
*/
96-
public function greater_than(string $str = null, string $min, array $data): bool
96+
public function greater_than(string $str, string $min, array $data): bool
9797
{
9898
return is_numeric($str) ? ($str > $min) : false;
9999
}
@@ -109,7 +109,7 @@ public function greater_than(string $str = null, string $min, array $data): bool
109109
*
110110
* @return boolean
111111
*/
112-
public function greater_than_equal_to(string $str = null, string $min, array $data): bool
112+
public function greater_than_equal_to(string $str, string $min, array $data): bool
113113
{
114114
return is_numeric($str) ? ($str >= $min) : false;
115115
}
@@ -124,7 +124,7 @@ public function greater_than_equal_to(string $str = null, string $min, array $da
124124
* @param array $data
125125
* @return boolean
126126
*/
127-
public function in_list(string $value = null, string $list, array $data): bool
127+
public function in_list(string $value, string $list, array $data): bool
128128
{
129129
$list = explode(',', $list);
130130
$list = array_map(function ($value) {
@@ -150,7 +150,7 @@ public function in_list(string $value = null, string $list, array $data): bool
150150
*
151151
* @return boolean
152152
*/
153-
public function is_unique(string $str = null, string $field, array $data): bool
153+
public function is_unique(string $str, string $field, array $data): bool
154154
{
155155
// Grab any data for exclusion of a single row.
156156
list($field, $ignoreField, $ignoreValue) = array_pad(explode(',', $field), 3, null);
@@ -184,7 +184,7 @@ public function is_unique(string $str = null, string $field, array $data): bool
184184
*
185185
* @return boolean
186186
*/
187-
public function less_than(string $str = null, string $max): bool
187+
public function less_than(string $str, string $max): bool
188188
{
189189
return is_numeric($str) ? ($str < $max) : false;
190190
}
@@ -199,7 +199,7 @@ public function less_than(string $str = null, string $max): bool
199199
*
200200
* @return boolean
201201
*/
202-
public function less_than_equal_to(string $str = null, string $max): bool
202+
public function less_than_equal_to(string $str, string $max): bool
203203
{
204204
return is_numeric($str) ? ($str <= $max) : false;
205205
}
@@ -215,7 +215,7 @@ public function less_than_equal_to(string $str = null, string $max): bool
215215
*
216216
* @return boolean
217217
*/
218-
public function matches(string $str = null, string $field, array $data): bool
218+
public function matches(string $str, string $field, array $data): bool
219219
{
220220
return array_key_exists($field, $data) ? ($str === $data[$field]) : false;
221221
}
@@ -231,7 +231,7 @@ public function matches(string $str = null, string $field, array $data): bool
231231
*
232232
* @return boolean
233233
*/
234-
public function max_length(string $str = null, string $val, array $data): bool
234+
public function max_length(string $str, string $val, array $data): bool
235235
{
236236
if (! is_numeric($val))
237237
{
@@ -252,7 +252,7 @@ public function max_length(string $str = null, string $val, array $data): bool
252252
*
253253
* @return boolean
254254
*/
255-
public function min_length(string $str = null, string $val, array $data): bool
255+
public function min_length(string $str, string $val, array $data): bool
256256
{
257257
if (! is_numeric($val))
258258
{
@@ -271,7 +271,7 @@ public function min_length(string $str = null, string $val, array $data): bool
271271
*
272272
* @return boolean True if valid, false if not
273273
*/
274-
public function required($str = null): bool
274+
public function required($str): bool
275275
{
276276
if (is_object($str))
277277
{
@@ -297,7 +297,7 @@ public function required($str = null): bool
297297
*
298298
* @return boolean
299299
*/
300-
public function required_with($str = null, string $fields, array $data): bool
300+
public function required_with($str, string $fields, array $data): bool
301301
{
302302
$fields = explode(',', $fields);
303303

@@ -349,7 +349,7 @@ public function required_with($str = null, string $fields, array $data): bool
349349
*
350350
* @return boolean
351351
*/
352-
public function required_without($str = null, string $fields, array $data): bool
352+
public function required_without($str, string $fields, array $data): bool
353353
{
354354
$fields = explode(',', $fields);
355355

system/Validation/Validation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,13 @@ protected function loadRuleSets()
540540
*
541541
* @param string|null $group
542542
*
543-
* @return array|void
543+
* @return array|ValidationException|null
544544
*/
545545
public function loadRuleGroup(string $group = null)
546546
{
547547
if (empty($group))
548548
{
549-
return;
549+
return null;
550550
}
551551

552552
if (! isset($this->config->$group))

system/View/Filters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public static function prose(string $value): string
309309
*
310310
* @return string
311311
*/
312-
public static function round($value, $precision = 2, $type = 'common')
312+
public static function round($value, $precision = 2, $type = 'common'): string
313313
{
314314
if (! is_numeric($precision))
315315
{

system/View/Parser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ protected function parseConditionals(string $template): string
530530
extract($this->data);
531531
try
532532
{
533-
$result = eval('?>' . $template . '<?php ');
533+
eval('?>' . $template . '<?php ');
534534
}
535535
catch (\ParseError $e)
536536
{
@@ -627,7 +627,7 @@ protected function prepareReplacement(array $matches, string $replace, bool $esc
627627
*
628628
* @param string $key
629629
*
630-
* @return false|html
630+
* @return false|string
631631
*/
632632
public function shouldAddEscaping(string $key)
633633
{

system/View/View.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class View implements RendererInterface
8181
/**
8282
* Logger instance.
8383
*
84-
* @var Logger
84+
* @var \CodeIgniter\Log\Logger
8585
*/
8686
protected $logger;
8787

@@ -414,7 +414,7 @@ public function getData()
414414
*
415415
* @param string $layout
416416
*
417-
* @return $this
417+
* @return void
418418
*/
419419
public function extend(string $layout)
420420
{

0 commit comments

Comments
 (0)