Skip to content

Commit

Permalink
Craft 5, PHP8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Leoncio, Leo committed Mar 27, 2024
1 parent 2e5ac87 commit 65247fd
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 54 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

19 changes: 10 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": {
Expand All @@ -42,7 +42,7 @@
},
"config": {
"platform": {
"php": "8.0.2"
"php": "8.2"
},
"allow-plugins": {
"yiisoft/yii2-composer": true,
Expand All @@ -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"
}
}
43 changes: 43 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -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
}
}
14 changes: 2 additions & 12 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,29 @@
*
* @author Leo Leoncio
* @see https://github.com/leowebguy
* @copyright Copyright (c) 2022, leowebguy
* @license MIT
* @copyright Copyright (c) 2024, leowebguy
*/

namespace leowebguy\maskedfields;

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;
Expand Down
3 changes: 1 addition & 2 deletions src/assets/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 3 additions & 10 deletions src/fields/MaskedField.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,9 +23,6 @@
*/
class MaskedField extends PlainText implements PreviewableFieldInterface
{
// Public Methods
// =========================================================================

/**
* @var string
*/
Expand All @@ -37,9 +33,6 @@ class MaskedField extends PlainText implements PreviewableFieldInterface
*/
private array $_types;

// Public Methods
// =========================================================================

/**
* @param array $config
*/
Expand Down Expand Up @@ -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
{
Expand All @@ -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
{
Expand Down

0 comments on commit 65247fd

Please sign in to comment.