diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 637d09c..52450e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: run: echo "::set-output name=date::$(date +'%Y-%m')" - name: Cache composer dependencies - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }} diff --git a/src/AssetConfig.php b/src/AssetConfig.php index 4bec41b..5a610f6 100644 --- a/src/AssetConfig.php +++ b/src/AssetConfig.php @@ -255,8 +255,8 @@ protected function resolveExtends(): void if (!$parentConfig) { return $config; } - $config['files'] = array_merge($parentConfig['files'], $config['files']); - $config['filters'] = array_merge($parentConfig['filters'], $config['filters']); + $config['files'] = array_unique(array_merge($parentConfig['files'], $config['files'])); + $config['filters'] = array_unique(array_merge($parentConfig['filters'], $config['filters'])); $config['theme'] = $parentConfig['theme'] || $config['theme']; return $config; diff --git a/src/AssetProcess.php b/src/AssetProcess.php index c2f0b0e..0120dfe 100644 --- a/src/AssetProcess.php +++ b/src/AssetProcess.php @@ -105,7 +105,7 @@ public function run(?string $input = null): string $descriptorSpec, $pipes, null, - $this->_env + $this->_env, ); if (is_resource($process)) { fwrite($pipes[0], $input); diff --git a/src/Cli/BuildTask.php b/src/Cli/BuildTask.php index 17af4c2..2316e57 100644 --- a/src/Cli/BuildTask.php +++ b/src/Cli/BuildTask.php @@ -64,7 +64,7 @@ protected function addArguments(): void 'description' => 'The config file to use.', 'required' => true, ], - ] + ], ); } diff --git a/src/Cli/ClearTask.php b/src/Cli/ClearTask.php index a5b88be..695e344 100644 --- a/src/Cli/ClearTask.php +++ b/src/Cli/ClearTask.php @@ -49,7 +49,7 @@ protected function addArguments(): void 'description' => 'The config file to use.', 'required' => true, ], - ] + ], ); } diff --git a/src/Factory.php b/src/Factory.php index e546bbc..8233c70 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -77,7 +77,7 @@ public function cachedCompiler(string $outputDir = '', bool $debug = false): Cac { return new CachedCompiler( $this->cacher($outputDir), - $this->compiler($debug) + $this->compiler($debug), ); } diff --git a/src/Filter/ClosureCompiler.php b/src/Filter/ClosureCompiler.php index bd6aa12..2623a97 100644 --- a/src/Filter/ClosureCompiler.php +++ b/src/Filter/ClosureCompiler.php @@ -136,7 +136,7 @@ protected function _query(string $content, array $args = []): string|bool CURLOPT_RETURNTRANSFER => 1, CURLOPT_HEADER => 0, CURLOPT_FOLLOWLOCATION => 0, - ] + ], ); $output = curl_exec($ch); diff --git a/src/Filter/CssDependencyTrait.php b/src/Filter/CssDependencyTrait.php index d636149..69ad149 100644 --- a/src/Filter/CssDependencyTrait.php +++ b/src/Filter/CssDependencyTrait.php @@ -147,7 +147,7 @@ protected function _prependPrefixToFilename(string $name): string return str_replace( $ds . $filename, $ds . $this->optionalDependencyPrefix . $filename, - $name + $name, ); } } diff --git a/src/Filter/FilterRegistry.php b/src/Filter/FilterRegistry.php index 13933fa..dee6f05 100644 --- a/src/Filter/FilterRegistry.php +++ b/src/Filter/FilterRegistry.php @@ -114,7 +114,7 @@ public function collection(AssetTarget $target): FilterCollection [ 'target' => $target->name(), 'paths' => $target->paths(), - ] + ], ); $filters[] = $copy; } diff --git a/src/Filter/Hogan.php b/src/Filter/Hogan.php index 896067d..670a347 100644 --- a/src/Filter/Hogan.php +++ b/src/Filter/Hogan.php @@ -106,7 +106,7 @@ protected function _generateScript(string $file, string $filename, string $input json_encode($input), json_encode($config), $id, - $filepath + $filepath, ); file_put_contents($file, $contents); } diff --git a/src/Filter/ImportInline.php b/src/Filter/ImportInline.php index 7eb7f76..f0f3284 100644 --- a/src/Filter/ImportInline.php +++ b/src/Filter/ImportInline.php @@ -53,7 +53,7 @@ public function input(string $filename, string $content): string return preg_replace_callback( $this->_pattern, [$this, '_replace'], - $content + $content, ); } diff --git a/src/Filter/JSqueezeFilter.php b/src/Filter/JSqueezeFilter.php index 9f47ad1..abb7b18 100644 --- a/src/Filter/JSqueezeFilter.php +++ b/src/Filter/JSqueezeFilter.php @@ -58,7 +58,7 @@ public function output(string $target, string $content): string $content, $this->_settings['singleLine'], $this->_settings['keepImportantComments'], - $this->_settings['specialVarRx'] + $this->_settings['specialVarRx'], ); } } diff --git a/src/Filter/LessCss.php b/src/Filter/LessCss.php index 1a8cb54..c5d8e3d 100644 --- a/src/Filter/LessCss.php +++ b/src/Filter/LessCss.php @@ -75,7 +75,7 @@ protected function _generateScript(string $file, string $content): void JS; file_put_contents( $file, - sprintf($text, str_replace('\/*', '', json_encode($this->_settings['paths'])), json_encode($content)) + sprintf($text, str_replace('\/*', '', json_encode($this->_settings['paths'])), json_encode($content)), ); } } diff --git a/src/Filter/LessDotPHP.php b/src/Filter/LessDotPHP.php index ca86592..a08752a 100644 --- a/src/Filter/LessDotPHP.php +++ b/src/Filter/LessDotPHP.php @@ -49,7 +49,7 @@ public function input(string $filename, string $content): string } if (!class_exists('\Less_Parser')) { throw new Exception( - 'Cannot not load "\Less_Parser" class. Make sure https://github.com/oyejorge/less.php is installed.' + 'Cannot not load "\Less_Parser" class. Make sure https://github.com/oyejorge/less.php is installed.', ); } $parser = new Less_Parser(); diff --git a/src/Filter/Sprockets.php b/src/Filter/Sprockets.php index 9102a2f..814c465 100644 --- a/src/Filter/Sprockets.php +++ b/src/Filter/Sprockets.php @@ -73,7 +73,7 @@ public function input(string $filename, string $content): string return preg_replace_callback( $this->_pattern, [$this, '_replace'], - $content + $content, ); } diff --git a/tests/TestCase/AssetConfigTest.php b/tests/TestCase/AssetConfigTest.php index 19e8d1e..1b4c0ed 100644 --- a/tests/TestCase/AssetConfigTest.php +++ b/tests/TestCase/AssetConfigTest.php @@ -80,7 +80,7 @@ public function testLoadUpdatesModifiedTime() $this->assertEquals( filemtime($this->_themeConfig), $config->modifiedTime(), - 'Reflects last updated config file' + 'Reflects last updated config file', ); } @@ -148,7 +148,7 @@ public function testAddTarget() 'testing.js', [ 'files' => ['one.js', 'two.js'], - ] + ], ); $this->assertEquals(['one.js', 'two.js'], $this->config->files('testing.js')); } @@ -161,11 +161,11 @@ public function testAddTargetThemed() 'files' => ['one.js', 'two.js'], 'filters' => ['uglify'], 'theme' => true, - ] + ], ); $this->assertEquals( ['one.js', 'two.js'], - $this->config->files('testing-two.js') + $this->config->files('testing-two.js'), ); $this->assertTrue($this->config->isThemed('testing-two.js')); } @@ -176,14 +176,14 @@ public function testRequires() 'testing.js', [ 'files' => ['one.js', 'two.js'], - ] + ], ); $this->config->addTarget( 'child.js', [ 'files' => ['one.js', 'two.js'], 'require' => 'base.js', - ] + ], ); $this->assertEquals([], $this->config->requires('testing.js')); $this->assertEquals(['base.js'], $this->config->requires('child.js')); diff --git a/tests/TestCase/Cli/BuildTaskTest.php b/tests/TestCase/Cli/BuildTaskTest.php index 6a18c00..f1ca711 100644 --- a/tests/TestCase/Cli/BuildTaskTest.php +++ b/tests/TestCase/Cli/BuildTaskTest.php @@ -36,7 +36,7 @@ protected function setUp(): void $config = AssetConfig::buildFromIniFile( APP . 'config/integration.ini', - ['WEBROOT' => TMP] + ['WEBROOT' => TMP], ); $this->task = new BuildTask($cli, $config); $this->cli = $cli; diff --git a/tests/TestCase/Cli/ClearTaskTest.php b/tests/TestCase/Cli/ClearTaskTest.php index 7da9732..3dacdaa 100644 --- a/tests/TestCase/Cli/ClearTaskTest.php +++ b/tests/TestCase/Cli/ClearTaskTest.php @@ -36,7 +36,7 @@ protected function setUp(): void $config = AssetConfig::buildFromIniFile( APP . 'config/integration.ini', - ['WEBROOT' => TMP] + ['WEBROOT' => TMP], ); $this->task = new ClearTask($cli, $config); $this->cli = $cli; diff --git a/tests/TestCase/FactoryTest.php b/tests/TestCase/FactoryTest.php index e34b6cc..1548442 100644 --- a/tests/TestCase/FactoryTest.php +++ b/tests/TestCase/FactoryTest.php @@ -88,11 +88,11 @@ public function testTargetCallbackProvider() $this->assertEquals( APP . 'js/classes/base_class.js', - $result[0]->path() + $result[0]->path(), ); $this->assertEquals( APP . 'js/classes/nested_class.js', - $result[1]->path() + $result[1]->path(), ); } @@ -109,19 +109,19 @@ public function testTargetCallbackProviderAssetOrdering() $this->assertEquals( APP . 'js/library_file.js', - $result[0]->path() + $result[0]->path(), ); $this->assertEquals( APP . 'js/classes/base_class.js', - $result[1]->path() + $result[1]->path(), ); $this->assertEquals( APP . 'js/classes/nested_class.js', - $result[2]->path() + $result[2]->path(), ); $this->assertEquals( APP . 'js/local_script.js', - $result[3]->path() + $result[3]->path(), ); } @@ -186,7 +186,7 @@ public function testTargetWithRequireIntegration() $this->assertStringContainsString( '//= require "local_script"', $contents, - 'Sprockets should not be applied to intermediate build files' + 'Sprockets should not be applied to intermediate build files', ); } @@ -196,7 +196,7 @@ public function testAssetCollection() $this->integrationFile, [ 'WEBROOT' => TMP, - ] + ], ); $factory = new Factory($config); $collection = $factory->assetCollection(); @@ -233,15 +233,15 @@ public function testAssetCreationWithAdditionalPath() $this->assertCount(3, $files); $this->assertEquals( APP . 'js/base.js', - $files[0]->path() + $files[0]->path(), ); $this->assertEquals( APP . 'js/library_file.js', - $files[1]->path() + $files[1]->path(), ); $this->assertEquals( APP . 'js/classes/base_class.js', - $files[2]->path() + $files[2]->path(), ); } @@ -259,7 +259,7 @@ public function testAssetCollectionGlob() $this->assertEquals( [APP . 'js/', APP . 'js/classes/', APP . 'js/secondary/'], $asset->paths(), - 'Should have expanded paths' + 'Should have expanded paths', ); $files = $asset->files(); diff --git a/tests/TestCase/Filter/LessCssTest.php b/tests/TestCase/Filter/LessCssTest.php index 3efed7e..75fd6e4 100644 --- a/tests/TestCase/Filter/LessCssTest.php +++ b/tests/TestCase/Filter/LessCssTest.php @@ -33,7 +33,7 @@ protected function setUp(): void $this->filter->settings( [ 'paths' => [$this->_cssDir], - ] + ], ); } diff --git a/tests/TestCase/Middleware/AssetMiddlewareTest.php b/tests/TestCase/Middleware/AssetMiddlewareTest.php index 5bd38a2..9ad75a5 100644 --- a/tests/TestCase/Middleware/AssetMiddlewareTest.php +++ b/tests/TestCase/Middleware/AssetMiddlewareTest.php @@ -34,7 +34,7 @@ protected function setUp(): void $this->middleware = new AssetMiddleware( $this->config, sys_get_temp_dir() . DIRECTORY_SEPARATOR, - '/assets/' + '/assets/', ); } @@ -43,7 +43,7 @@ public function testInvokeIncorrectPrefix() $request = ServerRequestFactory::fromGlobals( [ 'REQUEST_URI' => '/wrong/assets/path', - ] + ], ); $response = new Response(); $next = function ($req, $res) { @@ -58,7 +58,7 @@ public function testInvokeMissingAssetFile() $request = ServerRequestFactory::fromGlobals( [ 'REQUEST_URI' => '/assets/nope.js', - ] + ], ); $response = new Response(); $next = function ($req, $res) { @@ -75,13 +75,13 @@ public function testInvokeFailedBuild() 'invalid.css', [ 'files' => [APP . 'invalid.css'], - ] + ], ); $request = ServerRequestFactory::fromGlobals( [ 'REQUEST_URI' => '/assets/invalid.css', - ] + ], ); $response = new Response(); $next = function ($req, $res) { @@ -99,7 +99,7 @@ public function testInvokeCacheRead() $request = ServerRequestFactory::fromGlobals( [ 'REQUEST_URI' => '/assets/all.css', - ] + ], ); $response = new Response(); $next = function ($req, $res) { @@ -119,7 +119,7 @@ public function testInvokeSuccessfulBuild() $request = ServerRequestFactory::fromGlobals( [ 'REQUEST_URI' => '/assets/all.css', - ] + ], ); $response = new Response(); $next = function ($req, $res) { @@ -151,7 +151,7 @@ public function testBuildFileContentTypes($uri, $expected) $request = ServerRequestFactory::fromGlobals( [ 'REQUEST_URI' => $uri, - ] + ], ); $response = new Response(); diff --git a/tests/TestCase/Output/AssetCacherTest.php b/tests/TestCase/Output/AssetCacherTest.php index 839ef66..693c72c 100644 --- a/tests/TestCase/Output/AssetCacherTest.php +++ b/tests/TestCase/Output/AssetCacherTest.php @@ -40,7 +40,7 @@ protected function setUp(): void $this->files, [], [], - true + true, ); $filter = $this->getMockBuilder('MiniAsset\Filter\FilterInterface')->getMock(); $filter->method('getDependencies') diff --git a/tests/TestCase/Output/CachedCompilerTest.php b/tests/TestCase/Output/CachedCompilerTest.php index a4a1018..ae301bc 100644 --- a/tests/TestCase/Output/CachedCompilerTest.php +++ b/tests/TestCase/Output/CachedCompilerTest.php @@ -44,7 +44,7 @@ protected function setUp(): void [ $this->_testFiles . 'js' . DS, $this->_testFiles . 'js' . DS . '*', - ] + ], ); $this->config->paths( 'css', @@ -52,7 +52,7 @@ protected function setUp(): void [ $this->_testFiles . 'css' . DS, $this->_testFiles . 'css' . DS . '*', - ] + ], ); if (file_exists(TMP . '/all.css')) { diff --git a/tests/TestCase/Output/CompilerTest.php b/tests/TestCase/Output/CompilerTest.php index fdc1b6e..158d7c6 100644 --- a/tests/TestCase/Output/CompilerTest.php +++ b/tests/TestCase/Output/CompilerTest.php @@ -44,7 +44,7 @@ protected function setUp(): void [ $this->_testFiles . 'js' . DS, $this->_testFiles . 'js' . DS . '*', - ] + ], ); $this->config->paths( 'css', @@ -52,7 +52,7 @@ protected function setUp(): void [ $this->_testFiles . 'css' . DS, $this->_testFiles . 'css' . DS . '*', - ] + ], ); }