From b5ef7a0a6c848713f56a0de08e3e4de1d840a104 Mon Sep 17 00:00:00 2001 From: MGatner Date: Sat, 28 Nov 2020 13:55:12 +0000 Subject: [PATCH] Restore backfilled parameters (moved to 4.1) --- system/Database/Database.php | 7 +------ system/HTTP/IncomingRequest.php | 8 +------- system/Images/Handlers/BaseHandler.php | 8 +------- system/Log/Logger.php | 2 +- system/Router/RouteCollection.php | 8 +------- system/Validation/Rules.php | 19 ++++--------------- system/Validation/Validation.php | 7 +------ 7 files changed, 10 insertions(+), 49 deletions(-) diff --git a/system/Database/Database.php b/system/Database/Database.php index 60c5de4fc431..f5b18720d89f 100644 --- a/system/Database/Database.php +++ b/system/Database/Database.php @@ -41,13 +41,8 @@ class Database * @return mixed * @internal param bool $useBuilder */ - public function load(array $params = [], string $alias = '') + public function load(array $params = [], string $alias) { - if (empty($alias)) - { - throw new InvalidArgumentException('You must supply the parameter: alias.'); - } - // Handle universal DSN connection string if (! empty($params['DSN']) && strpos($params['DSN'], '://') !== false) { diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php index c3b04fab7426..6e4a8b999c7f 100755 --- a/system/HTTP/IncomingRequest.php +++ b/system/HTTP/IncomingRequest.php @@ -16,7 +16,6 @@ use CodeIgniter\HTTP\Files\UploadedFile; use Config\App; use Config\Services; -use InvalidArgumentException; use Locale; /** @@ -129,13 +128,8 @@ class IncomingRequest extends Request * @param string|null $body * @param UserAgent $userAgent */ - public function __construct($config, URI $uri = null, $body = 'php://input', UserAgent $userAgent = null) + public function __construct($config, URI $uri = null, $body = 'php://input', UserAgent $userAgent) { - if (empty($uri) || empty($userAgent)) - { - throw new InvalidArgumentException('You must supply the parameters: uri, userAgent.'); - } - // Get our body from php://input if ($body === 'php://input') { diff --git a/system/Images/Handlers/BaseHandler.php b/system/Images/Handlers/BaseHandler.php index f591cd693e40..c4e9146c0d2b 100644 --- a/system/Images/Handlers/BaseHandler.php +++ b/system/Images/Handlers/BaseHandler.php @@ -15,7 +15,6 @@ use CodeIgniter\Images\Image; use CodeIgniter\Images\ImageHandlerInterface; use Config\Images; -use InvalidArgumentException; /** * Base image handling implementation @@ -663,13 +662,8 @@ public function fit(int $width, int $height = null, string $position = 'center') * * @return array */ - protected function calcAspectRatio($width, $height = null, $origWidth = 0, $origHeight = 0): array + protected function calcAspectRatio($width, $height = null, $origWidth, $origHeight): array { - if (empty($origWidth) || empty($origHeight)) - { - throw new InvalidArgumentException('You must supply the parameters: origWidth, origHeight.'); - } - // If $height is null, then we have it easy. // Calc based on full image size and be done. if (is_null($height)) diff --git a/system/Log/Logger.php b/system/Log/Logger.php index d3054ef0f6ed..d289480dfe5e 100644 --- a/system/Log/Logger.php +++ b/system/Log/Logger.php @@ -462,7 +462,7 @@ public function determineFile(): array ]; // Generate Backtrace info - $trace = \debug_backtrace(0); + $trace = \debug_backtrace(false); // So we search from the bottom (earliest) of the stack frames $stackFrames = \array_reverse($trace); diff --git a/system/Router/RouteCollection.php b/system/Router/RouteCollection.php index 0c4c99a97af7..f8d0d392a702 100644 --- a/system/Router/RouteCollection.php +++ b/system/Router/RouteCollection.php @@ -17,7 +17,6 @@ use CodeIgniter\Router\Exceptions\RouterException; use Config\Modules; use Config\Services; -use InvalidArgumentException; /** * Class RouteCollection @@ -989,13 +988,8 @@ public function presenter(string $name, array $options = null): RouteCollectionI * * @return RouteCollectionInterface */ - public function match(array $verbs = [], string $from = '', $to = '', array $options = null): RouteCollectionInterface + public function match(array $verbs = [], string $from, $to, array $options = null): RouteCollectionInterface { - if (empty($from) || empty($to)) - { - throw new InvalidArgumentException('You must supply the parameters: from, to.'); - } - foreach ($verbs as $verb) { $verb = strtolower($verb); diff --git a/system/Validation/Rules.php b/system/Validation/Rules.php index d6bdf3591a46..b7a106770b59 100644 --- a/system/Validation/Rules.php +++ b/system/Validation/Rules.php @@ -12,7 +12,6 @@ namespace CodeIgniter\Validation; use Config\Database; -use InvalidArgumentException; /** * Validation Rules. @@ -353,18 +352,13 @@ public function required($str = null): bool * required_with[password] * * @param string|null $str - * @param string|null $fields List of fields that we should check if present + * @param string $fields List of fields that we should check if present * @param array $data Complete list of fields from the form * * @return boolean */ - public function required_with($str = null, string $fields = null, array $data = []): bool + public function required_with($str = null, string $fields, array $data): bool { - if (is_null($fields) || empty($data)) - { - throw new InvalidArgumentException('You must supply the parameters: fields, data.'); - } - $fields = explode(',', $fields); // If the field is present we can safely assume that @@ -410,18 +404,13 @@ public function required_with($str = null, string $fields = null, array $data = * required_without[id,email] * * @param string|null $str - * @param string|null $fields + * @param string $fields * @param array $data * * @return boolean */ - public function required_without($str = null, string $fields = null, array $data = []): bool + public function required_without($str = null, string $fields, array $data): bool { - if (is_null($fields) || empty($data)) - { - throw new InvalidArgumentException('You must supply the parameters: fields, data.'); - } - $fields = explode(',', $fields); // If the field is present we can safely assume that diff --git a/system/Validation/Validation.php b/system/Validation/Validation.php index 558323c3499a..31b8456d301e 100644 --- a/system/Validation/Validation.php +++ b/system/Validation/Validation.php @@ -206,13 +206,8 @@ public function check($value, string $rule, array $errors = []): bool * * @return boolean */ - protected function processRules(string $field, string $label = null, $value, $rules = null, array $data = null): bool + protected function processRules(string $field, string $label = null, $value, $rules = null, array $data): bool { - if (is_null($data)) - { - throw new InvalidArgumentException('You must supply the parameter: data.'); - } - // If the if_exist rule is defined... if (in_array('if_exist', $rules, true)) {