diff --git a/.gitattributes b/.gitattributes index 39c8956e..50c344d9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,6 +8,10 @@ phpunit.xml.dist export-ignore psalm.xml export-ignore psalm-baseline.xml export-ignore -.travis.yml export-ignore +phpstan.neon +phpcs.xml +.stickler.yml export-ignore +.github export-ignore +.phive export-ignore .editorconfig export-ignore tests/ export-ignore diff --git a/.gitignore b/.gitignore index d5721c9a..2e554e63 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /composer.lock /.idea .phpunit.result.cache +.phpunit.cache diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 00000000..63c4fa23 --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/composer.json b/composer.json index 8e8d0ca0..0322956f 100644 --- a/composer.json +++ b/composer.json @@ -18,13 +18,13 @@ }, "require": { "php": ">=8.1.0", - "cakephp/cakephp": "5.x-dev", + "cakephp/cakephp": "^5.0", "markstory/mini-asset": "2.x-dev", "psr/http-server-handler": "^1.0", "psr/http-server-middleware": "^1.0" }, "require-dev": { - "cakephp/cakephp-codesniffer": "5.x-dev", + "cakephp/cakephp-codesniffer": "^5.0", "phpunit/phpunit": "^10.1.0" }, "autoload": { diff --git a/src/Command/ClearCommand.php b/src/Command/ClearCommand.php index 58c36ef6..2800ebc9 100644 --- a/src/Command/ClearCommand.php +++ b/src/Command/ClearCommand.php @@ -122,7 +122,7 @@ protected function clearPath(ConsoleIo $io, string $path, array $themes, array $ // themed files foreach ($themes as $theme) { if (strpos($base, $theme) === 0 && strpos($base, '-') !== false) { - [$themePrefix, $base] = explode('-', $base); + [, $base] = explode('-', $base); } } if (in_array($base, $targets)) { diff --git a/src/Factory.php b/src/Factory.php index 56fa8d61..6996e404 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -23,12 +23,12 @@ class Factory extends BaseFactory /** * Create an AssetWriter * - * @param string $path The path to use + * @param string $tmpPath The path to use * @return \MiniAsset\Output\AssetWriter */ - public function writer(string $path = TMP): AssetWriter + public function writer(string $tmpPath = TMP): AssetWriter { - return parent::writer($this->config->get('general.timestampPath') ?: $path); + return parent::writer($this->config->get('general.timestampPath') ?: $tmpPath); } /** diff --git a/tests/TestCase/View/Helper/AssetCompressHelperTest.php b/tests/TestCase/View/Helper/AssetCompressHelperTest.php index 8ef90462..03bf8ef4 100644 --- a/tests/TestCase/View/Helper/AssetCompressHelperTest.php +++ b/tests/TestCase/View/Helper/AssetCompressHelperTest.php @@ -87,10 +87,10 @@ public function testAttributesOnElements() */ public function testAssetsToBlock() { - $result = $this->Helper->script('libs.js', ['block' => 'custom']); + $result = $this->Helper->script('libs.js', ['block' => 'custom', 'defer' => true]); $this->assertNull($result); - $result = $this->Helper->css('all.css', ['block' => 'custom']); + $result = $this->Helper->css('all.css', ['block' => 'custom', 'test' => 'value']); $this->assertNull($result); $expected = [ @@ -98,13 +98,14 @@ public function testAssetsToBlock() 'defer' => 'defer', 'src' => '/cache_js/libs.js', ]], + '/script', ['link' => [ 'test' => 'value', 'rel' => 'stylesheet', 'href' => '/cache_css/all.css', ]], ]; - $result = $this->View->getBlock('custom'); + $result = $this->View->fetch('custom'); $this->assertHtml($expected, $result); }