Skip to content

Commit

Permalink
refactor(phpunit.xml.dist, psalm.xml.dist, rector.php): Update config…
Browse files Browse the repository at this point in the history
…uration files

- Add cacheResultFile and executionOrder attributes in phpunit.xml.dist
- Reorder attributes in psalm.xml.dist
- Add StrictArrayParamDimFetchRector class to rector.php
  • Loading branch information
guanguans committed Jul 14, 2023
1 parent 9ba70bc commit 4cf37d6
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
8 changes: 5 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@
"mark-start": "printf '\\n!\\n!\\t\\033[0;36m%s\\033[0m\\n!\\n\\n' \"Started\"",
"md-fix": "@md-lint --fix",
"md-lint": "lint-md --config .lintmdrc ./*.md ./.github/ ./docs/",
"pest": "@php ./vendor/bin/pest --cache-result-file=./build//phpunit/.phpunit.result.cache --ansi -v",
"pest": "@php ./vendor/bin/pest",
"pest-coverage": "@pest --coverage-html=./build/phpunit/ --coverage-clover=clover.xml --coverage",
"pest-migrate-configuration": "@pest --migrate-configuration",
"phpstan": "@php ./vendor/bin/phpstan analyse --ansi -v",
"phpstan-baseline": "@phpstan --generate-baseline --allow-empty-baseline",
"post-merge": [
Expand All @@ -155,7 +156,8 @@
"rector-dry-run": "@rector --dry-run",
"style-fix": "@php ./vendor/bin/php-cs-fixer fix --using-cache=yes --config=.php-cs-fixer.php --ansi -v",
"style-lint": "@style-fix --diff --dry-run",
"test": "@php ./vendor/bin/phpunit --cache-result-file=./build/phpunit/.phpunit.result.cache --coverage-text -v",
"test-coverage": "@test --coverage-html=./build/phpunit/ --coverage-clover=clover.xml"
"test": "@php ./vendor/bin/phpunit --coverage-text -v",
"test-coverage": "@test --coverage-html=./build/phpunit/ --coverage-clover=clover.xml",
"test-migrate-configuration": "@test --migrate-configuration"
}
}
10 changes: 10 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
parameters:
ignoreErrors:
-
message: "#^Call to method run\\(\\) on an unknown class Guanguans\\\\SoarPHP\\\\Concerns\\\\HasOptions\\.$#"
count: 3
path: src/Soar.php

-
message: "#^Call to method scores\\(\\) on an unknown class Guanguans\\\\SoarPHP\\\\Concerns\\\\HasOptions\\.$#"
count: 3
path: src/Soar.php

-
message: "#^Result of && is always false\\.$#"
count: 2
Expand Down
4 changes: 3 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="tests/bootstrap.php"
cacheResultFile="build/phpunit/.phpunit.result.cache"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
executionOrder="depends,defects"
processIsolation="false"
stopOnFailure="false"
verbose="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd"
>
<testsuites>
<testsuite name="Application Test Suite">
Expand Down
6 changes: 3 additions & 3 deletions psalm.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<psalm
errorLevel="4"
findUnusedVariablesAndParams="true"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
cacheDirectory="./build/psalm/"
errorBaseline="psalm-baseline.xml"
errorLevel="4"
findUnusedVariablesAndParams="true"
>
<projectFiles>
<directory name="src"/>
Expand All @@ -26,6 +25,7 @@
</errorLevel>
</UndefinedDocblockClass>
</issueHandlers>

<plugins>
<!--<pluginClass class="Psalm\LaravelPlugin\Plugin"/>-->
</plugins>
Expand Down
4 changes: 4 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Strict\Rector\BooleanNot\BooleanInBooleanNotRuleFixerRector;
use Rector\TypeDeclaration\Rector\ClassMethod\StrictArrayParamDimFetchRector;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->importNames(true, false);
Expand Down Expand Up @@ -113,6 +114,9 @@
StaticClosureRector::class => [
__DIR__.'/tests/Concerns/WithRunableTest.php',
],
StrictArrayParamDimFetchRector::class => [
__DIR__.'/src/Concerns/WithDumpable.php',
],

// paths
__DIR__.'/tests/AspectMock',
Expand Down

0 comments on commit 4cf37d6

Please sign in to comment.