diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..22aac70 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +/tests export-ignore +/vendor export-ignore + +/LICENSE export-ignore +/Makefile export-ignore +/README.md export-ignore +/phpmd.xml export-ignore +/phpunit.xml export-ignore +/phpstan.neon.dist export-ignore +/infection.json.dist export-ignore + +/.github export-ignore +/.gitignore export-ignore +/.gitattributes export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32850ac..105bc90 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Use PHP 8.2 + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + - name: Install dependencies run: composer update --no-progress --optimize-autoloader @@ -33,6 +38,11 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Use PHP 8.2 + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + - name: Install dependencies run: composer update --no-progress --optimize-autoloader diff --git a/Makefile b/Makefile index 9bf35fe..1b3026e 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,17 @@ DOCKER_RUN = docker run --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.2 -.PHONY: configure test test-no-coverage review show-reports clean +.PHONY: configure test test-file test-no-coverage review show-reports clean configure: @${DOCKER_RUN} composer update --optimize-autoloader -test: review +test: @${DOCKER_RUN} composer tests -test-no-coverage: review +test-file: + @${DOCKER_RUN} composer tests-file-no-coverage ${FILE} + +test-no-coverage: @${DOCKER_RUN} composer tests-no-coverage review: @@ -19,4 +22,4 @@ show-reports: clean: @sudo chown -R ${USER}:${USER} ${PWD} - @rm -rf report vendor + @rm -rf report vendor .phpunit.cache diff --git a/README.md b/README.md index e9d0419..e9279db 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ get the default amount fraction digits for the respective currency. ```php $currency = Currency::USD; -$currency->name; # USD -$currency->value; # USD -$currency->getDefaultFractionDigits(); # 2 +$currency->name; # USD +$currency->value; # USD +$currency->getFractionDigits(); # 2 ```
diff --git a/composer.json b/composer.json index cbd1e07..e4ed20c 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,6 @@ "keywords": [ "vo", "psr", - "psr-4", - "psr-12", "currency", "iso-4217", "tiny-blocks", @@ -22,6 +20,10 @@ "homepage": "https://github.com/gustavofreze" } ], + "support": { + "issues": "https://github.com/tiny-blocks/currency/issues", + "source": "https://github.com/tiny-blocks/currency" + }, "config": { "sort-packages": true, "allow-plugins": { @@ -39,24 +41,27 @@ } }, "require": { - "php": "^8.1||^8.2" + "php": "^8.2" }, "require-dev": { - "infection/infection": "^0.26", - "phpmd/phpmd": "^2.13", - "phpunit/phpunit": "^9.6", - "squizlabs/php_codesniffer": "^3.7" + "phpmd/phpmd": "^2.15", + "phpunit/phpunit": "^11", + "phpstan/phpstan": "^1", + "infection/infection": "^0.29", + "squizlabs/php_codesniffer": "^3.10" }, "scripts": { "phpcs": "phpcs --standard=PSR12 --extensions=php ./src", "phpmd": "phpmd ./src text phpmd.xml --suffixes php --exclude /src/Currency.php --ignore-violations-on-exit", + "phpstan": "phpstan analyse -c phpstan.neon.dist --quiet --no-progress", "test": "phpunit --log-junit=report/coverage/junit.xml --coverage-xml=report/coverage/coverage-xml --coverage-html=report/coverage/coverage-html tests", "test-mutation": "infection --only-covered --logger-html=report/coverage/mutation-report.html --coverage=report/coverage --min-msi=100 --min-covered-msi=100 --threads=4", "test-no-coverage": "phpunit --no-coverage", "test-mutation-no-coverage": "infection --only-covered --min-msi=100 --threads=4", "review": [ "@phpcs", - "@phpmd" + "@phpmd", + "@phpstan" ], "tests": [ "@test", diff --git a/infection.json.dist b/infection.json.dist index d840b61..351e7f9 100644 --- a/infection.json.dist +++ b/infection.json.dist @@ -1,22 +1,21 @@ { "timeout": 10, "testFramework": "phpunit", - "tmpDir": "report/", + "tmpDir": "report/infection/", "source": { "directories": [ "src" ] }, "logs": { - "text": "report/logs/infection-text.log", - "summary": "report/logs/infection-summary.log" + "text": "report/infection/logs/infection-text.log", + "summary": "report/infection/logs/infection-summary.log" }, "mutators": { - "@default": true, - "MatchArmRemoval": false + "@default": true }, "phpUnit": { "configDir": "", "customPath": "./vendor/bin/phpunit" } -} \ No newline at end of file +} diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 0000000..b99884f --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,7 @@ +parameters: + paths: + - src + level: 9 + tmpDir: report/phpstan + ignoreErrors: + reportUnmatchedIgnoredErrors: false diff --git a/phpunit.xml b/phpunit.xml index 3d05fc8..7f080dd 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,25 +1,35 @@