From e87e6db4e5d3b930f8432a6cb0c99edae07e1ec2 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Mon, 12 Nov 2018 22:26:38 +0700 Subject: [PATCH] use static:: instead of self:: for call protected/public functions as well --- application/Config/Services.php | 4 +- .../Views/errors/html/error_exception.php | 16 ++-- system/ComposerScripts.php | 14 +-- system/Config/BaseService.php | 2 +- system/Config/Services.php | 90 +++++++++---------- system/Database/Config.php | 12 +-- system/Debug/Toolbar.php | 4 +- system/Debug/Toolbar/Views/toolbar.tpl.php | 2 +- system/Email/Email.php | 46 +++++----- system/Events/Events.php | 4 +- system/HTTP/IncomingRequest.php | 2 +- system/HTTP/URI.php | 4 +- system/View/Filters.php | 2 +- user_guide_src/source/concepts/services.rst | 2 +- .../source/extending/core_classes.rst | 2 +- 15 files changed, 103 insertions(+), 103 deletions(-) diff --git a/application/Config/Services.php b/application/Config/Services.php index eb9776585cb4..061d0d781f3e 100644 --- a/application/Config/Services.php +++ b/application/Config/Services.php @@ -25,7 +25,7 @@ class Services extends CoreServices // { // if ($getShared) // { - // return self::getSharedInstance('example'); + // return static::getSharedInstance('example'); // } // // return new \CodeIgniter\Example(); @@ -35,7 +35,7 @@ public static function honeypot(BaseConfig $config = null, $getShared = true) { if ($getShared) { - return self::getSharedInstance('honeypot', $config); + return static::getSharedInstance('honeypot', $config); } if (is_null($config)) diff --git a/application/Views/errors/html/error_exception.php b/application/Views/errors/html/error_exception.php index 1c6b9c299567..476f40f702c2 100644 --- a/application/Views/errors/html/error_exception.php +++ b/application/Views/errors/html/error_exception.php @@ -30,11 +30,11 @@
-

at line

+

at line

- +
@@ -66,11 +66,11 @@ @@ -116,7 +116,7 @@
- +
@@ -342,7 +342,7 @@
    -
  1. +
@@ -354,11 +354,11 @@ Memory Usage - + Peak Memory Usage: - + Memory Limit: diff --git a/system/ComposerScripts.php b/system/ComposerScripts.php index 515d04ea3188..377ccfd56152 100644 --- a/system/ComposerScripts.php +++ b/system/ComposerScripts.php @@ -142,7 +142,7 @@ protected static function removeDir($dir) */ public static function moveEscaper() { - if (class_exists('\\Zend\\Escaper\\Escaper') && file_exists(self::getClassFilePath('\\Zend\\Escaper\\Escaper'))) + if (class_exists('\\Zend\\Escaper\\Escaper') && file_exists(static::getClassFilePath('\\Zend\\Escaper\\Escaper'))) { $base = static::$basePath . 'ZendEscaper'; @@ -155,15 +155,15 @@ public static function moveEscaper() } $files = [ - self::getClassFilePath('\\Zend\\Escaper\\Exception\\ExceptionInterface') => $base . '/Exception/ExceptionInterface.php', - self::getClassFilePath('\\Zend\\Escaper\\Exception\\InvalidArgumentException') => $base . '/Exception/InvalidArgumentException.php', - self::getClassFilePath('\\Zend\\Escaper\\Exception\\RuntimeException') => $base . '/Exception/RuntimeException.php', - self::getClassFilePath('\\Zend\\Escaper\\Escaper') => $base . '/Escaper.php', + static::getClassFilePath('\\Zend\\Escaper\\Exception\\ExceptionInterface') => $base . '/Exception/ExceptionInterface.php', + static::getClassFilePath('\\Zend\\Escaper\\Exception\\InvalidArgumentException') => $base . '/Exception/InvalidArgumentException.php', + static::getClassFilePath('\\Zend\\Escaper\\Exception\\RuntimeException') => $base . '/Exception/RuntimeException.php', + static::getClassFilePath('\\Zend\\Escaper\\Escaper') => $base . '/Escaper.php', ]; foreach ($files as $source => $dest) { - if (! self::moveFile($source, $dest)) + if (! static::moveFile($source, $dest)) { die('Error moving: ' . $source); } @@ -197,7 +197,7 @@ public static function moveKint() mkdir($base, 0755); } - if (! self::moveFile($filename, $base . '/kint.php')) + if (! static::moveFile($filename, $base . '/kint.php')) { die('Error moving: ' . $filename); } diff --git a/system/Config/BaseService.php b/system/Config/BaseService.php index acd87a456098..4da15189cb0f 100644 --- a/system/Config/BaseService.php +++ b/system/Config/BaseService.php @@ -131,7 +131,7 @@ public static function locator(bool $getShared = true) { if ($getShared) { - return self::getSharedInstance('locator'); + return static::getSharedInstance('locator'); } return new \CodeIgniter\Autoloader\FileLocator(new \Config\Autoload()); diff --git a/system/Config/Services.php b/system/Config/Services.php index 78b63285b606..7f724037b7b9 100644 --- a/system/Config/Services.php +++ b/system/Config/Services.php @@ -72,7 +72,7 @@ public static function autoloader(bool $getShared = true) { if ($getShared) { - return self::getSharedInstance('autoloader'); + return static::getSharedInstance('autoloader'); } return new \CodeIgniter\Autoloader\Autoloader(); @@ -93,7 +93,7 @@ public static function cache(\Config\Cache $config = null, bool $getShared = tru { if ($getShared) { - return self::getSharedInstance('cache', $config); + return static::getSharedInstance('cache', $config); } if (! is_object($config)) @@ -119,7 +119,7 @@ public static function clirequest(\Config\App $config = null, bool $getShared = { if ($getShared) { - return self::getSharedInstance('clirequest', $config); + return static::getSharedInstance('clirequest', $config); } if (! is_object($config)) @@ -147,7 +147,7 @@ public static function curlrequest(array $options = [], $response = null, \Confi { if ($getShared === true) { - return self::getSharedInstance('curlrequest', $options, $response, $config); + return static::getSharedInstance('curlrequest', $options, $response, $config); } if (! is_object($config)) @@ -182,7 +182,7 @@ public static function email($config = null, bool $getShared = true) { if ($getShared) { - return self::getSharedInstance('email', $config); + return static::getSharedInstance('email', $config); } if (empty($config)) @@ -191,7 +191,7 @@ public static function email($config = null, bool $getShared = true) } $email = new \CodeIgniter\Email\Email($config); - $email->setLogger(self::logger(true)); + $email->setLogger(static::logger(true)); return $email; } @@ -221,7 +221,7 @@ public static function exceptions( { if ($getShared) { - return self::getSharedInstance('exceptions', $config, $request, $response); + return static::getSharedInstance('exceptions', $config, $request, $response); } if (empty($config)) @@ -259,7 +259,7 @@ public static function filters($config = null, bool $getShared = true) { if ($getShared) { - return self::getSharedInstance('filters', $config); + return static::getSharedInstance('filters', $config); } if (empty($config)) @@ -267,7 +267,7 @@ public static function filters($config = null, bool $getShared = true) $config = new \Config\Filters(); } - return new \CodeIgniter\Filters\Filters($config, self::request(), self::response()); + return new \CodeIgniter\Filters\Filters($config, static::request(), static::response()); } //-------------------------------------------------------------------- @@ -286,7 +286,7 @@ public static function image(string $handler = null, $config = null, bool $getSh { if ($getShared) { - return self::getSharedInstance('image', $handler, $config); + return static::getSharedInstance('image', $handler, $config); } if (empty($config)) @@ -316,7 +316,7 @@ public static function iterator($getShared = true) { if ($getShared) { - return self::getSharedInstance('iterator'); + return static::getSharedInstance('iterator'); } return new \CodeIgniter\Debug\Iterator(); @@ -336,13 +336,13 @@ public static function language(string $locale = null, bool $getShared = true) { if ($getShared) { - return self::getSharedInstance('language', $locale) + return static::getSharedInstance('language', $locale) ->setLocale($locale); } $locale = ! empty($locale) ? $locale - : self::request() + : static::request() ->getLocale(); return new \CodeIgniter\Language\Language($locale); @@ -362,7 +362,7 @@ public static function logger($getShared = true) { if ($getShared) { - return self::getSharedInstance('logger'); + return static::getSharedInstance('logger'); } return new \CodeIgniter\Log\Logger(new \Config\Logger()); @@ -381,7 +381,7 @@ public static function migrations(BaseConfig $config = null, ConnectionInterface { if ($getShared) { - return self::getSharedInstance('migrations', $config, $db); + return static::getSharedInstance('migrations', $config, $db); } $config = empty($config) ? new \Config\Migrations() : $config; @@ -405,12 +405,12 @@ public static function negotiator(\CodeIgniter\HTTP\RequestInterface $request = { if ($getShared) { - return self::getSharedInstance('negotiator', $request); + return static::getSharedInstance('negotiator', $request); } if (is_null($request)) { - $request = self::request(); + $request = static::request(); } return new \CodeIgniter\HTTP\Negotiate($request); @@ -429,7 +429,7 @@ public static function pager($config = null, RendererInterface $view = null, boo { if ($getShared) { - return self::getSharedInstance('pager', $config, $view); + return static::getSharedInstance('pager', $config, $view); } if (empty($config)) @@ -439,7 +439,7 @@ public static function pager($config = null, RendererInterface $view = null, boo if (! $view instanceof RendererInterface) { - $view = self::renderer(); + $view = static::renderer(); } return new \CodeIgniter\Pager\Pager($config, $view); @@ -460,7 +460,7 @@ public static function parser($viewPath = APPPATH . 'Views/', $config = null, bo { if ($getShared) { - return self::getSharedInstance('parser', $viewPath, $config); + return static::getSharedInstance('parser', $viewPath, $config); } if (is_null($config)) @@ -468,7 +468,7 @@ public static function parser($viewPath = APPPATH . 'Views/', $config = null, bo $config = new \Config\View(); } - return new \CodeIgniter\View\Parser($config, $viewPath, self::locator(true), CI_DEBUG, self::logger(true)); + return new \CodeIgniter\View\Parser($config, $viewPath, static::locator(true), CI_DEBUG, static::logger(true)); } //-------------------------------------------------------------------- @@ -488,7 +488,7 @@ public static function renderer($viewPath = null, $config = null, bool $getShare { if ($getShared) { - return self::getSharedInstance('renderer', $viewPath, $config); + return static::getSharedInstance('renderer', $viewPath, $config); } if (is_null($config)) @@ -503,7 +503,7 @@ public static function renderer($viewPath = null, $config = null, bool $getShare $viewPath = $paths->viewDirectory; } - return new \CodeIgniter\View\View($config, $viewPath, self::locator(true), CI_DEBUG, self::logger(true)); + return new \CodeIgniter\View\View($config, $viewPath, static::locator(true), CI_DEBUG, static::logger(true)); } //-------------------------------------------------------------------- @@ -520,7 +520,7 @@ public static function request(\Config\App $config = null, bool $getShared = tru { if ($getShared) { - return self::getSharedInstance('request', $config); + return static::getSharedInstance('request', $config); } if (! is_object($config)) @@ -550,7 +550,7 @@ public static function response(\Config\App $config = null, bool $getShared = tr { if ($getShared) { - return self::getSharedInstance('response', $config); + return static::getSharedInstance('response', $config); } if (! is_object($config)) @@ -575,7 +575,7 @@ public static function redirectResponse(\Config\App $config = null, bool $getSha { if ($getShared) { - return self::getSharedInstance('redirectResponse', $config); + return static::getSharedInstance('redirectResponse', $config); } if (! is_object($config)) @@ -584,7 +584,7 @@ public static function redirectResponse(\Config\App $config = null, bool $getSha } $response = new \CodeIgniter\HTTP\RedirectResponse($config); - $response->setProtocolVersion(self::request() + $response->setProtocolVersion(static::request() ->getProtocolVersion()); return $response; @@ -604,10 +604,10 @@ public static function routes($getShared = true) { if ($getShared) { - return self::getSharedInstance('routes'); + return static::getSharedInstance('routes'); } - return new \CodeIgniter\Router\RouteCollection(self::locator(), config('Modules')); + return new \CodeIgniter\Router\RouteCollection(static::locator(), config('Modules')); } //-------------------------------------------------------------------- @@ -625,12 +625,12 @@ public static function router(\CodeIgniter\Router\RouteCollectionInterface $rout { if ($getShared) { - return self::getSharedInstance('router', $routes); + return static::getSharedInstance('router', $routes); } if (empty($routes)) { - $routes = self::routes(true); + $routes = static::routes(true); } return new \CodeIgniter\Router\Router($routes); @@ -651,7 +651,7 @@ public static function security(\Config\App $config = null, bool $getShared = tr { if ($getShared) { - return self::getSharedInstance('security', $config); + return static::getSharedInstance('security', $config); } if (! is_object($config)) @@ -674,7 +674,7 @@ public static function session(\Config\App $config = null, bool $getShared = tru { if ($getShared) { - return self::getSharedInstance('session', $config); + return static::getSharedInstance('session', $config); } if (! is_object($config)) @@ -682,10 +682,10 @@ public static function session(\Config\App $config = null, bool $getShared = tru $config = config(App::class); } - $logger = self::logger(true); + $logger = static::logger(true); $driverName = $config->sessionDriver; - $driver = new $driverName($config, self::request()->getIpAddress()); + $driver = new $driverName($config, static::request()->getIpAddress()); $driver->setLogger($logger); $session = new \CodeIgniter\Session\Session($driver, $config); @@ -713,10 +713,10 @@ public static function throttler($getShared = true) { if ($getShared) { - return self::getSharedInstance('throttler'); + return static::getSharedInstance('throttler'); } - return new \CodeIgniter\Throttle\Throttler(self::cache()); + return new \CodeIgniter\Throttle\Throttler(static::cache()); } //-------------------------------------------------------------------- @@ -733,7 +733,7 @@ public static function timer($getShared = true) { if ($getShared) { - return self::getSharedInstance('timer'); + return static::getSharedInstance('timer'); } return new \CodeIgniter\Debug\Timer(); @@ -751,7 +751,7 @@ public static function toolbar(\Config\App $config = null, bool $getShared = tru { if ($getShared) { - return self::getSharedInstance('toolbar', $config); + return static::getSharedInstance('toolbar', $config); } if (! is_object($config)) @@ -776,7 +776,7 @@ public static function uri($uri = null, bool $getShared = true) { if ($getShared) { - return self::getSharedInstance('uri', $uri); + return static::getSharedInstance('uri', $uri); } return new \CodeIgniter\HTTP\URI($uri); @@ -796,7 +796,7 @@ public static function validation(\Config\Validation $config = null, bool $getSh { if ($getShared) { - return self::getSharedInstance('validation', $config); + return static::getSharedInstance('validation', $config); } if (is_null($config)) @@ -804,7 +804,7 @@ public static function validation(\Config\Validation $config = null, bool $getSh $config = new \Config\Validation(); } - return new \CodeIgniter\Validation\Validation($config, self::renderer()); + return new \CodeIgniter\Validation\Validation($config, static::renderer()); } //-------------------------------------------------------------------- @@ -821,10 +821,10 @@ public static function viewcell($getShared = true) { if ($getShared) { - return self::getSharedInstance('viewcell'); + return static::getSharedInstance('viewcell'); } - return new \CodeIgniter\View\Cell(self::cache()); + return new \CodeIgniter\View\Cell(static::cache()); } //-------------------------------------------------------------------- @@ -840,7 +840,7 @@ public static function typography($getShared = true) { if ($getShared) { - return self::getSharedInstance('typography'); + return static::getSharedInstance('typography'); } return new \CodeIgniter\Typography\Typography(); diff --git a/system/Database/Config.php b/system/Database/Config.php index c73c2b367234..a8911b1e94cd 100644 --- a/system/Database/Config.php +++ b/system/Database/Config.php @@ -97,7 +97,7 @@ public static function connect($group = null, bool $getShared = true) return static::$instances[$group]; } - self::ensureFactory(); + static::ensureFactory(); if (isset($config->$group)) { @@ -137,7 +137,7 @@ public static function forge(string $group = null) { $config = new \Config\Database(); - self::ensureFactory(); + static::ensureFactory(); if (empty($group)) { @@ -151,7 +151,7 @@ public static function forge(string $group = null) if (! isset(static::$instances[$group])) { - $db = self::connect($group); + $db = static::connect($group); } else { @@ -174,7 +174,7 @@ public static function utils(string $group = null) { $config = new \Config\Database(); - self::ensureFactory(); + static::ensureFactory(); if (empty($group)) { @@ -188,7 +188,7 @@ public static function utils(string $group = null) if (! isset(static::$instances[$group])) { - $db = self::connect($group); + $db = static::connect($group); } else { @@ -211,7 +211,7 @@ public static function seeder(string $group = null) { $config = new \Config\Database(); - return new Seeder($config, self::connect($group)); + return new Seeder($config, static::connect($group)); } //-------------------------------------------------------------------- diff --git a/system/Debug/Toolbar.php b/system/Debug/Toolbar.php index e6f3a5fb359b..d796d29bf222 100644 --- a/system/Debug/Toolbar.php +++ b/system/Debug/Toolbar.php @@ -315,7 +315,7 @@ protected static function format(string $data, string $format = 'html') protected static function renderTimeline(array $collectors, $startTime, int $segmentCount, int $segmentDuration, array& $styles): string { $displayTime = $segmentCount * $segmentDuration; - $rows = self::collectTimelineData($collectors); + $rows = static::collectTimelineData($collectors); $output = ''; $styleCount = 0; @@ -460,7 +460,7 @@ public static function eventHandler() // Show the toolbar if (file_exists($filename)) { - $contents = self::format(file_get_contents($filename), $format); + $contents = static::format(file_get_contents($filename), $format); exit($contents); } diff --git a/system/Debug/Toolbar/Views/toolbar.tpl.php b/system/Debug/Toolbar/Views/toolbar.tpl.php index d70f5091f003..d6b387a63b24 100644 --- a/system/Debug/Toolbar/Views/toolbar.tpl.php +++ b/system/Debug/Toolbar/Views/toolbar.tpl.php @@ -102,7 +102,7 @@ - + diff --git a/system/Email/Email.php b/system/Email/Email.php index 9eb03f6697f8..0ca3c24e42b9 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -1097,8 +1097,8 @@ public function isValidEmail($email) { if (function_exists('idn_to_ascii') && defined('INTL_IDNA_VARIANT_UTS46') && $atpos = strpos($email, '@')) { - $email = self::substr($email, 0, ++ $atpos) . idn_to_ascii( - self::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46 + $email = static::substr($email, 0, ++ $atpos) . idn_to_ascii( + static::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46 ); } @@ -1214,7 +1214,7 @@ public function wordWrap($str, $charlim = null) { // Is the line within the allowed character count? // If so we'll join it to the output and continue - if (self::strlen($line) <= $charlim) + if (static::strlen($line) <= $charlim) { $output .= $line . $this->newline; continue; @@ -1230,10 +1230,10 @@ public function wordWrap($str, $charlim = null) } // Trim the word down - $temp .= self::substr($line, 0, $charlim - 1); - $line = self::substr($line, $charlim - 1); + $temp .= static::substr($line, 0, $charlim - 1); + $line = static::substr($line, $charlim - 1); } - while (self::strlen($line) > $charlim); + while (static::strlen($line) > $charlim); // If $temp contains data it means we had to split up an over-length // word into smaller chunks so we'll add it back to our current line @@ -1438,8 +1438,8 @@ protected function buildMessage() $this->headerStr .= $hdr; } - self::strlen($body) && $body .= $this->newline . $this->newline; - $body .= $this->getMimeMessage() . $this->newline . $this->newline + static::strlen($body) && $body .= $this->newline . $this->newline; + $body .= $this->getMimeMessage() . $this->newline . $this->newline . '--' . $last_boundary . $this->newline . 'Content-Type: multipart/alternative; boundary="' . $alt_boundary . '"' . $this->newline . $this->newline . '--' . $alt_boundary . $this->newline @@ -1646,7 +1646,7 @@ protected function prepQuotedPrintable($str) foreach (explode("\n", $str) as $line) { - $length = self::strlen($line); + $length = static::strlen($line); $temp = ''; // Loop through each character in the line to add soft-wrap @@ -1681,7 +1681,7 @@ protected function prepQuotedPrintable($str) // If we're at the character limit, add the line to the output, // reset our temp variable, and keep on chuggin' - if ((self::strlen($temp) + self::strlen($char)) >= 76) + if ((static::strlen($temp) + static::strlen($char)) >= 76) { $output .= $temp . $escape . $this->CRLF; $temp = ''; @@ -1696,7 +1696,7 @@ protected function prepQuotedPrintable($str) } // get rid of extra CRLF tacked onto the end - return self::substr($output, 0, self::strlen($this->CRLF) * -1); + return static::substr($output, 0, static::strlen($this->CRLF) * -1); } //-------------------------------------------------------------------- @@ -1738,7 +1738,7 @@ protected function prepQEncoding($str) // iconv_mime_encode() will always put a header field name. // We've passed it an empty one, but it still prepends our // encoded string with ': ', so we need to strip it. - return self::substr($output, 2); + return static::substr($output, 2); } $chars = iconv_strlen($str, 'UTF-8'); @@ -1750,20 +1750,20 @@ protected function prepQEncoding($str) } // We might already have this set for UTF-8 - isset($chars) || $chars = self::strlen($str); + isset($chars) || $chars = static::strlen($str); $output = '=?' . $this->charset . '?Q?'; - for ($i = 0, $length = self::strlen($output); $i < $chars; $i ++) + for ($i = 0, $length = static::strlen($output); $i < $chars; $i ++) { $chr = ($this->charset === 'UTF-8' && ICONV_ENABLED === true) ? '=' . implode('=', str_split(strtoupper(bin2hex(iconv_substr($str, $i, 1, $this->charset))), 2)) : '=' . strtoupper(bin2hex($str[$i])); // RFC 2045 sets a limit of 76 characters per line. // We'll append ?= to the end of each line though. - if ($length + ($l = self::strlen($chr)) > 74) + if ($length + ($l = static::strlen($chr)) > 74) { $output .= '?=' . $this->CRLF // EOL . ' =?' . $this->charset . '?Q?' . $chr; // New line - $length = 6 + self::strlen($this->charset) + $l; // Reset the length for the new line + $length = 6 + static::strlen($this->charset) + $l; // Reset the length for the new line } else { @@ -1857,14 +1857,14 @@ public function batchBCCSend() if ($i === $float) { - $chunk[] = self::substr($set, 1); + $chunk[] = static::substr($set, 1); $float += $this->BCCBatchSize; $set = ''; } if ($i === $c - 1) { - $chunk[] = self::substr($set, 1); + $chunk[] = static::substr($set, 1); } } @@ -1978,8 +1978,8 @@ protected function validateEmailForShell(&$email) { if (function_exists('idn_to_ascii') && $atpos = strpos($email, '@')) { - $email = self::substr($email, 0, ++ $atpos) . idn_to_ascii( - self::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46 + $email = static::substr($email, 0, ++ $atpos) . idn_to_ascii( + static::substr($email, $atpos), 0, INTL_IDNA_VARIANT_UTS46 ); } @@ -2265,7 +2265,7 @@ protected function sendCommand($cmd, $data = '') $this->debugMessage[] = '
' . $cmd . ': ' . $reply . '
'; - if ((int) self::substr($reply, 0, 3) !== $resp) + if ((int) static::substr($reply, 0, 3) !== $resp) { $this->setErrorMessage(lang('Email.SMTPError', [$reply])); @@ -2355,9 +2355,9 @@ protected function SMTPAuthenticate() protected function sendData($data) { $data .= $this->newline; - for ($written = $timestamp = 0, $length = self::strlen($data); $written < $length; $written += $result) + for ($written = $timestamp = 0, $length = static::strlen($data); $written < $length; $written += $result) { - if (($result = fwrite($this->SMTPConnect, self::substr($data, $written))) === false) + if (($result = fwrite($this->SMTPConnect, static::substr($data, $written))) === false) { break; } diff --git a/system/Events/Events.php b/system/Events/Events.php index 97eae9a23fe0..41311f1729a5 100644 --- a/system/Events/Events.php +++ b/system/Events/Events.php @@ -174,10 +174,10 @@ public static function trigger($eventName, ...$arguments): bool // Read in our Config/events file so that we have them all! if (! static::$initialized) { - self::initialize(); + static::initialize(); } - $listeners = self::listeners($eventName); + $listeners = static::listeners($eventName); foreach ($listeners as $listener) { diff --git a/system/HTTP/IncomingRequest.php b/system/HTTP/IncomingRequest.php index 749b0c02a03d..577862d45dc7 100755 --- a/system/HTTP/IncomingRequest.php +++ b/system/HTTP/IncomingRequest.php @@ -766,7 +766,7 @@ protected function parseQueryString(): string /** * Remove relative directory (../) and multi slashes (///) * - * Do some final cleaning of the URI and return it, currently only used in self::_parse_request_uri() + * Do some final cleaning of the URI and return it, currently only used in static::_parse_request_uri() * * @param string $uri * diff --git a/system/HTTP/URI.php b/system/HTTP/URI.php index d4f11013f494..6dba62d81209 100644 --- a/system/HTTP/URI.php +++ b/system/HTTP/URI.php @@ -528,7 +528,7 @@ public function getTotalSegments(): int */ public function __toString() { - return self::createURIString( + return static::createURIString( $this->getScheme(), $this->getAuthority(), $this->getPath(), // Absolute URIs should use a "/" for an empty path $this->getQuery(), $this->getFragment() ); @@ -949,7 +949,7 @@ protected function filterPath(string $path = null) // Encode characters $path = preg_replace_callback( - '/(?:[^' . self::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', function (array $matches) { + '/(?:[^' . static::CHAR_UNRESERVED . ':@&=\+\$,\/;%]+|%(?![A-Fa-f0-9]{2}))/', function (array $matches) { return rawurlencode($matches[0]); }, $path ); diff --git a/system/View/Filters.php b/system/View/Filters.php index 4e8521d483de..1ee1e7f27f9c 100644 --- a/system/View/Filters.php +++ b/system/View/Filters.php @@ -87,7 +87,7 @@ public static function date($value, string $format): string */ public static function date_modify($value, string $adjustment): string { - $value = self::date($value, 'Y-m-d H:i:s'); + $value = static::date($value, 'Y-m-d H:i:s'); return strtotime($adjustment, strtotime($value)); } diff --git a/user_guide_src/source/concepts/services.rst b/user_guide_src/source/concepts/services.rst index b15efa8364a5..15e6509df19f 100644 --- a/user_guide_src/source/concepts/services.rst +++ b/user_guide_src/source/concepts/services.rst @@ -126,7 +126,7 @@ within the class, and, if not, creates a new one. All of the factory methods pro return new \CodeIgniter\Router\RouteCollection(); } - return self::getSharedInstance('routes'); + return static::getSharedInstance('routes'); } } diff --git a/user_guide_src/source/extending/core_classes.rst b/user_guide_src/source/extending/core_classes.rst index d8148f07fa62..a427fe8441f8 100644 --- a/user_guide_src/source/extending/core_classes.rst +++ b/user_guide_src/source/extending/core_classes.rst @@ -65,7 +65,7 @@ Then you would modify the ``routes`` service to load your class instead:: return new \App\Libraries\RouteCollection(); } - return self::getSharedInstance('routes'); + return static::getSharedInstance('routes'); } Extending Core Classes