Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use static:: instead of self:: for call protected/public functions as well #1469

Merged
merged 1 commit into from
Nov 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions application/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Services extends CoreServices
// {
// if ($getShared)
// {
// return self::getSharedInstance('example');
// return static::getSharedInstance('example');
// }
//
// return new \CodeIgniter\Example();
Expand All @@ -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))
Expand Down
16 changes: 8 additions & 8 deletions application/Views/errors/html/error_exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

<!-- Source -->
<div class="container">
<p><b><?= self::cleanPath($file, $line) ?></b> at line <b><?= $line ?></b></p>
<p><b><?= static::cleanPath($file, $line) ?></b> at line <b><?= $line ?></b></p>

<?php if (is_file($file)) : ?>
<div class="source">
<?= self::highlightFile($file, $line, 15); ?>
<?= static::highlightFile($file, $line, 15); ?>
</div>
<?php endif; ?>
</div>
Expand Down Expand Up @@ -66,11 +66,11 @@
<?php
if (isset($row['function']) && in_array($row['function'], ['include', 'include_once', 'require', 'require_once']))
{
echo $row['function'].' '. self::cleanPath($row['file']);
echo $row['function'].' '. static::cleanPath($row['file']);
}
else
{
echo self::cleanPath($row['file']).' : '.$row['line'];
echo static::cleanPath($row['file']).' : '.$row['line'];
}
?>
<?php else : ?>
Expand Down Expand Up @@ -116,7 +116,7 @@
<!-- Source? -->
<?php if (isset($row['file']) && is_file($row['file']) && isset($row['class'])) : ?>
<div class="source">
<?= self::highlightFile($row['file'], $row['line']) ?>
<?= static::highlightFile($row['file'], $row['line']) ?>
</div>
<?php endif; ?>
</li>
Expand Down Expand Up @@ -342,7 +342,7 @@

<ol>
<?php foreach ($files as $file) :?>
<li><?= htmlspecialchars( self::cleanPath($file), ENT_SUBSTITUTE, 'UTF-8') ?></li>
<li><?= htmlspecialchars( static::cleanPath($file), ENT_SUBSTITUTE, 'UTF-8') ?></li>
<?php endforeach ?>
</ol>
</div>
Expand All @@ -354,11 +354,11 @@
<tbody>
<tr>
<td>Memory Usage</td>
<td><?= self::describeMemory(memory_get_usage(true)) ?></td>
<td><?= static::describeMemory(memory_get_usage(true)) ?></td>
</tr>
<tr>
<td style="width: 12em">Peak Memory Usage:</td>
<td><?= self::describeMemory(memory_get_peak_usage(true)) ?></td>
<td><?= static::describeMemory(memory_get_peak_usage(true)) ?></td>
</tr>
<tr>
<td>Memory Limit:</td>
Expand Down
14 changes: 7 additions & 7 deletions system/ComposerScripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion system/Config/BaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Loading