diff --git a/.styleci.yml b/.styleci.yml index 5b7ddb2..d9b7e2a 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -17,9 +17,11 @@ enabled: - combine_nested_dirname - declare_strict_types - dir_constant + - empty_loop_body_braces - fully_qualified_strict_types - function_to_constant - hash_to_slash_comment + - integer_literal_case - is_null - logical_operators - magic_constant_casing @@ -56,7 +58,6 @@ enabled: - phpdoc_order - phpdoc_property - phpdoc_scalar - - phpdoc_separation - phpdoc_singular_inheritdoc - phpdoc_trim - phpdoc_trim_consecutive_blank_line_separation @@ -78,9 +79,8 @@ enabled: - trailing_comma_in_multiline_array - unalign_double_arrow - unalign_equals - - empty_loop_body_braces - - integer_literal_case - union_type_without_spaces disabled: - function_declaration + - psr12_braces diff --git a/LICENSE b/LICENSE index fab6bc9..26e57ae 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,16 @@ MIT License -Copyright (c) 2023 yii-tools +Copyright (c) 2024 by <your name> All rights reserved. -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: +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 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. +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/ecs.php b/ecs.php index 78342b8..6331e59 100644 --- a/ecs.php +++ b/ecs.php @@ -7,41 +7,35 @@ use PhpCsFixer\Fixer\ClassNotation\OrderedTraitsFixer; use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer; use Symplify\EasyCodingStandard\Config\ECSConfig; -use Symplify\EasyCodingStandard\ValueObject\Set\SetList; -return function (ECSConfig $ecsConfig): void { - $ecsConfig->paths( +return ECSConfig::configure() + ->withConfiguredRule( + ClassDefinitionFixer::class, + [ + 'space_before_parenthesis' => true, + ], + ) + ->withFileExtensions(['php']) + ->withPaths( [ __DIR__ . '/src', __DIR__ . '/tests', - ] - ); - - // this way you add a single rule - $ecsConfig->rules( + ], + ) + ->withPhpCsFixerSets(perCS20: true) + ->withPreparedSets( + arrays: true, + cleanCode: true, + comments:true, + docblocks: true, + namespaces: true, + psr12: true, + strict: true + ) + ->withRules( [ + NoUnusedImportsFixer::class, OrderedClassElementsFixer::class, OrderedTraitsFixer::class, - NoUnusedImportsFixer::class, ] ); - - // this way you can add sets - group of rules - $ecsConfig->sets( - [ - // run and fix, one by one - SetList::DOCBLOCK, - SetList::NAMESPACES, - SetList::COMMENTS, - SetList::PSR_12, - ] - ); - - // this way configures a rule - $ecsConfig->ruleWithConfiguration( - ClassDefinitionFixer::class, - [ - 'space_before_parenthesis' => true, - ], - ); -}; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index f29a28d..8ff515d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,24 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> <phpunit - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" - bootstrap="vendor/autoload.php" - cacheDirectory=".phpunit.cache" - colors="true" - executionOrder="depends,defects" - failOnRisky="true" - failOnWarning="true" - stopOnFailure="false" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" + bootstrap="vendor/autoload.php" + cacheDirectory=".phpunit.cache" + colors="true" + executionOrder="depends,defects" + failOnRisky="true" + failOnWarning="true" + stopOnFailure="false" > - <testsuites> - <testsuite name="Template"> - <directory>tests</directory> - </testsuite> - </testsuites> + <testsuites> + <testsuite name="Template"> + <directory>tests</directory> + </testsuite> + </testsuites> - <source> - <include> - <directory suffix=".php">./src</directory> - </include> - </source> + <source> + <include> + <directory suffix=".php">./src</directory> + </include> + </source> </phpunit> diff --git a/psalm.xml b/psalm.xml index 19f0435..943c003 100644 --- a/psalm.xml +++ b/psalm.xml @@ -11,4 +11,7 @@ <projectFiles> <directory name="src" /> </projectFiles> + <issueHandlers> + <MixedAssignment errorLevel="suppress" /> + </issueHandlers> </psalm>