diff --git a/.gitignore b/.gitignore index 6aac50d..a2bb31f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .vscode vendor -.phpunit.cache +.*.cache/ *.phar .phpdoc/ output/ \ No newline at end of file diff --git a/.phpcs.xml b/.phpcs.xml new file mode 100644 index 0000000..bf7a001 --- /dev/null +++ b/.phpcs.xml @@ -0,0 +1,28 @@ + + + Coding standard + + src/ + tests/ + benchmark/ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.phplint.yml b/.phplint.yml new file mode 100644 index 0000000..9060bba --- /dev/null +++ b/.phplint.yml @@ -0,0 +1,13 @@ +path: + - src/ + - tests/ + - benchmark/ +jobs: 10 +extensions: + - php +exclude: + - vendor +warning: true +memory-limit: -1 +no-cache: true +log-junit: "output/lint.xml" \ No newline at end of file diff --git a/.woodpecker.yml b/.woodpecker.yml index 66325f0..de5b496 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -12,12 +12,4 @@ pipeline: image: composer commands: - composer install - - composer analyze - test: - image: php:cli-bookworm - commands: - - vendor/bin/phpunit tests -# document: -# image: phpdoc/phpdoc -# commands: -# - phpdoc \ No newline at end of file + - vendor/bin/phpunit tests \ No newline at end of file diff --git a/composer.json b/composer.json index fa50db5..fee61bd 100644 --- a/composer.json +++ b/composer.json @@ -6,11 +6,10 @@ "php": "^8.2" }, "require-dev": { - "phpunit/phpunit": "^10", - "phpstan/phpstan": "^1", - "squizlabs/php_codesniffer": "*", - "vimeo/psalm": "^5.14", - "phpmetrics/phpmetrics": "^3.0-dev" + "phpstan/phpstan": "^1.0", + "vimeo/psalm": "^5.21.1", + "phpmetrics/phpmetrics": "^3.0-dev", + "phpunit/phpunit": "^10.5" }, "autoload": { "psr-4": { @@ -23,18 +22,26 @@ } }, "scripts": { - "test": "vendor/bin/phpunit tests --display-warnings", - "test-coverage": "vendor/bin/phpunit tests --testdox --coverage-filter src --coverage-html output/coverage --coverage-text --testdox-html output/test.html --log-junit output/test.xml", - "document": "phpDocumentor --setting=graphs.enabled=true", + "test": "phpunit", + "document": "phpDocumentor", "benchmark": "phpbench run --report=default --output=build-artifact", "metrics": "vendor/bin/phpmetrics --config=phpmetrics.json", - "analyze": [ + "lint": [ + "phplint", + "phpcs" + ], + "static": [ "@analyze-phpstan", - "@analyze-psalm", - "@analyze-phpcs" + "@analyze-psalm" ], "analyze-phpstan":"vendor/bin/phpstan analyze --error-format=raw", "analyze-psalm": "vendor/bin/psalm --no-cache", - "analyze-phpcs": "vendor/bin/phpcs --report=emacs --standard=PSR1,PSR2,PSR12 --exclude=Generic.Files.LineLength src tests benchmark" + "all": [ + "@test", + "@document", + "@benchmark", + "@lint", + "@static" + ] } } diff --git a/composer.lock b/composer.lock index 952df3a..866f2fb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9d079e1055ee327f2d46ed48b8a25cd6", + "content-hash": "129eec96c91a9ee234640b9d6bcd0f43", "packages": [], "packages-dev": [ { @@ -2770,86 +2770,6 @@ ], "time": "2023-11-14T14:08:51+00:00" }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.8.1", - "source": { - "type": "git", - "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" - }, - "bin": [ - "bin/phpcbf", - "bin/phpcs" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "Former lead" - }, - { - "name": "Juliette Reinders Folmer", - "role": "Current lead" - }, - { - "name": "Contributors", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "keywords": [ - "phpcs", - "standards", - "static analysis" - ], - "support": { - "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", - "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", - "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", - "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" - }, - "funding": [ - { - "url": "https://github.com/PHPCSStandards", - "type": "github" - }, - { - "url": "https://github.com/jrfnl", - "type": "github" - }, - { - "url": "https://opencollective.com/php_codesniffer", - "type": "open_collective" - } - ], - "time": "2024-01-11T20:47:48+00:00" - }, { "name": "symfony/console", "version": "v7.0.3", diff --git a/phpunit.xml b/phpunit.xml index 6e336e0..cdce282 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,5 @@ - - + ./tests/ @@ -11,4 +10,14 @@ src/ + + + + + + + + + + diff --git a/src/Team.php b/src/Team.php index 10c06f1..298fe87 100644 --- a/src/Team.php +++ b/src/Team.php @@ -8,7 +8,7 @@ class Team extends RatingContainer { parent::__construct(); - if (! is_null($player) && ! is_null($rating)) { + if ($player && $rating) { $this->addPlayer($player, $rating); } }