diff --git a/.gitattributes b/.gitattributes index c8b78cd..478a2db 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,10 @@ -/tests export-ignore +* text=auto + +/.* export-ignore /example export-ignore +/tests export-ignore +/*.xml export-ignore +/*.yml export-ignore +/*.lock export-ignore +/*.dist export-ignore +/*.php export-ignore diff --git a/.github/workflows/cs-fix.yml b/.github/workflows/cs-fix.yml new file mode 100644 index 0000000..0395b27 --- /dev/null +++ b/.github/workflows/cs-fix.yml @@ -0,0 +1,12 @@ +on: + push: + branches: + - '*' + +name: Fix Code Style + +jobs: + cs-fix: + permissions: + contents: write + uses: spiral/gh-actions/.github/workflows/cs-fix.yml@master diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..29e9b2b --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,13 @@ +include(__DIR__ . '/src') + ->include(__DIR__ . '/testing/src') + ->include(__FILE__) + ->exclude(__DIR__ . '/src/Client/GRPC/ServiceClientInterface.php') + ->allowRisky(true) + ->build(); diff --git a/composer.json b/composer.json index 90d85b9..49f9ef9 100644 --- a/composer.json +++ b/composer.json @@ -51,6 +51,8 @@ "jetbrains/phpstorm-attributes": "^1.0", "mockery/mockery": "^1.4", "phpunit/phpunit": "^10.0", + "spiral/code-style": "^2.2", + "spiral/dumper": "^3.3", "vimeo/psalm": ">=5.8" }, "autoload": { @@ -66,8 +68,11 @@ } }, "scripts": { - "tests": "phpunit", - "psalm": "psalm --no-cache" + "cs:diff": "php-cs-fixer fix --dry-run -v --diff --show-progress dots", + "cs:fix": "php-cs-fixer fix -v", + "psalm": "psalm", + "psalm:baseline": "psalm --set-baseline=psalm-baseline.xml", + "tests": "phpunit" }, "config": { "sort-packages": true diff --git a/phpunit.xml b/phpunit.xml index c41f6b5..bb303be 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,8 +1,17 @@ - + src diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 0000000..119d221 --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,2 @@ + + diff --git a/psalm.xml b/psalm.xml index c5abbaa..aac55ff 100644 --- a/psalm.xml +++ b/psalm.xml @@ -3,6 +3,7 @@ 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" + errorBaseline="psalm-baseline.xml" errorLevel="1" hoistConstants="true" resolveFromConfigFile="true"