Skip to content

Commit

Permalink
Merge branch 'release/1.12.1' into v1
Browse files Browse the repository at this point in the history
  • Loading branch information
khalwat committed Apr 15, 2024
2 parents 13d4329 + 550d9de commit ee3d7e2
Show file tree
Hide file tree
Showing 15 changed files with 197 additions and 84 deletions.
15 changes: 15 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions .github/workflows/code-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
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
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
id: setup-php
uses: shivammathur/setup-php@v2
with:
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 }}
21 changes: 21 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project will be documented in this file.

## 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
* ECS code cleanup

## 1.12.0 - 2024.01.25
### Added
* Added support for Craft CMS 5
Expand Down
4 changes: 2 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -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:

Expand Down
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -30,7 +30,17 @@
}
],
"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"
},
"require-dev": {
"craftcms/ecs": "dev-main",
"craftcms/phpstan": "dev-main",
"craftcms/rector": "dev-main"
},
"scripts": {
"phpstan": "phpstan --ansi --memory-limit=1G",
"check-cs": "ecs check --ansi",
"fix-cs": "ecs check --fix --ansi"
},
"config": {
"allow-plugins": {
Expand Down
13 changes: 13 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use craft\ecs\SetList;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function(ECSConfig $ecsConfig): void {
$ecsConfig->paths([
__DIR__ . '/src',
__FILE__,
]);
$ecsConfig->parallel();
$ecsConfig->sets([SetList::CRAFT_CMS_4]);
};
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
includes:
- %currentWorkingDirectory%/vendor/craftcms/phpstan/phpstan.neon

parameters:
level: 5
paths:
- src
14 changes: 7 additions & 7 deletions src/Autocomplete.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Autocomplete plugin for Craft CMS 3.x
* Autocomplete module for Craft CMS
*
* Provides Twig template IDE autocomplete of Craft CMS & plugin variables
*
* @link https://nystudio107.com
* @link https://putyourlightson.com
* @copyright Copyright (c) 2021 nystudio107
* @copyright Copyright (c) 2021 PutYourLightsOn
* @copyright Copyright (c) nystudio107
* @copyright Copyright (c) PutYourLightsOn
*/

namespace nystudio107\autocomplete;
Expand Down Expand Up @@ -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
Expand All @@ -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,
];
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/base/Generator.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Autocomplete plugin for Craft CMS 3.x
* Autocomplete module for Craft CMS
*
* Provides Twig template IDE autocomplete of Craft CMS & plugin variables
*
* @link https://nystudio107.com
* @link https://putyourlightson.com
* @copyright Copyright (c) 2021 nystudio107
* @copyright Copyright (c) 2021 PutYourLightsOn
* @copyright Copyright (c) nystudio107
* @copyright Copyright (c) PutYourLightsOn
*/

namespace nystudio107\autocomplete\base;
Expand Down Expand Up @@ -41,7 +41,7 @@ abstract class Generator implements GeneratorInterface
* );
* ```
*/
const EVENT_BEFORE_GENERATE = 'beforeGenerate';
public const EVENT_BEFORE_GENERATE = 'beforeGenerate';

// Public Static Methods
// =========================================================================
Expand Down
12 changes: 6 additions & 6 deletions src/base/GeneratorInterface.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Autocomplete plugin for Craft CMS 3.x
* Autocomplete module for Craft CMS
*
* Provides Twig template IDE autocomplete of Craft CMS & plugin variables
*
* @link https://nystudio107.com
* @link https://putyourlightson.com
* @copyright Copyright (c) 2021 nystudio107
* @copyright Copyright (c) 2021 PutYourLightsOn
* @copyright Copyright (c) nystudio107
* @copyright Copyright (c) PutYourLightsOn
*/

namespace nystudio107\autocomplete\base;
Expand All @@ -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
// =========================================================================
Expand Down
6 changes: 3 additions & 3 deletions src/console/controllers/AutocompleteController.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Autocomplete plugin for Craft CMS 3.x
* Autocomplete module for Craft CMS
*
* Provides Twig template IDE autocomplete of Craft CMS & plugin variables
*
* @link https://nystudio107.com
* @link https://putyourlightson.com
* @copyright Copyright (c) 2021 nystudio107
* @copyright Copyright (c) 2021 PutYourLightsOn
* @copyright Copyright (c) nystudio107
* @copyright Copyright (c) PutYourLightsOn
*/

namespace nystudio107\autocomplete\console\controllers;
Expand Down
6 changes: 3 additions & 3 deletions src/events/DefineGeneratorValuesEvent.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Autocomplete plugin for Craft CMS 3.x
* Autocomplete module for Craft CMS
*
* Provides Twig template IDE autocomplete of Craft CMS & plugin variables
*
* @link https://nystudio107.com
* @link https://putyourlightson.com
* @copyright Copyright (c) 2021 nystudio107
* @copyright Copyright (c) 2021 PutYourLightsOn
* @copyright Copyright (c) nystudio107
* @copyright Copyright (c) PutYourLightsOn
*/

namespace nystudio107\autocomplete\events;
Expand Down
20 changes: 10 additions & 10 deletions src/generators/AutocompleteTwigExtensionGenerator.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/**
* Autocomplete plugin for Craft CMS 3.x
* Autocomplete module for Craft CMS
*
* Provides Twig template IDE autocomplete of Craft CMS & plugin variables
*
* @link https://nystudio107.com
* @link https://putyourlightson.com
* @copyright Copyright (c) 2021 nystudio107
* @copyright Copyright (c) 2021 PutYourLightsOn
* @copyright Copyright (c) nystudio107
* @copyright Copyright (c) PutYourLightsOn
*/

namespace nystudio107\autocomplete\generators;
Expand All @@ -29,9 +29,9 @@ class AutocompleteTwigExtensionGenerator extends Generator
// Constants
// =========================================================================

const ELEMENT_ROUTE_EXCLUDES = [
public const ELEMENT_ROUTE_EXCLUDES = [
'matrixblock',
'globalset'
'globalset',
];

// Public Static Methods
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit ee3d7e2

Please sign in to comment.