Skip to content

Commit 2cb40bf

Browse files
committed
Correction in Methods and Spellings
1 parent 1f08145 commit 2cb40bf

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

system/Controller.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* @since Version 3.0.0
3636
* @filesource
3737
*/
38-
38+
use CodeIgniter\Config\Services;
3939
use CodeIgniter\HTTP\RequestInterface;
4040
use CodeIgniter\HTTP\ResponseInterface;
4141
use CodeIgniter\Validation\Validation;
@@ -186,7 +186,7 @@ protected function loadHelpers()
186186
*/
187187
public function validate($rules, array $messages = []): bool
188188
{
189-
$this->validator = \Config\Services::validation();
189+
$this->validator = Services::validation();
190190

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

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

217218
return $success;
218219
}

system/Entity.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php namespace CodeIgniter;
22

33
use CodeIgniter\I18n\Time;
4+
use CodeIgniter\Exceptions\CastException;
45

56
/**
67
* CodeIgniter
@@ -566,7 +567,7 @@ private function castAsJson($value, bool $asArray = false)
566567

567568
if (json_last_error() !== JSON_ERROR_NONE)
568569
{
569-
throw \CodeIgniter\Exceptions\CastException::forInvalidJsonFormatException(json_last_error());
570+
throw CastException::forInvalidJsonFormatException(json_last_error());
570571
}
571572
}
572573
}

system/HTTP/IncomingRequest.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,14 @@ 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 = null)
155+
public function __construct($config, $uri = null, $body = 'php://input', UserAgent $userAgent)
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-
168163
$this->body = $body;
169164
$this->config = $config;
170165
$this->userAgent = $userAgent;

system/Validation/FormatRules.php

Lines changed: 1 addition & 1 deletion
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, string $pattern, array $data): bool
199+
public function regex_match(string $str = null, string $pattern, array $data): bool
200200
{
201201
if (strpos($pattern, '/') !== 0)
202202
{

0 commit comments

Comments
 (0)