From 4a18a88b28ba0aea313d2ca52d7962a0f878d0b7 Mon Sep 17 00:00:00 2001 From: "Leoncio, Leo" Date: Tue, 26 Mar 2024 21:30:18 -0400 Subject: [PATCH] Craft 5, PHP8.1 --- CHANGELOG.md | 3 +++ LICENSE.md | 21 ---------------- composer.json | 18 +++++++------ pint.json | 43 ++++++++++++++++++++++++++++++++ src/Detect.php | 7 ------ src/variables/DetectVariable.php | 18 ++----------- 6 files changed, 58 insertions(+), 52 deletions(-) delete mode 100644 LICENSE.md create mode 100644 pint.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b9c86f..5ab5dcf 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.3 - 2023.03.24 ### Cleanup, PHP 8.1 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 f8f6adf..5bc5bbe 100644 --- a/composer.json +++ b/composer.json @@ -7,9 +7,9 @@ "bots", "spiders" ], - "version": "1.0.3", + "version": "2.0.0", "type": "craft-plugin", - "license": "MIT", + "license": "proprietary", "authors": [ { "name": "Leo", @@ -19,14 +19,15 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": "^8.0.2", - "craftcms/cms": "^4.0", - "jaybizzle/crawler-detect": "^v1.2" + "php": "^8.2", + "craftcms/cms": "^5.0", + "jaybizzle/crawler-detect": "^1.2" }, "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": { @@ -40,7 +41,7 @@ }, "config": { "platform": { - "php": "8.0.2" + "php": "8.2" }, "allow-plugins": { "yiisoft/yii2-composer": true, @@ -51,6 +52,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/Detect.php b/src/Detect.php index 9e5a69c..bcb8b01 100644 --- a/src/Detect.php +++ b/src/Detect.php @@ -6,7 +6,6 @@ * @author Leo Leoncio * @see https://github.com/leowebguy * @copyright Copyright (c) 2023, leowebguy - * @license MIT */ namespace leowebguy\crawlerdetect; @@ -19,16 +18,10 @@ class Detect extends Plugin { - // Properties - // ========================================================================= - public bool $hasCpSection = false; public bool $hasCpSettings = false; - // Public Methods - // ========================================================================= - public function init() { parent::init(); diff --git a/src/variables/DetectVariable.php b/src/variables/DetectVariable.php index 0e4829a..06ddc1c 100644 --- a/src/variables/DetectVariable.php +++ b/src/variables/DetectVariable.php @@ -6,7 +6,6 @@ * @author Leo Leoncio * @see https://github.com/leowebguy * @copyright Copyright (c) 2023, leowebguy - * @license MIT */ namespace leowebguy\crawlerdetect\variables; @@ -15,31 +14,18 @@ class DetectVariable { - // Properties - // ========================================================================= - private CrawlerDetect $crawlerDetect; - // Construct - // ========================================================================= - public function __construct() { - $this->crawlerDetect = new CrawlerDetect(); + $this->crawlerDetect = new CrawlerDetect; } - /** - * @return string - */ - public function getCrawlerDetect(): string + public function getCrawlerDetect(): CrawlerDetect { return $this->crawlerDetect; } - /** - * @param $userAgent - * @return bool - */ public function isCrawler($userAgent = null): bool { return $this->crawlerDetect->isCrawler($userAgent);