From e20202e28fdd112e7182d1b1447bf669b25c241f Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 18 Sep 2024 10:02:08 +1000 Subject: [PATCH 1/3] Fixed coding standards. --- src/Traits/TokenTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Traits/TokenTrait.php b/src/Traits/TokenTrait.php index 98e7911..64a6245 100644 --- a/src/Traits/TokenTrait.php +++ b/src/Traits/TokenTrait.php @@ -22,7 +22,7 @@ trait TokenTrait { protected function tokenProcess(string $string): ?string { /* @phpstan-ignore-next-line */ return preg_replace_callback('/(?:\[([^\]]+)\])/', function (array $match) { - if (count($match) > 1) { + if (!empty($match[1])) { $parts = explode(':', $match[1], 2); $token = $parts[0] ?? NULL; $argument = $parts[1] ?? NULL; From ab6d23f39a90c533559b6711ea8c79908f5d1e5e Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 18 Sep 2024 10:03:23 +1000 Subject: [PATCH 2/3] Added `ergebnis/composer-normalize` and normalised `composer.json`. --- composer.json | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 89675b4..4a43688 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "drevops/git-artifact", - "type": "package", "description": "Build artifact from your codebase in CI and push it to a separate git repo.", "license": "GPL-2.0-or-later", + "type": "package", "authors": [ { "name": "Alex Skrypnyk", @@ -28,6 +28,7 @@ "bamarni/composer-bin-plugin": "^1.8", "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "drupal/coder": "^8.3", + "ergebnis/composer-normalize": "^2.43", "phpmd/phpmd": "^2.15", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^10.5", @@ -43,13 +44,22 @@ "DrevOps\\GitArtifact\\Tests\\": "tests/phpunit" } }, + "bin": [ + "git-artifact" + ], "config": { "allow-plugins": { "bamarni/composer-bin-plugin": true, - "dealerdirect/phpcodesniffer-composer-installer": true + "dealerdirect/phpcodesniffer-composer-installer": true, + "ergebnis/composer-normalize": true } }, "scripts": { + "build": [ + "@composer bin box require --dev humbug/box", + "box validate", + "box compile" + ], "lint": [ "phpcs", "phpmd --exclude vendor,vendor-bin,node_modules . text phpmd.xml", @@ -60,14 +70,6 @@ "rector --clear-cache", "phpcbf" ], - "test": "if [ \"${XDEBUG_MODE}\" = 'coverage' ]; then phpunit; else phpunit --no-coverage; fi", - "build": [ - "@composer bin box require --dev humbug/box", - "box validate", - "box compile" - ] - }, - "bin": [ - "git-artifact" - ] + "test": "if [ \"${XDEBUG_MODE}\" = 'coverage' ]; then phpunit; else phpunit --no-coverage; fi" + } } From 215c8978afd56ed7e52a775d7280d72ea22e932f Mon Sep 17 00:00:00 2001 From: Alex Skrypnyk Date: Wed, 18 Sep 2024 10:04:03 +1000 Subject: [PATCH 3/3] Added "reset" script. --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 4a43688..03df261 100644 --- a/composer.json +++ b/composer.json @@ -70,6 +70,7 @@ "rector --clear-cache", "phpcbf" ], + "reset": "rm -rf vendor vendor-bin composer.lock", "test": "if [ \"${XDEBUG_MODE}\" = 'coverage' ]; then phpunit; else phpunit --no-coverage; fi" } }