diff --git a/CHANGELOG.md b/CHANGELOG.md index 56e7ea7..311f197 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to this project will be documented in this file. +## 2.0.0 - 2024.03.26 +Craft 5, PHP 8.2 + ## 1.0.2 - 2023.03.23 Cleanup, PHP 8.2 diff --git a/LICENSE.md b/LICENSE.md deleted file mode 100644 index fb941a6..0000000 --- a/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -### The MIT License (MIT) - -Copyright (c) 2020-2024 Leowebguy - -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: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/composer.json b/composer.json index 022eb14..b1d887c 100644 --- a/composer.json +++ b/composer.json @@ -7,12 +7,11 @@ "fields", "mask", "formatting", - "validation", - "cp" + "validation" ], - "version": "1.0.2", + "version": "2.0.0", "type": "craft-plugin", - "license": "MIT", + "license": "proprietary", "authors": [ { "name": "Leo", @@ -22,13 +21,14 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^8.0.2", - "craftcms/cms": "^4.0" + "php": "^8.2", + "craftcms/cms": "^5.0" }, "require-dev": { "craftcms/ecs": "dev-main", "craftcms/phpstan": "dev-main", - "craftcms/rector": "dev-main" + "craftcms/rector": "dev-main", + "laravel/pint": "^1.14.0" }, "autoload": { "psr-4": { @@ -42,7 +42,7 @@ }, "config": { "platform": { - "php": "8.0.2" + "php": "8.2" }, "allow-plugins": { "yiisoft/yii2-composer": true, @@ -53,6 +53,7 @@ "check-cs": "vendor/bin/ecs check src --ansi", "fix-cs": "vendor/bin/ecs check src --ansi --fix", "phpstan": "vendor/bin/phpstan analyse src", - "rector": "vendor/bin/rector process src --config vendor/craftcms/rector/sets/craft-cms-40.php" + "rector": "vendor/bin/rector process src --config vendor/craftcms/rector/sets/craft-cms-50.php", + "pint": "vendor/bin/pint -v src" } } diff --git a/pint.json b/pint.json new file mode 100644 index 0000000..2c2d02d --- /dev/null +++ b/pint.json @@ -0,0 +1,43 @@ +{ + "preset": "psr12", + "rules": { + "braces": false, + "concat_space": { + "spacing": "one" + }, + "new_with_braces": { + "anonymous_class": false, + "named_class": false + }, + "phpdoc_separation": false, + "simplified_null_return": true, + "array_syntax": { + "syntax": "short" + }, + "binary_operator_spaces": true, + "blank_line_before_statement": false, + "cast_spaces": false, + "class_attributes_separation": false, + "declare_equal_normalize": true, + "function_declaration": false, + "method_argument_space": false, + "multiline_whitespace_before_semicolons": false, + "no_empty_statement": true, + "no_leading_import_slash": true, + "no_leading_namespace_whitespace": true, + "no_multiline_whitespace_around_double_arrow": true, + "no_unused_imports": true, + "no_whitespace_before_comma_in_array": true, + "no_whitespace_in_blank_line": true, + "not_operator_with_successor_space": false, + "ordered_imports": true, + "phpdoc_add_missing_param_annotation": false, + "phpdoc_align": false, + "phpdoc_indent": false, + "phpdoc_order": true, + "phpdoc_scalar": true, + "single_line_after_imports": false, + "single_space_around_construct": false, + "trim_array_spaces": true + } +} diff --git a/src/Plugin.php b/src/Plugin.php index 39fab26..5e140ca 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -4,8 +4,7 @@ * * @author Leo Leoncio * @see https://github.com/leowebguy - * @copyright Copyright (c) 2022, leowebguy - * @license MIT + * @copyright Copyright (c) 2024, leowebguy */ namespace leowebguy\maskedfields; @@ -13,30 +12,21 @@ use Craft; use craft\base\Plugin as BasePlugin; use craft\events\RegisterComponentTypesEvent; +use craft\services\Fields; use craft\web\View; use leowebguy\maskedfields\assets\Assets; use leowebguy\maskedfields\fields\MaskedField; use yii\base\Event; -use craft\services\Fields; class Plugin extends BasePlugin { - // Properties - // ========================================================================= - - public static mixed $plugin; - public bool $hasCpSection = false; public bool $hasCpSettings = false; - // Public Methods - // ========================================================================= - public function init() { parent::init(); - self::$plugin = $this; if (!$this->isInstalled) { return; diff --git a/src/assets/Assets.php b/src/assets/Assets.php index 52d8628..e8f9b4b 100644 --- a/src/assets/Assets.php +++ b/src/assets/Assets.php @@ -4,8 +4,7 @@ * * @author Leo Leoncio * @see https://github.com/leowebguy - * @copyright Copyright (c) 2022, leowebguy - * @license MIT + * @copyright Copyright (c) 2024, leowebguy */ namespace leowebguy\maskedfields\assets; diff --git a/src/fields/MaskedField.php b/src/fields/MaskedField.php index f4abdb9..80e685b 100644 --- a/src/fields/MaskedField.php +++ b/src/fields/MaskedField.php @@ -4,8 +4,7 @@ * * @author Leo Leoncio * @see https://github.com/leowebguy - * @copyright Copyright (c) 2022, leowebguy - * @license MIT + * @copyright Copyright (c) 2024, leowebguy */ namespace leowebguy\maskedfields\fields; @@ -24,9 +23,6 @@ */ class MaskedField extends PlainText implements PreviewableFieldInterface { - // Public Methods - // ========================================================================= - /** * @var string */ @@ -37,9 +33,6 @@ class MaskedField extends PlainText implements PreviewableFieldInterface */ private array $_types; - // Public Methods - // ========================================================================= - /** * @param array $config */ @@ -83,11 +76,11 @@ public function rules(): array } /** - * @return string|null * @throws Exception * @throws LoaderError * @throws RuntimeError * @throws SyntaxError + * @return string|null */ public function getSettingsHtml(): ?string { @@ -102,11 +95,11 @@ public function getSettingsHtml(): ?string /** * @param mixed $value * @param ElementInterface|null $element - * @return string * @throws LoaderError * @throws RuntimeError * @throws SyntaxError * @throws Exception + * @return string */ public function getInputHtml(mixed $value, ?ElementInterface $element = null): string {