From cefc716f8eb1aa96341751abeb04502472af159c Mon Sep 17 00:00:00 2001 From: DSanchez Date: Thu, 16 Mar 2017 14:46:46 -0400 Subject: [PATCH] Fix deprecating array `[]` format --- lib/Dwoo/Template/File.php | 16 ++++++++-------- lib/Dwoo/Template/Str.php | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/Dwoo/Template/File.php b/lib/Dwoo/Template/File.php index a590fb1..186466d 100644 --- a/lib/Dwoo/Template/File.php +++ b/lib/Dwoo/Template/File.php @@ -8,9 +8,9 @@ * @author David Sanchez * @copyright 2008-2013 Jordi Boggiano * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License + * @license http://dwoo.org/LICENSE LGPLv3 * @version 1.4.0 - * @date 2017-03-09 + * @date 2017-03-16 * @link http://dwoo.org/ */ @@ -42,7 +42,7 @@ class File extends Str * * @var array */ - protected $includePath = []; + protected $includePath = array(); /** * Resolved path cache when looking for a file in multiple include paths. @@ -66,7 +66,7 @@ class File extends Str * template from others, if null it defaults to the filename+bits of the path * @param mixed $includePath a string for a single path to look into for the given file, or an array of paths */ - public function __construct($file, $cacheTime = null, $cacheId = null, $compileId = null, $includePath = []) + public function __construct($file, $cacheTime = null, $cacheId = null, $compileId = null, $includePath = array()) { parent::__construct($file, $cacheTime, $cacheId, $compileId); $this->template = null; @@ -84,7 +84,7 @@ public function __construct($file, $cacheTime = null, $cacheId = null, $compileI public function setIncludePath($paths) { if (is_array($paths) === false) { - $paths = [$paths]; + $paths = array($paths); } $this->includePath = $paths; @@ -144,7 +144,7 @@ public function getResourceIdentifier() { if ($this->resolvedPath !== null) { return $this->resolvedPath; - } elseif (array_filter($this->getIncludePath()) == []) { + } elseif (array_filter($this->getIncludePath()) == array()) { return $this->file; } else { foreach ($this->getIncludePath() as $path) { @@ -202,13 +202,13 @@ public static function templateFactory(Core $core, $resourceId, $cacheTime = nul $compileId = null, ITemplate $parentTemplate = null) { if (DIRECTORY_SEPARATOR === '\\') { - $resourceId = str_replace(["\t", "\n", "\r", "\f", "\v"], [ + $resourceId = str_replace(array("\t", "\n", "\r", "\f", "\v"), array( '\\t', '\\n', '\\r', '\\f', '\\v' - ], $resourceId); + ), $resourceId); } $resourceId = strtr($resourceId, '\\', '/'); diff --git a/lib/Dwoo/Template/Str.php b/lib/Dwoo/Template/Str.php index dd4e9ea..ab81e31 100644 --- a/lib/Dwoo/Template/Str.php +++ b/lib/Dwoo/Template/Str.php @@ -8,9 +8,9 @@ * @author David Sanchez * @copyright 2008-2013 Jordi Boggiano * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License + * @license http://dwoo.org/LICENSE LGPLv3 * @version 1.4.0 - * @date 2017-03-09 + * @date 2017-03-16 * @link http://dwoo.org/ */ @@ -77,10 +77,10 @@ class Str implements ITemplate * * @var array */ - protected static $cache = [ - 'cached' => [], - 'compiled' => [] - ]; + protected static $cache = array( + 'cached' => array(), + 'compiled' => array() + ); /** * Holds the compiler that built this template. @@ -370,7 +370,7 @@ public function getCompiledTemplate(Core $core, ICompiler $compiler = null) if ($compiler === null) { $compiler = $core->getDefaultCompilerFactory($this->getResourceName()); - if ($compiler === null || $compiler === ['Dwoo\Compiler', 'compilerFactory']) { + if ($compiler === null || $compiler === array('Dwoo\Compiler', 'compilerFactory')) { $compiler = Compiler::compilerFactory(); } else { $compiler = call_user_func($compiler);