Merge pull request #1863 from atishamte/typos

Module wise Typos changes
This commit is contained in:
Lonnie Ezell 2019-03-25 22:48:40 -05:00 committed by GitHub
commit 5521894c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 253 additions and 245 deletions

View File

@ -1,7 +1,5 @@
<?php namespace CodeIgniter\Autoloader;
use Composer\Autoload\ClassLoader;
/**
* CodeIgniter
*

View File

@ -204,13 +204,13 @@ class CLI
* $email = CLI::prompt('What is your email?', null, 'required|valid_email');
*
* @param string $field Output "field" question
* @param string|array $options String to a defaul value, array to a list of options (the first option will be the default value)
* @param string|array $options String to a default value, array to a list of options (the first option will be the default value)
* @param string $validation Validation rules
*
* @return string The user input
* @codeCoverageIgnore
*/
public static function prompt($field, $options = null, $validation = null): string
public static function prompt(string $field, $options = null, string $validation = null): string
{
$extra_output = '';
$default = '';
@ -270,7 +270,7 @@ class CLI
* @return boolean
* @codeCoverageIgnore
*/
protected static function validate($field, $value, $rules)
protected static function validate(string $field, string $value, string $rules): bool
{
$validation = \Config\Services::validation(null, false);
$validation->setRule($field, null, $rules);
@ -380,10 +380,12 @@ class CLI
/**
* if operating system === windows
*
* @return boolean
*/
public static function isWindows()
public static function isWindows(): bool
{
return stripos(PHP_OS, 'WIN') === 0;
return stripos(PHP_OS, 'WIN') === 0;
}
//--------------------------------------------------------------------
@ -436,7 +438,7 @@ class CLI
*
* @return string The color coded string
*/
public static function color(string $text, string $foreground, string $background = null, string $format = null)
public static function color(string $text, string $foreground, string $background = null, string $format = null): string
{
if (static::isWindows() && ! isset($_SERVER['ANSICON']))
{
@ -655,7 +657,7 @@ class CLI
* Parses the command line it was called from and collects all
* options and valid segments.
*
* I tried to use getopt but had it fail occassionally to find any
* I tried to use getopt but had it fail occasionally to find any
* options but argc has always had our back. We don't have all of the power
* of getopt but this does us just fine.
*/
@ -706,7 +708,7 @@ class CLI
*
* @return string
*/
public static function getURI()
public static function getURI(): string
{
return implode('/', static::$segments);
}
@ -743,7 +745,7 @@ class CLI
*
* @return array
*/
public static function getSegments()
public static function getSegments(): array
{
return static::$segments;
}
@ -779,7 +781,7 @@ class CLI
*
* @return array
*/
public static function getOptions()
public static function getOptions(): array
{
return static::$options;
}
@ -819,12 +821,12 @@ class CLI
//--------------------------------------------------------------------
/**
* Returns a well formated table
* Returns a well formatted table
*
* @param array $tbody List of rows
* @param array $thead List of columns
*
* @return string
* @return void
*/
public static function table(array $tbody, array $thead = [])
{

View File

@ -63,6 +63,8 @@ class CommandRunner extends Controller
*
* @param string $method
* @param array ...$params
*
* @throws \ReflectionException
*/
public function _remap($method, ...$params)
{
@ -81,6 +83,7 @@ class CommandRunner extends Controller
* @param array $params
*
* @return mixed
* @throws \ReflectionException
*/
public function index(array $params)
{
@ -128,6 +131,8 @@ class CommandRunner extends Controller
/**
* Scans all Commands directories and prepares a list
* of each command with it's group and file.
*
* @throws \ReflectionException
*/
protected function createCommandList()
{

View File

@ -68,7 +68,7 @@ class Console
* @param boolean $useSafeOutput
*
* @return \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\Response|\CodeIgniter\HTTP\ResponseInterface|mixed
* @throws \CodeIgniter\HTTP\RedirectException
* @throws \CodeIgniter\Router\RedirectException
*/
public function run(bool $useSafeOutput = false)
{

View File

@ -37,7 +37,7 @@
*/
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\CriticalError;
use CodeIgniter\Exceptions\CriticalError;
class PredisHandler implements CacheInterface
{

View File

@ -36,7 +36,6 @@
* @filesource
*/
use CodeIgniter\Exceptions\CriticalError;
use CodeIgniter\Cache\CacheInterface;
class RedisHandler implements CacheInterface
@ -106,28 +105,19 @@ class RedisHandler implements CacheInterface
$config = $this->config;
$this->redis = new \Redis();
try
if (!$this->redis->connect($config['host'], ($config['host'][0] === '/' ? 0 : $config['port']), $config['timeout']))
{
if (! $this->redis->connect($config['host'], ($config['host'][0] === '/' ? 0 : $config['port']), $config['timeout'])
)
{
// log_message('error', 'Cache: Redis connection failed. Check your configuration.');
}
if (isset($config['password']) && ! $this->redis->auth($config['password']))
{
log_message('error', 'Cache: Redis authentication failed.');
}
if (isset($config['database']) && ! $this->redis->select($config['database']))
{
log_message('error', 'Cache: Redis select database failed.');
}
log_message('error', 'Cache: Redis connection failed. Check your configuration.');
}
catch (\RedisException $e)
if (isset($config['password']) && !$this->redis->auth($config['password']))
{
throw new CriticalError('Cache: Redis connection refused (' . $e->getMessage() . ')');
log_message('error', 'Cache: Redis authentication failed.');
}
if (isset($config['database']) && !$this->redis->select($config['database']))
{
log_message('error', 'Cache: Redis select database failed.');
}
}

View File

@ -615,7 +615,7 @@ class CodeIgniter
*
* @return array
*/
public function getPerformanceStats()
public function getPerformanceStats(): array
{
return [
'startTime' => $this->startTime,

View File

@ -37,7 +37,6 @@
*/
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
/**
* CI Help command for the spark script.

View File

@ -15,7 +15,7 @@
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*RouRouddfdf
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*

View File

@ -167,6 +167,8 @@ class BaseConfig
/**
* Provides external libraries a simple way to register one or more
* options into a config file.
*
* @throws \ReflectionException
*/
protected function registerProperties()
{

View File

@ -298,7 +298,7 @@ class Exceptions
*
* @return array
*/
protected function collectVars(\Throwable $exception, int $statusCode)
protected function collectVars(\Throwable $exception, int $statusCode): array
{
return [
'title' => get_class($exception),
@ -356,7 +356,7 @@ class Exceptions
*
* @return string
*/
public static function cleanPath($file)
public static function cleanPath(string $file): string
{
if (strpos($file, APPPATH) === 0)
{
@ -403,13 +403,13 @@ class Exceptions
/**
* Creates a syntax-highlighted version of a PHP file.
*
* @param $file
* @param $lineNumber
* @param integer $lines
* @param string $file
* @param integer $lineNumber
* @param integer $lines
*
* @return boolean|string
*/
public static function highlightFile($file, $lineNumber, $lines = 15)
public static function highlightFile(string $file, int $lineNumber, int $lines = 15)
{
if (empty($file) || ! is_readable($file))
{

View File

@ -129,7 +129,7 @@ class Iterator
*
* @return string
*/
public function getReport()
public function getReport(): string
{
if (empty($this->results))
{

View File

@ -146,7 +146,7 @@ class Timer
*
* @return array
*/
public function getTimers(int $decimals = 4)
public function getTimers(int $decimals = 4): array
{
$timers = $this->timers;
@ -172,7 +172,7 @@ class Timer
*
* @return boolean
*/
public function has(string $name)
public function has(string $name): bool
{
return array_key_exists(strtolower($name), $this->timers);
}

View File

@ -273,7 +273,7 @@ class Toolbar
*
* @return array
*/
protected function collectVarData()// : array
protected function collectVarData(): array
{
$data = [];
@ -300,7 +300,7 @@ class Toolbar
*
* @return float
*/
protected function roundTo($number, $increments = 5)
protected function roundTo($number, $increments = 5): float
{
$increments = 1 / $increments;
@ -440,7 +440,7 @@ class Toolbar
*
* @return string
*/
protected function format(string $data, string $format = 'html')
protected function format(string $data, string $format = 'html'): string
{
$data = json_decode($data, true);

View File

@ -172,9 +172,9 @@ class BaseCollector
* Does this Collector have data that should be shown in the
* 'Vars' tab?
*
* @return mixed
* @return boolean
*/
public function hasVarData()
public function hasVarData(): bool
{
return (bool) $this->hasVarData;
}
@ -249,7 +249,7 @@ class BaseCollector
*
* @return string
*/
public function cleanPath($file)
public function cleanPath(string $file): string
{
if (strpos($file, APPPATH) === 0)
{
@ -284,7 +284,7 @@ class BaseCollector
*
* @return boolean
*/
public function isEmpty()
public function isEmpty(): bool
{
return false;
}
@ -302,7 +302,7 @@ class BaseCollector
return '';
}
public function getAsArray()
public function getAsArray(): array
{
return [
'title' => $this->getTitle(),

View File

@ -6,7 +6,7 @@ use CodeIgniter\CodeIgniter;
class Config
{
public static function display()
public static function display(): array
{
$config = config(App::class);

View File

@ -226,7 +226,7 @@ class Database extends BaseCollector
*
* @return integer
*/
public function getBadgeValue()
public function getBadgeValue(): int
{
return count(static::$queries);
}
@ -251,7 +251,7 @@ class Database extends BaseCollector
*
* @return boolean
*/
public function isEmpty()
public function isEmpty(): bool
{
return empty(static::$queries);
}

View File

@ -36,7 +36,7 @@
* @filesource
*/
use CodeIgniter\Services;
use CodeIgniter\Config\Services;
use CodeIgniter\View\RendererInterface;
/**
@ -160,8 +160,10 @@ class Events extends BaseCollector
/**
* Gets the "badge" value for the button.
*
* @return integer
*/
public function getBadgeValue()
public function getBadgeValue(): int
{
return count(\CodeIgniter\Events\Events::getPerformanceLogs());
}

View File

@ -127,7 +127,7 @@ class Files extends BaseCollector
*
* @return integer
*/
public function getBadgeValue()
public function getBadgeValue(): int
{
return count(get_included_files());
}

View File

@ -147,12 +147,12 @@ class History extends BaseCollector
*
* @return integer
*/
public function getBadgeValue()
public function getBadgeValue(): int
{
return count($this->files);
}
public function isEmpty()
public function isEmpty(): bool
{
return empty($this->files);
}

View File

@ -93,8 +93,10 @@ class Logs extends BaseCollector
/**
* Does this collector actually have any data to display?
*
* @return boolean
*/
public function isEmpty()
public function isEmpty(): bool
{
$this->collectLogs();

View File

@ -74,6 +74,7 @@ class Routes extends BaseCollector
* Returns the data of this collector to be formatted in the toolbar
*
* @return array
* @throws \ReflectionException
*/
public function display(): array
{
@ -137,7 +138,7 @@ class Routes extends BaseCollector
*
* @return integer
*/
public function getBadgeValue()
public function getBadgeValue(): int
{
$rawRoutes = Services::routes(true);

View File

@ -154,9 +154,9 @@ class Views extends BaseCollector
* ],
* ];
*
* @return null
* @return array
*/
public function getVarData()
public function getVarData(): array
{
return [
'View Data' => $this->viewer->getData(),
@ -170,7 +170,7 @@ class Views extends BaseCollector
*
* @return integer
*/
public function getBadgeValue()
public function getBadgeValue(): int
{
return count($this->viewer->getPerformanceData());
}

View File

@ -454,6 +454,7 @@ class Entity
* @param $value
*
* @return \CodeIgniter\I18n\Time
* @throws \Exception
*/
protected function mutateDate($value)
{
@ -484,7 +485,7 @@ class Entity
/**
* Provides the ability to cast an item as a specific data type.
* Add ? at the beginning of $type (i.e. ?string) to get NULL instead of castig $value if $value === null
* Add ? at the beginning of $type (i.e. ?string) to get NULL instead of casting $value if $value === null
*
* @param $value
* @param string $type

View File

@ -40,7 +40,6 @@
* @codeCoverageIgnore
*/
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Security\Exceptions\SecurityException;

View File

@ -36,7 +36,6 @@
* @filesource
*/
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Services;
@ -48,7 +47,7 @@ class DebugToolbar implements FilterInterface
*
* @param RequestInterface|\CodeIgniter\HTTP\IncomingRequest $request
*
* @return mixed
* @return void
*/
public function before(RequestInterface $request)
{
@ -63,7 +62,7 @@ class DebugToolbar implements FilterInterface
* @param RequestInterface|\CodeIgniter\HTTP\IncomingRequest $request
* @param ResponseInterface|\CodeIgniter\HTTP\Response $response
*
* @return mixed
* @return void
*/
public function after(RequestInterface $request, ResponseInterface $response)
{

View File

@ -117,7 +117,7 @@ class Filters
* @return \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\ResponseInterface|mixed
* @throws \CodeIgniter\Filters\Exceptions\FilterException
*/
public function run(string $uri, $position = 'before')
public function run(string $uri, string $position = 'before')
{
$this->initialize(strtolower($uri));
@ -142,7 +142,7 @@ class Filters
if ($position === 'before')
{
$result = $class->before($this->request, $this->arguments[$alias] ?? null);
$result = $class->before($this->request);
if ($result instanceof RequestInterface)
{

View File

@ -36,7 +36,6 @@
* @filesource
*/
use CodeIgniter\Filters\FilterInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Config\Services;
@ -49,7 +48,7 @@ class Honeypot implements FilterInterface
* Checks if Honeypot field is empty; if not
* then the requester is a bot
*
* @param CodeIgniter\HTTP\RequestInterface $request
* @param \CodeIgniter\HTTP\RequestInterface $request
*
* @return mixed
*/
@ -65,8 +64,8 @@ class Honeypot implements FilterInterface
/**
* Attach a honypot to the current response.
*
* @param CodeIgniter\HTTP\RequestInterface $request
* @param CodeIgniter\HTTP\ResponseInterface $response
* @param \CodeIgniter\HTTP\RequestInterface $request
* @param \CodeIgniter\HTTP\ResponseInterface $response
* @return mixed
*/
public function after(RequestInterface $request, ResponseInterface $response)

View File

@ -202,11 +202,11 @@ class DownloadResponse extends Message implements ResponseInterface
}
/**
* get Content-Disponsition Header string.
* get Content-Disposition Header string.
*
* @return string
*/
private function getContentDisponsition() : string
private function getContentDisposition() : string
{
$download_filename = $this->getDownloadFileName();
@ -375,7 +375,7 @@ class DownloadResponse extends Message implements ResponseInterface
$this->setContentTypeByMimeType();
}
$this->setHeader('Content-Disposition', $this->getContentDisponsition());
$this->setHeader('Content-Disposition', $this->getContentDisposition());
$this->setHeader('Expires-Disposition', '0');
$this->setHeader('Content-Transfer-Encoding', 'binary');
$this->setHeader('Content-Length', (string)$this->getContentLength());

View File

@ -243,7 +243,7 @@ class FileCollection
new \RecursiveArrayIterator($value), \RecursiveIteratorIterator::SELF_FIRST
);
foreach ($iterator as $key => $value)
foreach ($iterator as $key => $val)
{
array_splice($stack, $iterator->getDepth() + 1);
$pointer = &$stack[count($stack) - 1];
@ -251,7 +251,7 @@ class FileCollection
$stack[] = &$pointer;
if (! $iterator->hasChildren())
{
$pointer[$field] = $value;
$pointer[$field] = $val;
}
}
}
@ -270,7 +270,7 @@ class FileCollection
*
* @return mixed
*/
protected function getValueDotNotationSyntax($index, $value)
protected function getValueDotNotationSyntax(array $index, array $value)
{
if (is_array($index) && ! empty($index))
{

View File

@ -259,11 +259,11 @@ class UploadedFile extends File implements UploadedFileInterface
/**
* Get error string
*
* @staticvar array $errors
* @var array $errors
*
* @return string
*/
public function getErrorString()
public function getErrorString(): string
{
$errors = [
UPLOAD_ERR_OK => lang('HTTP.uploadErrOk'),
@ -393,7 +393,7 @@ class UploadedFile extends File implements UploadedFileInterface
* @param string $fileName the name to rename the file to.
* @return string file full path
*/
public function store($folderName = null, $fileName = null): string
public function store(string $folderName = null, string $fileName = null): string
{
$folderName = $folderName ?? date('Ymd');
$fileName = $fileName ?? $this->getRandomName();

View File

@ -528,7 +528,7 @@ class IncomingRequest extends Request
* Returns an array of all files that have been uploaded with this
* request. Each file is represented by an UploadedFile instance.
*
* @return Files\FileCollection
* @return array
*/
public function getFiles()
{
@ -570,7 +570,7 @@ class IncomingRequest extends Request
* @param string $protocol
* @param string $baseURL
*/
protected function detectURI($protocol, $baseURL)
protected function detectURI(string $protocol, string $baseURL)
{
$this->uri->setPath($this->detectPath($protocol));
@ -612,7 +612,7 @@ class IncomingRequest extends Request
*
* @return string
*/
public function detectPath($protocol = '')
public function detectPath(string $protocol = ''): string
{
if (empty($protocol))
{
@ -648,7 +648,7 @@ class IncomingRequest extends Request
*
* @return string
*/
public function negotiate(string $type, array $supported, bool $strictMatch = false)
public function negotiate(string $type, array $supported, bool $strictMatch = false): string
{
if (is_null($this->negotiator))
{
@ -773,7 +773,7 @@ class IncomingRequest extends Request
*
* @return string
*/
protected function removeRelativeDirectory($uri)
protected function removeRelativeDirectory(string $uri): string
{
$uris = [];
$tok = strtok($uri, '/');

View File

@ -807,7 +807,7 @@ class Response extends Message implements ResponseInterface
/**
* Set a cookie
*
* Accepts an arbitrary number of binds (up to 7) or an associateive
* Accepts an arbitrary number of binds (up to 7) or an associative
* array in the first parameter containing all the values.
*
* @param string|array $name Cookie name or array containing binds

View File

@ -327,7 +327,7 @@ class URI
* @see http://tools.ietf.org/html/rfc3986#section-3.2.2
* @return string The URI host.
*/
public function getHost()
public function getHost(): string
{
return $this->host;
}
@ -539,15 +539,15 @@ class URI
/**
* Builds a representation of the string from the component parts.
*
* @param $scheme
* @param $authority
* @param $path
* @param $query
* @param $fragment
* @param string $scheme
* @param string $authority
* @param string $path
* @param string $query
* @param string $fragment
*
* @return string
*/
public static function createURIString($scheme = null, $authority = null, $path = null, $query = null, $fragment = null)
public static function createURIString(string $scheme = null, string $authority = null, string $path = null, string $query = null, string $fragment = null): string
{
$uri = '';
if (! empty($scheme))
@ -962,9 +962,9 @@ class URI
/**
* Saves our parts from a parse_url call.
*
* @param $parts
* @param array $parts
*/
protected function applyParts($parts)
protected function applyParts(array $parts)
{
if (! empty($parts['host']))
{
@ -1107,7 +1107,7 @@ class URI
*
* @return string
*/
protected function mergePaths(URI $base, URI $reference)
protected function mergePaths(URI $base, URI $reference): string
{
if (! empty($base->getAuthority()) && empty($base->getPath()))
{

View File

@ -1,5 +1,6 @@
<?php namespace CodeIgniter\HTTP;
use CodeIgniter\Database\BasePreparedQuery;
use Config\UserAgents;
class UserAgent
@ -113,7 +114,7 @@ class UserAgent
*
* @return boolean
*/
public function isBrowser($key = null)
public function isBrowser(string $key = null): bool
{
if (! $this->isBrowser)
{
@ -139,7 +140,7 @@ class UserAgent
*
* @return boolean
*/
public function isRobot($key = null)
public function isRobot(string $key = null): bool
{
if (! $this->isRobot)
{
@ -165,7 +166,7 @@ class UserAgent
*
* @return boolean
*/
public function isMobile($key = null)
public function isMobile(string $key = null): bool
{
if (! $this->isMobile)
{
@ -189,7 +190,7 @@ class UserAgent
*
* @return boolean
*/
public function isReferral()
public function isReferral(): bool
{
if (! isset($this->referrer))
{
@ -216,7 +217,7 @@ class UserAgent
*
* @return string
*/
public function getAgentString()
public function getAgentString(): string
{
return $this->agent;
}
@ -228,7 +229,7 @@ class UserAgent
*
* @return string
*/
public function getPlatform()
public function getPlatform(): string
{
return $this->platform;
}
@ -240,7 +241,7 @@ class UserAgent
*
* @return string
*/
public function getBrowser()
public function getBrowser(): string
{
return $this->browser;
}
@ -252,7 +253,7 @@ class UserAgent
*
* @return string
*/
public function getVersion()
public function getVersion(): string
{
return $this->version;
}
@ -264,7 +265,7 @@ class UserAgent
*
* @return string
*/
public function getRobot()
public function getRobot(): string
{
return $this->robot;
}
@ -275,7 +276,7 @@ class UserAgent
*
* @return string
*/
public function getMobile()
public function getMobile(): string
{
return $this->mobile;
}
@ -285,9 +286,9 @@ class UserAgent
/**
* Get the referrer
*
* @return boolean
* @return string
*/
public function getReferrer()
public function getReferrer(): string
{
return empty($_SERVER['HTTP_REFERER']) ? '' : trim($_SERVER['HTTP_REFERER']);
}
@ -301,7 +302,7 @@ class UserAgent
*
* @return void
*/
public function parse($string)
public function parse(string $string)
{
// Reset values
$this->isBrowser = false;
@ -325,7 +326,7 @@ class UserAgent
/**
* Compile the User Agent Data
*
* @return boolean
* @return void
*/
protected function compileData()
{
@ -347,7 +348,7 @@ class UserAgent
*
* @return boolean
*/
protected function setPlatform()
protected function setPlatform(): bool
{
if (is_array($this->config->platforms) && $this->config->platforms)
{
@ -374,7 +375,7 @@ class UserAgent
*
* @return boolean
*/
protected function setBrowser()
protected function setBrowser(): bool
{
if (is_array($this->config->browsers) && $this->config->browsers)
{
@ -402,7 +403,7 @@ class UserAgent
*
* @return boolean
*/
protected function setRobot()
protected function setRobot(): bool
{
if (is_array($this->config->robots) && $this->config->robots)
{
@ -429,7 +430,7 @@ class UserAgent
*
* @return boolean
*/
protected function setMobile()
protected function setMobile(): bool
{
if (is_array($this->config->mobiles) && $this->config->mobiles)
{
@ -455,7 +456,7 @@ class UserAgent
*
* @return string
*/
public function __toString()
public function __toString(): string
{
return $this->getAgentString();
}

View File

@ -184,6 +184,7 @@ class Time extends DateTime
* @param string|null $locale
*
* @return \CodeIgniter\I18n\Time
* @throws \Exception
*/
public static function yesterday($timezone = null, string $locale = null)
{
@ -199,6 +200,7 @@ class Time extends DateTime
* @param string|null $locale
*
* @return \CodeIgniter\I18n\Time
* @throws \Exception
*/
public static function tomorrow($timezone = null, string $locale = null)
{
@ -257,6 +259,7 @@ class Time extends DateTime
* @param string|null $locale
*
* @return \CodeIgniter\I18n\Time
* @throws \Exception
*/
public static function create(int $year = null, int $month = null, int $day = null, int $hour = null, int $minutes = null, int $seconds = null, $timezone = null, string $locale = null)
{
@ -281,6 +284,7 @@ class Time extends DateTime
* @param DateTimeZone $timeZone
*
* @return \CodeIgniter\I18n\Time
* @throws \Exception
*/
public static function createFromFormat($format, $datetime, $timeZone = null)
{
@ -299,6 +303,7 @@ class Time extends DateTime
* @param string|null $locale
*
* @return \CodeIgniter\I18n\Time
* @throws \Exception
*/
public static function createFromTimestamp(int $timestamp, $timeZone = null, string $locale = null)
{
@ -314,6 +319,7 @@ class Time extends DateTime
* @param string|null $locale
*
* @return \CodeIgniter\I18n\Time
* @throws \Exception
*/
public static function instance(\DateTime $dateTime, string $locale = null)
{
@ -329,6 +335,7 @@ class Time extends DateTime
* Converts the current instance to a mutable DateTime object.
*
* @return \DateTime
* @throws \Exception
*/
public function toDateTime()
{
@ -349,6 +356,8 @@ class Time extends DateTime
* @param \CodeIgniter\I18n\Time|string $datetime
* @param null $timezone
* @param string|null $locale
*
* @throws \Exception
*/
public static function setTestNow($datetime = null, $timezone = null, string $locale = null)
{
@ -394,7 +403,7 @@ class Time extends DateTime
*
* @return string
*/
public function getYear()
public function getYear(): string
{
return $this->toLocalizedString('Y');
}
@ -406,7 +415,7 @@ class Time extends DateTime
*
* @return string
*/
public function getMonth()
public function getMonth(): string
{
return $this->toLocalizedString('M');
}
@ -418,7 +427,7 @@ class Time extends DateTime
*
* @return string
*/
public function getDay()
public function getDay(): string
{
return $this->toLocalizedString('d');
}
@ -430,7 +439,7 @@ class Time extends DateTime
*
* @return string
*/
public function getHour()
public function getHour(): string
{
return $this->toLocalizedString('H');
}
@ -442,7 +451,7 @@ class Time extends DateTime
*
* @return string
*/
public function getMinute()
public function getMinute(): string
{
return $this->toLocalizedString('m');
}
@ -454,7 +463,7 @@ class Time extends DateTime
*
* @return string
*/
public function getSecond()
public function getSecond(): string
{
return $this->toLocalizedString('s');
}
@ -466,7 +475,7 @@ class Time extends DateTime
*
* @return string
*/
public function getDayOfWeek()
public function getDayOfWeek(): string
{
return $this->toLocalizedString('c');
}
@ -478,7 +487,7 @@ class Time extends DateTime
*
* @return string
*/
public function getDayOfYear()
public function getDayOfYear(): string
{
return $this->toLocalizedString('D');
}
@ -490,7 +499,7 @@ class Time extends DateTime
*
* @return string
*/
public function getWeekOfMonth()
public function getWeekOfMonth(): string
{
return $this->toLocalizedString('W');
}
@ -502,7 +511,7 @@ class Time extends DateTime
*
* @return string
*/
public function getWeekOfYear()
public function getWeekOfYear(): string
{
return $this->toLocalizedString('w');
}
@ -528,7 +537,7 @@ class Time extends DateTime
*
* @return string
*/
public function getQuarter()
public function getQuarter(): string
{
return $this->toLocalizedString('Q');
}
@ -562,7 +571,7 @@ class Time extends DateTime
* Returns boolean whether the passed timezone is the same as
* the local timezone.
*/
public function getLocal()
public function getLocal(): bool
{
$local = date_default_timezone_get();
@ -574,17 +583,17 @@ class Time extends DateTime
/**
* Returns boolean whether object is in UTC.
*/
public function getUtc()
public function getUtc(): bool
{
return $this->getOffset() === 0;
}
/**
* Reeturns the name of the current timezone.
* Returns the name of the current timezone.
*
* @return string
*/
public function getTimezoneName()
public function getTimezoneName(): string
{
return $this->timezone->getName();
}
@ -709,6 +718,7 @@ class Time extends DateTime
* @param $value
*
* @return \CodeIgniter\I18n\Time
* @throws \Exception
*/
protected function setValue(string $name, $value)
{
@ -976,6 +986,7 @@ class Time extends DateTime
* @param string|null $format
*
* @return string
* @throws \Exception
*/
public function toLocalizedString(?string $format = null)
{
@ -999,6 +1010,7 @@ class Time extends DateTime
* @param string|null $timezone
*
* @return boolean
* @throws \Exception
*/
public function equals($testTime, string $timezone = null): bool
{
@ -1124,7 +1136,7 @@ class Time extends DateTime
{
$before = $days < 0;
// Yesterday/Tommorrow special cases
// Yesterday/Tomorrow special cases
if (abs($days) === 1)
{
return $before ? lang('Time.yesterday') : lang('Time.tomorrow');
@ -1240,8 +1252,9 @@ class Time extends DateTime
* Outputs a short format version of the datetime.
*
* @return string
* @throws \Exception
*/
public function __toString()
public function __toString(): string
{
return IntlDateFormatter::formatObject($this->toDateTime(), $this->toStringFormat, $this->locale);
}

View File

@ -260,7 +260,7 @@ class TimeDifference
}
/**
* Allow property-like access to our calucalated values.
* Allow property-like access to our calculated values.
*
* @param $name
*

View File

@ -22,7 +22,7 @@ class ImageException extends FrameworkException implements ExceptionInterface
public static function forInvalidImageCreate(string $extra = null)
{
return new static(lang('Images.unsupportedImagecreate') . ' ' . $extra);
return new static(lang('Images.unsupportedImageCreate') . ' ' . $extra);
}
public static function forSaveFailed()

View File

@ -21,7 +21,7 @@ return [
'gifNotSupported' => 'GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead.',
'jpgNotSupported' => 'JPG images are not supported.',
'pngNotSupported' => 'PNG images are not supported.',
'unsupportedImagecreate' => 'Your server does not support the GD function required to process this type of image.',
'unsupportedImageCreate' => 'Your server does not support the GD function required to process this type of image.',
'jpgOrPngRequired' => 'The image resize protocol specified in your preferences only works with JPEG or PNG image types.',
'rotateUnsupported' => 'Image rotation does not appear to be supported by your server.',
'libPathInvalid' => 'The path to your image library is not correct. Please set the correct path in your image preferences. {0, string)',

View File

@ -38,7 +38,7 @@
use CodeIgniter\Events\Events;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\Services;
use CodeIgniter\Config\Services;
/**
* Class ChromeLoggerHandler
@ -61,7 +61,7 @@ class ChromeLoggerHandler extends BaseHandler implements HandlerInterface
const VERSION = 1.0;
/**
* The number of strack frames returned from the backtrace.
* The number of track frames returned from the backtrace.
*
* @var integer
*/

View File

@ -36,8 +36,6 @@
* @filesource
*/
use CodeIgniter\Log\Exceptions\LogException;
/**
* Log error messages to file system
*/
@ -96,6 +94,7 @@ class FileHandler extends BaseHandler implements HandlerInterface
* @param $message
*
* @return boolean
* @throws \Exception
*/
public function handle($level, $message): bool
{

View File

@ -384,7 +384,7 @@ class Model
/**
* Returns the first row of the result set. Will take any previous
* Query Builder calls into account when determing the result set.
* Query Builder calls into account when determining the result set.
*
* @return array|object|null
*/
@ -429,7 +429,7 @@ class Model
*
* @return $this
*/
public function set($key, $value = '', bool $escape = null)
public function set($key, string $value = '', bool $escape = null)
{
$data = is_array($key)
? $key
@ -1356,7 +1356,7 @@ class Model
*
* @return array
*/
protected function cleanValidationRules($rules, array $data = null): array
protected function cleanValidationRules(array $rules, array $data = null): array
{
if (empty($data))
{

View File

@ -156,7 +156,7 @@ class RouteCollection implements RouteCollectionInterface
/**
* The current method that the script is being called by.
*
* @var
* @var string
*/
protected $HTTPVerb;
@ -248,7 +248,7 @@ class RouteCollection implements RouteCollectionInterface
* @param string|array $placeholder
* @param string $pattern
*
* @return mixed
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
public function addPlaceholder($placeholder, string $pattern = null): RouteCollectionInterface
{
@ -270,7 +270,7 @@ class RouteCollection implements RouteCollectionInterface
*
* @param $value
*
* @return mixed
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
public function setDefaultNamespace(string $value): RouteCollectionInterface
{
@ -288,7 +288,7 @@ class RouteCollection implements RouteCollectionInterface
*
* @param $value
*
* @return mixed
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
public function setDefaultController(string $value): RouteCollectionInterface
{
@ -305,7 +305,7 @@ class RouteCollection implements RouteCollectionInterface
*
* @param $value
*
* @return mixed
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
public function setDefaultMethod(string $value): RouteCollectionInterface
{
@ -325,7 +325,7 @@ class RouteCollection implements RouteCollectionInterface
*
* @param boolean $value
*
* @return mixed
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
public function setTranslateURIDashes(bool $value): RouteCollectionInterface
{
@ -483,9 +483,9 @@ class RouteCollection implements RouteCollectionInterface
//--------------------------------------------------------------------
/**
* Returns the current value of the translateURIDashses setting.
* Returns the current value of the translateURIDashes setting.
*
* @return mixed
* @return boolean
*/
public function shouldTranslateURIDashes(): bool
{
@ -555,7 +555,7 @@ class RouteCollection implements RouteCollectionInterface
*
* @return array
*/
public function getRoutesOptions(string $from = null)
public function getRoutesOptions(string $from = null): array
{
return $from ? $this->routesOptions[$from] ?? [] : $this->routesOptions;
}
@ -887,10 +887,10 @@ class RouteCollection implements RouteCollectionInterface
* Example:
* $route->match( ['get', 'post'], 'users/(:num)', 'users/$1);
*
* @param array $verbs
* @param $from
* @param $to
* @param array $options
* @param array $verbs
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -911,9 +911,9 @@ class RouteCollection implements RouteCollectionInterface
/**
* Specifies a route that is only available to GET requests.
*
* @param $from
* @param $to
* @param array $options
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -929,9 +929,9 @@ class RouteCollection implements RouteCollectionInterface
/**
* Specifies a route that is only available to POST requests.
*
* @param $from
* @param $to
* @param array $options
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -947,9 +947,9 @@ class RouteCollection implements RouteCollectionInterface
/**
* Specifies a route that is only available to PUT requests.
*
* @param $from
* @param $to
* @param array $options
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -965,9 +965,9 @@ class RouteCollection implements RouteCollectionInterface
/**
* Specifies a route that is only available to DELETE requests.
*
* @param $from
* @param $to
* @param array $options
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -983,9 +983,9 @@ class RouteCollection implements RouteCollectionInterface
/**
* Specifies a route that is only available to HEAD requests.
*
* @param $from
* @param $to
* @param array $options
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -1001,9 +1001,9 @@ class RouteCollection implements RouteCollectionInterface
/**
* Specifies a route that is only available to PATCH requests.
*
* @param $from
* @param $to
* @param array $options
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -1019,9 +1019,9 @@ class RouteCollection implements RouteCollectionInterface
/**
* Specifies a route that is only available to OPTIONS requests.
*
* @param $from
* @param $to
* @param array $options
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -1037,9 +1037,9 @@ class RouteCollection implements RouteCollectionInterface
/**
* Specifies a route that is only available to command-line requests.
*
* @param $from
* @param $to
* @param array $options
* @param string $from
* @param string|array $to
* @param array $options
*
* @return \CodeIgniter\Router\RouteCollectionInterface
*/
@ -1225,10 +1225,10 @@ class RouteCollection implements RouteCollectionInterface
* the request method(s) that this route will work for. They can be separated
* by a pipe character "|" if there is more than one.
*
* @param string $verb
* @param string $from
* @param $to
* @param array|null $options
* @param string $verb
* @param string $from
* @param string|array $to
* @param array $options
*/
protected function create(string $verb, string $from, $to, array $options = null)
{
@ -1238,7 +1238,7 @@ class RouteCollection implements RouteCollectionInterface
$from = filter_var($prefix . $from, FILTER_SANITIZE_STRING);
// While we want to add a route within a group of '/',
// it doens't work with matching, so remove them...
// it doesn't work with matching, so remove them...
if ($from !== '/')
{
$from = trim($from, '/');
@ -1341,11 +1341,11 @@ class RouteCollection implements RouteCollectionInterface
* Compares the subdomain(s) passed in against the current subdomain
* on this page request.
*
* @param $subdomains
* @param mixed $subdomains
*
* @return boolean
*/
private function checkSubdomains($subdomains)
private function checkSubdomains($subdomains): bool
{
// CLI calls can't be on subdomain.
if (! isset($_SERVER['HTTP_HOST']))

View File

@ -192,7 +192,7 @@ interface RouteCollectionInterface
//--------------------------------------------------------------------
/**
* Returns the current value of the translateURIDashses setting.
* Returns the current value of the translateURIDashes setting.
*
* @return mixed
*/

View File

@ -264,7 +264,7 @@ class Security
*
* @return string
*/
public function getCSRFHash()
public function getCSRFHash(): string
{
return $this->CSRFHash;
}
@ -276,7 +276,7 @@ class Security
*
* @return string
*/
public function getCSRFTokenName()
public function getCSRFTokenName(): string
{
return $this->CSRFTokenName;
}
@ -287,8 +287,9 @@ class Security
* Sets the CSRF Hash and cookie.
*
* @return string
* @throws \Exception
*/
protected function CSRFSetHash()
protected function CSRFSetHash(): string
{
if ($this->CSRFHash === null)
{

View File

@ -64,49 +64,49 @@ abstract class BaseHandler implements \SessionHandlerInterface
/**
* Cookie prefix
*
* @var type
* @var string
*/
protected $cookiePrefix = '';
/**
* Cookie domain
*
* @var type
* @var string
*/
protected $cookieDomain = '';
/**
* Cookie path
*
* @var type
* @var string
*/
protected $cookiePath = '/';
/**
* Cookie secure?
*
* @var type
* @var boolean
*/
protected $cookieSecure = false;
/**
* Cookie name to use
*
* @var type
* @var string
*/
protected $cookieName;
/**
* Match IP addresses for cookies?
*
* @var type
* @var boolean
*/
protected $matchIP = false;
/**
* Current session ID
*
* @var type
* @var string
*/
protected $sessionID;
@ -201,9 +201,9 @@ abstract class BaseHandler implements \SessionHandlerInterface
* so that the INI is set just in time for the error message to
* be properly generated.
*
* @return mixed
* @return boolean
*/
protected function fail()
protected function fail(): bool
{
ini_set('session.save_path', $this->savePath);

View File

@ -152,7 +152,7 @@ class DatabaseHandler extends BaseHandler implements \SessionHandlerInterface
*
* @return string Serialized session data
*/
public function read($sessionID)
public function read($sessionID): string
{
if ($this->lockSession($sessionID) === false)
{

View File

@ -162,7 +162,7 @@ class FileHandler extends BaseHandler implements \SessionHandlerInterface
*
* @return string Serialized session data
*/
public function read($sessionID)
public function read($sessionID): string
{
// This might seem weird, but PHP 5.6 introduced session_reset(),
// which re-reads session data

View File

@ -115,7 +115,7 @@ class MemcachedHandler extends BaseHandler implements \SessionHandlerInterface
*
* @return boolean
*/
public function open($save_path, $name)
public function open($save_path, $name): bool
{
$this->memcached = new \Memcached();
$this->memcached->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); // required for touch() usage
@ -176,7 +176,7 @@ class MemcachedHandler extends BaseHandler implements \SessionHandlerInterface
*
* @return string Serialized session data
*/
public function read($sessionID)
public function read($sessionID): string
{
if (isset($this->memcached) && $this->lockSession($sessionID))
{
@ -204,7 +204,7 @@ class MemcachedHandler extends BaseHandler implements \SessionHandlerInterface
*
* @return boolean
*/
public function write($sessionID, $sessionData)
public function write($sessionID, $sessionData): bool
{
if (! isset($this->memcached))
{
@ -253,7 +253,7 @@ class MemcachedHandler extends BaseHandler implements \SessionHandlerInterface
*
* @return boolean
*/
public function close()
public function close(): bool
{
if (isset($this->memcached))
{
@ -283,7 +283,7 @@ class MemcachedHandler extends BaseHandler implements \SessionHandlerInterface
*
* @return boolean
*/
public function destroy($session_id)
public function destroy($session_id): bool
{
if (isset($this->memcached, $this->lockKey))
{
@ -306,7 +306,7 @@ class MemcachedHandler extends BaseHandler implements \SessionHandlerInterface
*
* @return boolean
*/
public function gc($maxlifetime)
public function gc($maxlifetime): bool
{
// Not necessary, Memcached takes care of that.
return true;

View File

@ -97,7 +97,7 @@ class Throttler implements ThrottlerInterface
*
* @return integer
*/
public function getTokenTime()
public function getTokenTime(): int
{
return $this->tokenTime;
}
@ -123,7 +123,7 @@ class Throttler implements ThrottlerInterface
* @return boolean
* @internal param int $maxRequests
*/
public function check(string $key, int $capacity, int $seconds, int $cost = 1)
public function check(string $key, int $capacity, int $seconds, int $cost = 1): bool
{
$tokenName = $this->prefix . $key;
@ -193,7 +193,7 @@ class Throttler implements ThrottlerInterface
*
* @return integer
*/
public function time()
public function time(): int
{
return $this->testTime ?? time();
}

View File

@ -287,11 +287,6 @@ class FormatRules
*/
public function valid_emails(string $str = null): bool
{
if (strpos($str, ',') === false)
{
return $this->valid_email(trim($str));
}
foreach (explode(',', $str) as $email)
{
$email = trim($email);

View File

@ -116,7 +116,7 @@ class Validation implements ValidationInterface
/**
* Runs the validation process, returning true/false determining whether
* or not validation was successful.
* validation was successful or not.
*
* @param array $data The array of data to validate.
* @param string $group The pre-defined group of rules to apply.
@ -168,7 +168,7 @@ class Validation implements ValidationInterface
/**
* Check; runs the validation process, returning true or false
* determining whether or not validation was successful.
* determining whether validation was successful or not.
*
* @param mixed $value Value to validation.
* @param string $rule Rule.
@ -202,7 +202,7 @@ class Validation implements ValidationInterface
*
* @return boolean
*/
protected function processRules(string $field, string $label = null, $value, $rules = null, array $data)
protected function processRules(string $field, string $label = null, $value, $rules = null, array $data): bool
{
// If the if_exist rule is defined...
if (in_array('if_exist', $rules))
@ -399,7 +399,7 @@ class Validation implements ValidationInterface
*
* @return array
*/
public function getRules()
public function getRules(): array
{
return $this->rules;
}
@ -615,7 +615,7 @@ class Validation implements ValidationInterface
/**
* Returns the array of errors that were encountered during
* a run() call. The array should be in the followig format:
* a run() call. The array should be in the following format:
*
* [
* 'field1' => 'error message',

View File

@ -118,7 +118,7 @@ class Parser extends View
*
* @return string
*/
public function render(string $view, array $options = null, $saveData = null): string
public function render(string $view, array $options = null, bool $saveData = null): string
{
$start = microtime(true);
if (is_null($saveData))
@ -185,7 +185,7 @@ class Parser extends View
*
* @return string
*/
public function renderString(string $template, array $options = null, $saveData = null): string
public function renderString(string $template, array $options = null, bool $saveData = null): string
{
$start = microtime(true);
if (is_null($saveData))
@ -599,7 +599,7 @@ class Parser extends View
*
* @return string
*/
protected function prepareReplacement(array $matches, string $replace, bool $escape = true)
protected function prepareReplacement(array $matches, string $replace, bool $escape = true): string
{
$orig = array_shift($matches);

View File

@ -68,7 +68,7 @@ class Plugins
*
* @return string
*/
public static function mailto(array $params = [])
public static function mailto(array $params = []): string
{
$email = $params['email'] ?? '';
$title = $params['title'] ?? '';
@ -84,7 +84,7 @@ class Plugins
*
* @return string
*/
public static function safeMailto(array $params = [])
public static function safeMailto(array $params = []): string
{
$email = $params['email'] ?? '';
$title = $params['title'] ?? '';
@ -100,7 +100,7 @@ class Plugins
*
* @return string
*/
public static function lang(array $params = [])
public static function lang(array $params = []): string
{
$line = array_shift($params);
@ -114,7 +114,7 @@ class Plugins
*
* @return string
*/
public static function ValidationErrors(array $params = [])
public static function ValidationErrors(array $params = []): string
{
$validator = \Config\Services::validation();
if (empty($params))
@ -130,7 +130,7 @@ class Plugins
/**
* @param array $params
*
* @return string|
* @return string|false
*/
public static function route(array $params = [])
{
@ -144,7 +144,7 @@ class Plugins
*
* @return string
*/
public static function siteURL(array $params = [])
public static function siteURL(array $params = []): string
{
return site_url(...$params);
}

View File

@ -60,7 +60,7 @@ interface RendererInterface
*
* @return string
*/
public function render(string $view, array $options = null, $saveData = false): string;
public function render(string $view, array $options = null, bool $saveData = false): string;
//--------------------------------------------------------------------
@ -78,7 +78,7 @@ interface RendererInterface
*
* @return string
*/
public function renderString(string $view, array $options = null, $saveData = false): string;
public function renderString(string $view, array $options = null, bool $saveData = false): string;
//--------------------------------------------------------------------

View File

@ -179,7 +179,7 @@ class View implements RendererInterface
*
* @return string
*/
public function render(string $view, array $options = null, $saveData = null): string
public function render(string $view, array $options = null, bool $saveData = null): string
{
$this->renderVars['start'] = microtime(true);
@ -294,7 +294,7 @@ class View implements RendererInterface
*
* @return string
*/
public function renderString(string $view, array $options = null, $saveData = null): string
public function renderString(string $view, array $options = null, bool $saveData = null): string
{
$start = microtime(true);
if (is_null($saveData))
@ -388,7 +388,7 @@ class View implements RendererInterface
*
* @return RendererInterface
*/
public function resetData()
public function resetData(): RendererInterface
{
$this->data = [];
@ -402,7 +402,7 @@ class View implements RendererInterface
*
* @return array
*/
public function getData()
public function getData(): array
{
return $this->data;
}
@ -494,7 +494,7 @@ class View implements RendererInterface
*
* @return string
*/
public function include(string $view, array $options = null, $saveData = null)
public function include(string $view, array $options = null, $saveData = null): string
{
return $this->render($view, $options, $saveData);
}