Move the Power, Plugin and Module builders into the container. Many more PHP 8 improvments.

This commit is contained in:
2023-01-29 22:12:42 +02:00
parent e6c02a29f6
commit 7edbe20c33
68 changed files with 3443 additions and 1681 deletions

View File

@@ -32,14 +32,14 @@ abstract class Minify
*
* @var string[]
*/
protected $data = array();
protected $data = [];
/**
* Array of patterns to match.
*
* @var string[]
*/
protected $patterns = array();
protected $patterns = [];
/**
* This array will hold content of strings and regular expressions that have
@@ -50,7 +50,7 @@ abstract class Minify
*
* @var string[]
*/
public $extracted = array();
public $extracted = [];
/**
* Init the minify class - optionally, code may be passed along already.
@@ -279,7 +279,7 @@ abstract class Minify
$output = '';
$processedOffset = 0;
$positions = array_fill(0, count($this->patterns), -1);
$matches = array();
$matches = [];
while ($processedOffset < $contentLength) {
// find first match for all patterns
@@ -435,7 +435,7 @@ abstract class Minify
$content = strtr($content, $this->extracted);
$this->extracted = array();
$this->extracted = [];
return $content;
}

View File

@@ -171,15 +171,15 @@ class Css extends Minify
);
// find all relative imports in css
$matches = array();
$matches = [];
foreach ($importRegexes as $importRegex) {
if (preg_match_all($importRegex, $content, $regexMatches, PREG_SET_ORDER)) {
$matches = [...$matches, ...$regexMatches];
}
}
$search = array();
$replace = array();
$search = [];
$replace = [];
// loop the matches
foreach ($matches as $match) {
@@ -234,8 +234,8 @@ class Css extends Minify
{
$regex = '/url\((["\']?)(.+?)\\1\)/i';
if ($this->importExtensions && preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) {
$search = array();
$replace = array();
$search = [];
$replace = [];
// loop the matches
foreach ($matches as $match) {
@@ -277,7 +277,7 @@ class Css extends Minify
*
* @return string The minified data
*/
public function execute($path = null, $parents = array())
public function execute($path = null, $parents = [])
{
$content = '';
@@ -387,15 +387,15 @@ class Css extends Minify
);
// find all relative urls in css
$matches = array();
$matches = [];
foreach ($relativeRegexes as $relativeRegex) {
if (preg_match_all($relativeRegex, $content, $regexMatches, PREG_SET_ORDER)) {
$matches = [...$matches, ...$regexMatches];
}
}
$search = array();
$replace = array();
$search = [];
$replace = [];
// loop all urls
foreach ($matches as $match) {

View File

@@ -114,10 +114,10 @@ class Converter implements ConverterInterface
// $path could theoretically be empty (e.g. no path is given), in which
// case it shouldn't expand to array(''), which would compare to one's
// root /
$path1 = $path1 ? explode('/', $path1) : array();
$path2 = $path2 ? explode('/', $path2) : array();
$path1 = $path1 ? explode('/', $path1) : [];
$path2 = $path2 ? explode('/', $path2) : [];
$shared = array();
$shared = [];
// compare paths & strip identical ancestors
foreach ($path1 as $i => $chunk) {