From 64899a50c14e4bb2bcd06d24bd222e4a02726b86 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 24 Dec 2022 01:04:08 +0800 Subject: [PATCH 1/4] update to 2.8.5, fix getClassesPsr4 .plain find error bug --- src/ZM/ConsoleApplication.php | 2 +- src/ZM/Utils/ZMUtil.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ZM/ConsoleApplication.php b/src/ZM/ConsoleApplication.php index a34062a9..c78f8839 100644 --- a/src/ZM/ConsoleApplication.php +++ b/src/ZM/ConsoleApplication.php @@ -30,7 +30,7 @@ class ConsoleApplication extends Application { public const VERSION_ID = 478; - public const VERSION = '2.8.4'; + public const VERSION = '2.8.5'; private static $obj; diff --git a/src/ZM/Utils/ZMUtil.php b/src/ZM/Utils/ZMUtil.php index 732c3ddd..f6511e1a 100644 --- a/src/ZM/Utils/ZMUtil.php +++ b/src/ZM/Utils/ZMUtil.php @@ -103,7 +103,7 @@ class ZMUtil /*if (substr(file_get_contents($dir . '/' . $v), 6, 6) == '#plain') { continue; }*/ - if (file_exists($dir . '/' . $pathinfo['basename'] . '.plain')) { + if (file_exists($dir . '/' . $v . '.plain')) { continue; } if (mb_substr($pathinfo['basename'], 0, 7) == 'global_' || mb_substr($pathinfo['basename'], 0, 7) == 'script_') { From 90b6580e80bff47979014c202083763faf163171 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 24 Dec 2022 01:08:24 +0800 Subject: [PATCH 2/4] change global namespace import fixer config --- .php-cs-fixer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 7f9f3f20..bafca786 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -66,6 +66,7 @@ return (new PhpCsFixer\Config()) 'multiline_comment_opening_closing' => true, 'phpdoc_summary' => false, 'php_unit_test_class_requires_covers' => false, + 'global_namespace_import' => false, ]) ->setFinder( PhpCsFixer\Finder::create() From bd98608d2e2ee2c0a9e847a35eb66e2cffeed758 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 24 Dec 2022 01:18:59 +0800 Subject: [PATCH 3/4] change fixer config --- .php-cs-fixer.php | 2 ++ src/ZM/script_phar_stub.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index bafca786..650f766b 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -67,6 +67,8 @@ return (new PhpCsFixer\Config()) 'phpdoc_summary' => false, 'php_unit_test_class_requires_covers' => false, 'global_namespace_import' => false, + 'phpdoc_order' => false, + 'no_useless_concat_operator' => false, ]) ->setFinder( PhpCsFixer\Finder::create() diff --git a/src/ZM/script_phar_stub.php b/src/ZM/script_phar_stub.php index 3650b878..2845d775 100644 --- a/src/ZM/script_phar_stub.php +++ b/src/ZM/script_phar_stub.php @@ -14,8 +14,9 @@ function loader__generated_id__() require_once Phar::running() . '/' . $v; } } -if ('__generate' . 'd_id__' === _PHAR_STUB_ID) { +if (('__generate' . 'd_id__') === _PHAR_STUB_ID) { echo 'Cannot execute this file directly!' . PHP_EOL; exit(1); } +/* @phpstan-ignore-next-line */ return json_decode(file_get_contents(__DIR__ . '/zmplugin.json'), true) ?? ['zm_module' => false]; From ccc0280d2f09146c0ff292132ebd9f5eea5e4251 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Sat, 24 Dec 2022 01:26:34 +0800 Subject: [PATCH 4/4] change fixer config --- .php-cs-fixer.php | 131 ++++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 62 deletions(-) diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 650f766b..0754b09e 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -6,70 +6,77 @@ declare(strict_types=1); * @since 2.7.0 */ +$rules = [ + '@PSR12' => true, + '@Symfony' => true, + '@PhpCsFixer' => true, + 'array_syntax' => [ + 'syntax' => 'short', + ], + 'list_syntax' => [ + 'syntax' => 'short', + ], + 'concat_space' => [ + 'spacing' => 'one', + ], + 'blank_line_before_statement' => [ + 'statements' => [ + 'declare', + ], + ], + 'ordered_imports' => [ + 'imports_order' => [ + 'class', + 'function', + 'const', + ], + 'sort_algorithm' => 'alpha', + ], + 'single_line_comment_style' => [ + 'comment_types' => [ + ], + ], + 'yoda_style' => [ + 'always_move_variable' => false, + 'equal' => false, + 'identical' => false, + ], + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'constant_case' => [ + 'case' => 'lower', + ], + 'class_attributes_separation' => true, + 'combine_consecutive_unsets' => true, + 'declare_strict_types' => true, + 'linebreak_after_opening_tag' => true, + 'lowercase_static_reference' => true, + 'no_useless_else' => true, + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => false, + 'not_operator_with_space' => false, + 'ordered_class_elements' => true, + 'php_unit_strict' => false, + 'phpdoc_separation' => false, + 'single_quote' => true, + 'standardize_not_equals' => true, + 'multiline_comment_opening_closing' => true, + 'phpdoc_summary' => false, + 'php_unit_test_class_requires_covers' => false, + 'global_namespace_import' => false, + 'phpdoc_order' => false, +]; + +if (PHP_VERSION_ID > 70400) { + $rules['no_useless_concat_operator'] = false; +} + +// 'no_useless_concat_operator' => false, + return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) - ->setRules([ - '@PSR12' => true, - '@Symfony' => true, - '@PhpCsFixer' => true, - 'array_syntax' => [ - 'syntax' => 'short', - ], - 'list_syntax' => [ - 'syntax' => 'short', - ], - 'concat_space' => [ - 'spacing' => 'one', - ], - 'blank_line_before_statement' => [ - 'statements' => [ - 'declare', - ], - ], - 'ordered_imports' => [ - 'imports_order' => [ - 'class', - 'function', - 'const', - ], - 'sort_algorithm' => 'alpha', - ], - 'single_line_comment_style' => [ - 'comment_types' => [ - ], - ], - 'yoda_style' => [ - 'always_move_variable' => false, - 'equal' => false, - 'identical' => false, - ], - 'multiline_whitespace_before_semicolons' => [ - 'strategy' => 'no_multi_line', - ], - 'constant_case' => [ - 'case' => 'lower', - ], - 'class_attributes_separation' => true, - 'combine_consecutive_unsets' => true, - 'declare_strict_types' => true, - 'linebreak_after_opening_tag' => true, - 'lowercase_static_reference' => true, - 'no_useless_else' => true, - 'no_unused_imports' => true, - 'not_operator_with_successor_space' => false, - 'not_operator_with_space' => false, - 'ordered_class_elements' => true, - 'php_unit_strict' => false, - 'phpdoc_separation' => false, - 'single_quote' => true, - 'standardize_not_equals' => true, - 'multiline_comment_opening_closing' => true, - 'phpdoc_summary' => false, - 'php_unit_test_class_requires_covers' => false, - 'global_namespace_import' => false, - 'phpdoc_order' => false, - 'no_useless_concat_operator' => false, - ]) + ->setRules($rules) ->setFinder( PhpCsFixer\Finder::create() ->in(__DIR__ . '/src')