diff options
| author | 2025-09-05 09:56:46 -0400 | |
|---|---|---|
| committer | 2025-09-05 15:56:46 +0200 | |
| commit | 23ba48c71f0d41bbe012d668349f6516dad527b4 (patch) | |
| tree | b5680e834c2b87becdded07e0555227ade9d7629 /lib | |
| parent | 3d85eb19380021031e9d1193919ba516bbc99573 (diff) | |
Change how files are included (#7916)
1. `include`, `include_once`, `require` and `require_once` are expressions not functions, parentheses are not necessary.
2. to move up the directory tree, it's better to use the `dirname` function instead of relying on `/..`.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Minz/Configuration.php | 2 | ||||
| -rw-r--r-- | lib/Minz/Extension.php | 2 | ||||
| -rw-r--r-- | lib/Minz/ExtensionManager.php | 2 | ||||
| -rw-r--r-- | lib/Minz/Migrator.php | 2 | ||||
| -rw-r--r-- | lib/Minz/ModelArray.php | 2 | ||||
| -rw-r--r-- | lib/Minz/Paginator.php | 2 | ||||
| -rw-r--r-- | lib/Minz/Translate.php | 2 | ||||
| -rw-r--r-- | lib/http-conditional.php | 2 | ||||
| -rw-r--r-- | lib/lib_rss.php | 8 |
9 files changed, 12 insertions, 12 deletions
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 90beb689f..0d6c8b1f3 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -44,7 +44,7 @@ class Minz_Configuration { * @throws Minz_FileNotExistException if the file does not exist or is invalid. */ public static function load(string $filename): array { - $data = @include($filename); + $data = @include $filename; if (is_array($data) && is_array_keys_string($data)) { return $data; } else { diff --git a/lib/Minz/Extension.php b/lib/Minz/Extension.php index 3129c2e1e..4d529f1d4 100644 --- a/lib/Minz/Extension.php +++ b/lib/Minz/Extension.php @@ -116,7 +116,7 @@ abstract class Minz_Extension { } ob_start(); - include($filename); + include $filename; return ob_get_clean(); } diff --git a/lib/Minz/ExtensionManager.php b/lib/Minz/ExtensionManager.php index 936af82a1..b3a29f9f7 100644 --- a/lib/Minz/ExtensionManager.php +++ b/lib/Minz/ExtensionManager.php @@ -224,7 +224,7 @@ final class Minz_ExtensionManager { $entry_point_filename = $info['path'] . '/' . self::$ext_entry_point; $ext_class_name = $info['entrypoint'] . 'Extension'; - include_once($entry_point_filename); + include_once $entry_point_filename; // Test if the given extension class exists. if (!class_exists($ext_class_name)) { diff --git a/lib/Minz/Migrator.php b/lib/Minz/Migrator.php index c7e8ea15d..94612bfa4 100644 --- a/lib/Minz/Migrator.php +++ b/lib/Minz/Migrator.php @@ -138,7 +138,7 @@ class Minz_Migrator $migration_class = APP_NAME . "_Migration_" . $migration_version; $migration_callback = $migration_class . '::migrate'; - $include_result = @include_once($filepath); + $include_result = @include_once $filepath; if (!$include_result) { Minz_Log::error( "{$filepath} migration file cannot be loaded.", diff --git a/lib/Minz/ModelArray.php b/lib/Minz/ModelArray.php index 89f7f8da4..1aca8470b 100644 --- a/lib/Minz/ModelArray.php +++ b/lib/Minz/ModelArray.php @@ -35,7 +35,7 @@ class Minz_ModelArray { } elseif (($handle = $this->getLock()) === false) { throw new Minz_PermissionDeniedException($this->filename); } else { - $data = include($this->filename); + $data = include $this->filename; $this->releaseLock($handle); if ($data === false) { diff --git a/lib/Minz/Paginator.php b/lib/Minz/Paginator.php index 265b0c2cb..52b170580 100644 --- a/lib/Minz/Paginator.php +++ b/lib/Minz/Paginator.php @@ -55,7 +55,7 @@ class Minz_Paginator { $view = APP_PATH . '/views/helpers/' . $view; if (file_exists($view)) { - include($view); + include $view; } } diff --git a/lib/Minz/Translate.php b/lib/Minz/Translate.php index b57e90bcf..17290574c 100644 --- a/lib/Minz/Translate.php +++ b/lib/Minz/Translate.php @@ -172,7 +172,7 @@ class Minz_Translate { self::$translates[$key] = []; foreach (self::$lang_files[$key] as $lang_pathname) { - $i18n_array = include($lang_pathname); + $i18n_array = include $lang_pathname; if (!is_array($i18n_array)) { Minz_Log::warning('`' . $lang_pathname . '` does not contain a PHP array'); continue; diff --git a/lib/http-conditional.php b/lib/http-conditional.php index c08f72f75..e56732354 100644 --- a/lib/http-conditional.php +++ b/lib/http-conditional.php @@ -16,7 +16,7 @@ declare(strict_types=1); ```php <?php - require_once('http-conditional.php'); + require_once 'http-conditional.php'; //Date of the last modification of the content (Unix Timestamp format). //Examples: query the database, or last modification of a static file. $dateLastModification = ...; diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 27020960e..b7c3817ee 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -43,17 +43,17 @@ function classAutoloader(string $class): void { $components = explode('_', $class); switch (count($components)) { case 1: - include(APP_PATH . '/' . $components[0] . '.php'); + include APP_PATH . '/' . $components[0] . '.php'; return; case 2: - include(APP_PATH . '/Models/' . $components[1] . '.php'); + include APP_PATH . '/Models/' . $components[1] . '.php'; return; case 3: //Controllers, Exceptions - include(APP_PATH . '/' . $components[2] . 's/' . $components[1] . $components[2] . '.php'); + include APP_PATH . '/' . $components[2] . 's/' . $components[1] . $components[2] . '.php'; return; } } elseif (strpos($class, 'Minz') === 0) { - include(LIB_PATH . '/' . str_replace('_', '/', $class) . '.php'); + include LIB_PATH . '/' . str_replace('_', '/', $class) . '.php'; } elseif (str_starts_with($class, 'SimplePie\\')) { $prefix = 'SimplePie\\'; $base_dir = LIB_PATH . '/simplepie/simplepie/src/'; |
