From b82cfd0d09964b32770b16d929aa66fab855b200 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 00:50:00 -0500 Subject: [PATCH 01/20] feat: Add `phpstan` and `ecs` code linting --- composer.json | 10 ++++++++++ ecs.php | 13 +++++++++++++ phpstan.neon | 7 +++++++ 3 files changed, 30 insertions(+) create mode 100644 ecs.php create mode 100644 phpstan.neon diff --git a/composer.json b/composer.json index 71597fe..0e7cecd 100755 --- a/composer.json +++ b/composer.json @@ -32,6 +32,16 @@ "require": { "craftcms/cms": "^3.0.0 || ^4.0.0 || ^5.0.0-alpha.1" }, + "require-dev": { + "craftcms/ecs": "dev-main", + "craftcms/phpstan": "dev-main", + "craftcms/rector": "dev-main" + }, + "scripts": { + "phpstan": "vendor/bin/phpstan --ansi --memory-limit=1G", + "check-cs": "ecs check --ansi", + "fix-cs": "ecs check --fix --ansi" + }, "config": { "allow-plugins": { "craftcms/plugin-installer": true, diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..85860c2 --- /dev/null +++ b/ecs.php @@ -0,0 +1,13 @@ +paths([ + __DIR__ . '/src', + __FILE__, + ]); + $ecsConfig->parallel(); + $ecsConfig->sets([SetList::CRAFT_CMS_4]); +}; diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..44554e4 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,7 @@ +includes: + - vendor/craftcms/phpstan/phpstan.neon + +parameters: + level: 5 + paths: + - src From ff4ebf6759e2b9e8a2fd7d08225d750f2267db1f Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 00:50:32 -0500 Subject: [PATCH 02/20] feat: Add `.gitattributes` --- .gitattributes | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..b705137 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,15 @@ +# Do not export those files in the Composer archive (lighter dependency) +/.craftplugin export-ignore +/.gitattributes export-ignore +/.github/ export-ignore +/.gitignore export-ignore +/.scrutinizer.yml export-ignore +/codeception.yml export-ignore +/composer.lock export-ignore +/buildchain/ export-ignore +/resources/ export-ignore +/src/web/assets/src/ +/tests/ export-ignore + +# Auto detect text files and perform LF normalization +* text=auto From 70e11966ac3452ccd29c193c0814908791b86182 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 00:51:00 -0500 Subject: [PATCH 03/20] feat: Add `code-analysis.yaml` GitHub action --- .github/workflows/code-analysis.yaml | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/code-analysis.yaml diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml new file mode 100644 index 0000000..ce51408 --- /dev/null +++ b/.github/workflows/code-analysis.yaml @@ -0,0 +1,34 @@ +name: Code Analysis + +on: + pull_request: null + push: + branches: + - develop + workflow_dispatch: +permissions: + contents: read +jobs: + code_analysis: + strategy: + fail-fast: false + matrix: + actions: + - + name: 'PHPStan' + run: composer phpstan + - + name: 'Coding Standards' + run: composer fix-cs + name: ${{ matrix.actions.name }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + # see https://github.com/shivammathur/setup-php + - uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + coverage: none + # composer install cache - https://github.com/ramsey/composer-install + - uses: "ramsey/composer-install@v2" + - run: ${{ matrix.actions.run }} From 1c83abb06e38cf90b02402cf266bba8e378c7dc0 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 00:51:12 -0500 Subject: [PATCH 04/20] refactor: Remove year --- LICENSE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 48dee26..fce0799 100755 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,7 +1,7 @@ The MIT License (MIT) -Copyright (c) 2021 nystudio107 -Copyright (c) 2021 PutYourLightsOn +Copyright (c) nystudio107 +Copyright (c) PutYourLightsOn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From 302b53fbb1cac9f0a4288ac4c4c379518558974f Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 01:14:48 -0500 Subject: [PATCH 05/20] refactor: PHPstan code cleanup --- .../AutocompleteTwigExtensionGenerator.php | 10 +-- .../AutocompleteVariableGenerator.php | 81 +++++++++---------- 2 files changed, 44 insertions(+), 47 deletions(-) diff --git a/src/generators/AutocompleteTwigExtensionGenerator.php b/src/generators/AutocompleteTwigExtensionGenerator.php index b96281b..293e76f 100644 --- a/src/generators/AutocompleteTwigExtensionGenerator.php +++ b/src/generators/AutocompleteTwigExtensionGenerator.php @@ -63,13 +63,13 @@ public static function regenerate() self::generateInternal(); } - // Private Static Methods + // Protected Static Methods // ========================================================================= /** * Core function that generates the autocomplete class */ - private static function generateInternal() + protected static function generateInternal() { $values = []; // Iterate through the globals in the Twig context @@ -136,7 +136,7 @@ private static function generateInternal() * * @return array */ - private static function elementRouteVariables(): array + protected static function elementRouteVariables(): array { $routeVariables = []; $elementTypes = Craft::$app->elements->getAllElementTypes(); @@ -157,7 +157,7 @@ private static function elementRouteVariables(): array * * @return array */ - private static function globalVariables(): array + protected static function globalVariables(): array { $globalVariables = []; // See if the GlobalsExtension class is available (Craft CMS 3.7.8 or later) and use it @@ -182,7 +182,7 @@ private static function globalVariables(): array * * @return array */ - private static function overrideValues(): array + protected static function overrideValues(): array { return [ // Swap in our variable in place of the `craft` variable diff --git a/src/generators/AutocompleteVariableGenerator.php b/src/generators/AutocompleteVariableGenerator.php index d9fe639..15608d1 100644 --- a/src/generators/AutocompleteVariableGenerator.php +++ b/src/generators/AutocompleteVariableGenerator.php @@ -18,6 +18,7 @@ use nystudio107\autocomplete\events\DefineGeneratorValuesEvent; use ReflectionClass; use ReflectionMethod; +use ReflectionNamedType; use ReflectionProperty; use Throwable; use yii\base\Event; @@ -66,13 +67,13 @@ public static function regenerate() static::generateInternal(); } - // Private Static Methods + // Protected Static Methods // ========================================================================= /** * Core function that generates the autocomplete class */ - private static function generateInternal() + protected static function generateInternal() { $properties = []; $methods = []; @@ -95,52 +96,48 @@ private static function generateInternal() $reflect = new ReflectionClass($behavior); // Properties foreach ($reflect->getProperties(ReflectionProperty::IS_PUBLIC) as $reflectProp) { - if ($reflectProp) { - // Property name - $reflectPropName = $reflectProp->getName(); - // Ensure the property exists only for this class and not any parent class - if (property_exists(get_parent_class($behavior), $reflectPropName)) { - continue; - } - // Do it this way because getType() reflection method is >= PHP 7.4 - $reflectPropType = gettype($behavior->$reflectPropName); - switch ($reflectPropType) { - case 'object': - $properties[$reflectPropName] = get_class($behavior->$reflectPropName); - break; - default: - $properties[$reflectPropName] = $reflectPropType; - break; - } + // Property name + $reflectPropName = $reflectProp->getName(); + // Ensure the property exists only for this class and not any parent class + if (property_exists(get_parent_class($behavior), $reflectPropName)) { + continue; + } + // Do it this way because getType() reflection method is >= PHP 7.4 + $reflectPropType = gettype($behavior->$reflectPropName); + switch ($reflectPropType) { + case 'object': + $properties[$reflectPropName] = get_class($behavior->$reflectPropName); + break; + default: + $properties[$reflectPropName] = $reflectPropType; + break; } } // Methods foreach ($reflect->getMethods(ReflectionMethod::IS_PUBLIC) as $reflectMethod) { - if ($reflectMethod) { - // Method name - $reflectMethodName = $reflectMethod->getName(); - // Ensure the method exists only for this class and not any parent class - if (method_exists(get_parent_class($behavior), $reflectMethodName)) { - continue; - } - // Method return type - $methodReturn = ''; - $reflectMethodReturnType = $reflectMethod->getReturnType(); - if ($reflectMethodReturnType) { - $methodReturn = ': ' . $reflectMethodReturnType->getName(); - } - // Method parameters - $methodParams = []; - foreach ($reflectMethod->getParameters() as $methodParam) { - $paramType = ''; - $methodParamType = $methodParam->getType(); - if ($methodParamType) { - $paramType = $methodParamType . ' '; - } - $methodParams[] = $paramType . '$' . $methodParam->getName(); + // Method name + $reflectMethodName = $reflectMethod->getName(); + // Ensure the method exists only for this class and not any parent class + if (method_exists(get_parent_class($behavior), $reflectMethodName)) { + continue; + } + // Method return type + $methodReturn = ''; + $reflectMethodReturnType = $reflectMethod->getReturnType(); + if ($reflectMethodReturnType instanceof ReflectionNamedType) { + $methodReturn = ': ' . $reflectMethodReturnType->getName(); + } + // Method parameters + $methodParams = []; + foreach ($reflectMethod->getParameters() as $methodParam) { + $paramType = ''; + $methodParamType = $methodParam->getType(); + if ($methodParamType) { + $paramType = $methodParamType . ' '; } - $methods[$reflectMethodName] = '(' . implode(', ', $methodParams) . ')' . $methodReturn; + $methodParams[] = $paramType . '$' . $methodParam->getName(); } + $methods[$reflectMethodName] = '(' . implode(', ', $methodParams) . ')' . $methodReturn; } } catch (\ReflectionException $e) { } From e2d418cdb3199fc0b059603d97549a4560c413fc Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 01:16:13 -0500 Subject: [PATCH 06/20] refactor: ECS code cleanup --- src/Autocomplete.php | 8 ++++---- src/base/Generator.php | 2 +- src/base/GeneratorInterface.php | 6 +++--- src/generators/AutocompleteTwigExtensionGenerator.php | 4 ++-- src/generators/AutocompleteVariableGenerator.php | 3 +-- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Autocomplete.php b/src/Autocomplete.php index 826496e..78a9ff8 100755 --- a/src/Autocomplete.php +++ b/src/Autocomplete.php @@ -41,7 +41,7 @@ class Autocomplete extends Module implements BootstrapInterface // Constants // ========================================================================= - const ID = 'craft-autocomplete'; + public const ID = 'craft-autocomplete'; /** * @event RegisterComponentTypesEvent The event that is triggered when registering @@ -63,9 +63,9 @@ class Autocomplete extends Module implements BootstrapInterface * ); * ``` */ - const EVENT_REGISTER_AUTOCOMPLETE_GENERATORS = 'registerAutocompleteGenerators'; + public const EVENT_REGISTER_AUTOCOMPLETE_GENERATORS = 'registerAutocompleteGenerators'; - const DEFAULT_AUTOCOMPLETE_GENERATORS = [ + public const DEFAULT_AUTOCOMPLETE_GENERATORS = [ AutocompleteVariableGenerator::class, AutocompleteTwigExtensionGenerator::class, ]; @@ -186,7 +186,7 @@ public function getAllAutocompleteGenerators(): array } $event = new RegisterComponentTypesEvent([ - 'types' => self::DEFAULT_AUTOCOMPLETE_GENERATORS + 'types' => self::DEFAULT_AUTOCOMPLETE_GENERATORS, ]); $this->trigger(self::EVENT_REGISTER_AUTOCOMPLETE_GENERATORS, $event); $this->allAutocompleteGenerators = $event->types; diff --git a/src/base/Generator.php b/src/base/Generator.php index f94ee31..82f4160 100644 --- a/src/base/Generator.php +++ b/src/base/Generator.php @@ -41,7 +41,7 @@ abstract class Generator implements GeneratorInterface * ); * ``` */ - const EVENT_BEFORE_GENERATE = 'beforeGenerate'; + public const EVENT_BEFORE_GENERATE = 'beforeGenerate'; // Public Static Methods // ========================================================================= diff --git a/src/base/GeneratorInterface.php b/src/base/GeneratorInterface.php index 2adb248..e26a6fc 100644 --- a/src/base/GeneratorInterface.php +++ b/src/base/GeneratorInterface.php @@ -22,9 +22,9 @@ interface GeneratorInterface // Constants // ========================================================================= - const TEMPLATE_EXTENSION = '.php'; - const STUBS_EXTENSION = '.php.stub'; - const STUBS_DIR = DIRECTORY_SEPARATOR . 'stubs'; + public const TEMPLATE_EXTENSION = '.php'; + public const STUBS_EXTENSION = '.php.stub'; + public const STUBS_DIR = DIRECTORY_SEPARATOR . 'stubs'; // Public Static Methods // ========================================================================= diff --git a/src/generators/AutocompleteTwigExtensionGenerator.php b/src/generators/AutocompleteTwigExtensionGenerator.php index 293e76f..04905e5 100644 --- a/src/generators/AutocompleteTwigExtensionGenerator.php +++ b/src/generators/AutocompleteTwigExtensionGenerator.php @@ -29,9 +29,9 @@ class AutocompleteTwigExtensionGenerator extends Generator // Constants // ========================================================================= - const ELEMENT_ROUTE_EXCLUDES = [ + public const ELEMENT_ROUTE_EXCLUDES = [ 'matrixblock', - 'globalset' + 'globalset', ]; // Public Static Methods diff --git a/src/generators/AutocompleteVariableGenerator.php b/src/generators/AutocompleteVariableGenerator.php index 15608d1..225908b 100644 --- a/src/generators/AutocompleteVariableGenerator.php +++ b/src/generators/AutocompleteVariableGenerator.php @@ -30,11 +30,10 @@ */ class AutocompleteVariableGenerator extends Generator { - // Constants // ========================================================================= - const BEHAVIOR_PROPERTY_EXCLUDES = [ + public const BEHAVIOR_PROPERTY_EXCLUDES = [ 'owner', ]; From 3b69e79160f7b9e69a60c4aca5a27be3fcb9f504 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 01:16:29 -0500 Subject: [PATCH 07/20] chore: Version 1.12.0 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e24ac67..457bf04 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to this project will be documented in this file. +## 1.12.0 - 2024.01.30 +### Added +* Add `phpstan` and `ecs` code linting +* Add `code-analysis.yaml` GitHub action + +### Changed +* PHPstan code cleanup +* ECS code cleanup + ## 1.12.0 - 2024.01.25 ### Added * Added support for Craft CMS 5 From 1e03fcc82c806e74a25d10a739454728347b7b88 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Tue, 30 Jan 2024 01:17:48 -0500 Subject: [PATCH 08/20] chore: Version 1.12.1 --- CHANGELOG.md | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 457bf04..d56ca44 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## 1.12.0 - 2024.01.30 +## 1.12.1 - 2024.01.30 ### Added * Add `phpstan` and `ecs` code linting * Add `code-analysis.yaml` GitHub action diff --git a/composer.json b/composer.json index 0e7cecd..7a4af09 100755 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "nystudio107/craft-autocomplete", "description": "Provides Twig template IDE autocomplete of Craft CMS & plugin variables", "type": "yii2-extension", - "version": "1.12.0", + "version": "1.12.1", "keywords": [ "craft", "cms", From 3a123881e07839c9c71a56054b6fba634ee5fa35 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 31 Jan 2024 10:50:18 -0500 Subject: [PATCH 09/20] refactor: Remove `vendor/bin/` prefix --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7a4af09..68e2ab2 100755 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "craftcms/rector": "dev-main" }, "scripts": { - "phpstan": "vendor/bin/phpstan --ansi --memory-limit=1G", + "phpstan": "phpstan --ansi --memory-limit=1G", "check-cs": "ecs check --ansi", "fix-cs": "ecs check --fix --ansi" }, From 45ff5e861b833703a28805efa1db4d1f2ca5ea7a Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 31 Jan 2024 14:14:39 -0500 Subject: [PATCH 10/20] refactor: Add extensions --- .github/workflows/code-analysis.yaml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml index ce51408..2e3ee22 100644 --- a/.github/workflows/code-analysis.yaml +++ b/.github/workflows/code-analysis.yaml @@ -14,21 +14,21 @@ jobs: fail-fast: false matrix: actions: - - - name: 'PHPStan' + - name: 'PHPStan' run: composer phpstan - - - name: 'Coding Standards' + - name: 'Coding Standards' run: composer fix-cs name: ${{ matrix.actions.name }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - # see https://github.com/shivammathur/setup-php - - uses: shivammathur/setup-php@v2 - with: - php-version: 8.2 - coverage: none - # composer install cache - https://github.com/ramsey/composer-install - - uses: "ramsey/composer-install@v2" - - run: ${{ matrix.actions.run }} + - uses: actions/checkout@v4 + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: /tmp/composer-cache + key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + - uses: php-actions/composer@v6 + with: + php_version: 8.2 + php_extensions: ctype curl dom iconv imagick intl json mbstring openssl pcre pdo reflection spl zip + - run: ${{ matrix.actions.run }} From 04cd9c7aa88dce18c655bff14a704d000b600ecb Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 31 Jan 2024 14:20:17 -0500 Subject: [PATCH 11/20] refactor: Quote the php version --- .github/workflows/code-analysis.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml index 2e3ee22..6f45dd4 100644 --- a/.github/workflows/code-analysis.yaml +++ b/.github/workflows/code-analysis.yaml @@ -29,6 +29,6 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - uses: php-actions/composer@v6 with: - php_version: 8.2 + php_version: "8.2" php_extensions: ctype curl dom iconv imagick intl json mbstring openssl pcre pdo reflection spl zip - run: ${{ matrix.actions.run }} From 4fed60bf151d3ca636cb52f621014265036b6105 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 31 Jan 2024 14:25:21 -0500 Subject: [PATCH 12/20] refactor: Use custom command --- .github/workflows/code-analysis.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml index 6f45dd4..1696af3 100644 --- a/.github/workflows/code-analysis.yaml +++ b/.github/workflows/code-analysis.yaml @@ -31,4 +31,4 @@ jobs: with: php_version: "8.2" php_extensions: ctype curl dom iconv imagick intl json mbstring openssl pcre pdo reflection spl zip - - run: ${{ matrix.actions.run }} + command: ${{ matrix.actions.run }} From 0c34c1f1f16f1fe335da200e3a56bb60cc299d91 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 31 Jan 2024 14:27:52 -0500 Subject: [PATCH 13/20] refactor: Fix command --- .github/workflows/code-analysis.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml index 1696af3..cf4fea8 100644 --- a/.github/workflows/code-analysis.yaml +++ b/.github/workflows/code-analysis.yaml @@ -15,9 +15,9 @@ jobs: matrix: actions: - name: 'PHPStan' - run: composer phpstan + run: phpstan - name: 'Coding Standards' - run: composer fix-cs + run: fix-cs name: ${{ matrix.actions.name }} runs-on: ubuntu-latest steps: From 64cab204734d0c92a09fcdd141b5a622d2206df6 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 31 Jan 2024 14:31:37 -0500 Subject: [PATCH 14/20] refactor: Shuffle command --- .github/workflows/code-analysis.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml index cf4fea8..d415005 100644 --- a/.github/workflows/code-analysis.yaml +++ b/.github/workflows/code-analysis.yaml @@ -15,9 +15,9 @@ jobs: matrix: actions: - name: 'PHPStan' - run: phpstan + run: composer phpstan - name: 'Coding Standards' - run: fix-cs + run: composer fix-cs name: ${{ matrix.actions.name }} runs-on: ubuntu-latest steps: @@ -27,8 +27,9 @@ jobs: with: path: /tmp/composer-cache key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - uses: php-actions/composer@v6 + - name: Composer action + uses: php-actions/composer@v6 with: php_version: "8.2" php_extensions: ctype curl dom iconv imagick intl json mbstring openssl pcre pdo reflection spl zip - command: ${{ matrix.actions.run }} + run: ${{ matrix.actions.run }} From ccbeaa128f5b79d5da8af49067a7c417e6716432 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 31 Jan 2024 14:37:42 -0500 Subject: [PATCH 15/20] refactor: Use setup-php --- .github/workflows/code-analysis.yaml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/code-analysis.yaml b/.github/workflows/code-analysis.yaml index d415005..d4bf3fa 100644 --- a/.github/workflows/code-analysis.yaml +++ b/.github/workflows/code-analysis.yaml @@ -27,9 +27,14 @@ jobs: with: path: /tmp/composer-cache key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} - - name: Composer action - uses: php-actions/composer@v6 + - name: Setup PHP + id: setup-php + uses: shivammathur/setup-php@v2 with: - php_version: "8.2" - php_extensions: ctype curl dom iconv imagick intl json mbstring openssl pcre pdo reflection spl zip - run: ${{ matrix.actions.run }} + php-version: 8.2 + extensions: 'ctype,curl,dom,iconv,imagick,intl,json,mbstring,openssl,pcre,pdo,reflection,spl,zip' + ini-values: post_max_size=256M, max_execution_time=180, memory_limit=512M + tools: composer:v2 + - name: Install Composer dependencies + run: composer install --no-interaction --no-ansi --no-progress + - run: ${{ matrix.actions.run }} From bf9d7985b2a1ede8ed0f0b04d42bfd141d73fc3c Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Thu, 8 Feb 2024 16:21:41 -0500 Subject: [PATCH 16/20] refactor: Use `%currentWorkingDirectory%` --- phpstan.neon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpstan.neon b/phpstan.neon index 44554e4..9ad1308 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ includes: - - vendor/craftcms/phpstan/phpstan.neon + - %currentWorkingDirectory%/vendor/craftcms/phpstan/phpstan.neon parameters: level: 5 From e71fe5dd32269d4b37ce52d7d68b525e366e60d0 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Thu, 8 Feb 2024 20:22:28 -0500 Subject: [PATCH 17/20] refactor: Update to `craftcms/cms` `5.0.0-beta.1` --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 68e2ab2..1efb8db 100755 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ } ], "require": { - "craftcms/cms": "^3.0.0 || ^4.0.0 || ^5.0.0-alpha.1" + "craftcms/cms": "^3.0.0 || ^4.0.0 || ^5.0.0-beta.1" }, "require-dev": { "craftcms/ecs": "dev-main", From 5744a8d825719ae0c1d30da9b01ea1d99f3c7c1c Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Sat, 10 Feb 2024 20:33:09 -0500 Subject: [PATCH 18/20] refactor: Comment cleanup --- src/Autocomplete.php | 6 +++--- src/base/Generator.php | 6 +++--- src/base/GeneratorInterface.php | 6 +++--- src/console/controllers/AutocompleteController.php | 6 +++--- src/events/DefineGeneratorValuesEvent.php | 6 +++--- src/generators/AutocompleteTwigExtensionGenerator.php | 6 +++--- src/generators/AutocompleteVariableGenerator.php | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Autocomplete.php b/src/Autocomplete.php index 78a9ff8..e43bdeb 100755 --- a/src/Autocomplete.php +++ b/src/Autocomplete.php @@ -1,13 +1,13 @@ Date: Sun, 10 Mar 2024 14:18:55 -0400 Subject: [PATCH 19/20] feat: Add `create-release.yaml` workflow --- .github/workflows/create-release.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/create-release.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 0000000..8e33492 --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,21 @@ +name: Create Release +run-name: Create release for ${{ github.event.client_payload.version }} + +on: + repository_dispatch: + types: + - craftcms/new-release + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: ncipollo/release-action@v1 + with: + body: ${{ github.event.client_payload.notes }} + makeLatest: ${{ github.event.client_payload.latest }} + name: ${{ github.event.client_payload.version }} + prerelease: ${{ github.event.client_payload.prerelease }} + tag: ${{ github.event.client_payload.tag }} From 550d9de554fe048eb18357d42fe0a642577f1618 Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Mon, 15 Apr 2024 12:14:21 -0400 Subject: [PATCH 20/20] chore: Version 1.12.1 --- CHANGELOG.md | 4 +++- composer.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d56ca44..6a85760 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,12 @@ All notable changes to this project will be documented in this file. -## 1.12.1 - 2024.01.30 +## 1.12.1 - 2024.04.15 ### Added +* Stable release for Craft CMS 5 * Add `phpstan` and `ecs` code linting * Add `code-analysis.yaml` GitHub action +* Add `create-release.yml` for automated released ### Changed * PHPstan code cleanup diff --git a/composer.json b/composer.json index 1efb8db..74a9667 100755 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ } ], "require": { - "craftcms/cms": "^3.0.0 || ^4.0.0 || ^5.0.0-beta.1" + "craftcms/cms": "^3.0.0 || ^4.0.0 || ^5.0.0" }, "require-dev": { "craftcms/ecs": "dev-main",