Porting more tools to Phar to lower depend problems

This commit is contained in:
Jens True 2024-02-02 13:42:48 +00:00
parent 36dea4ea03
commit 769514b38e
8 changed files with 75 additions and 106 deletions

2
.gitignore vendored

@ -1,6 +1,6 @@
.vscode .vscode
vendor vendor
.phpunit.cache .*.cache/
*.phar *.phar
.phpdoc/ .phpdoc/
output/ output/

28
.phpcs.xml Normal file

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
<description>Coding standard</description>
<file>src/</file>
<file>tests/</file>
<file>benchmark/</file>
<rule ref="PSR1">
<exclude name="Generic.Files.LineLength"/>
</rule>
<rule ref="PSR2"></rule>
<rule ref="PSR12"></rule>
<!-- Ban some functions -->
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array">
<element key="sizeof" value="count"/>
<element key="delete" value="unset"/>
<element key="print" value="echo"/>
<element key="is_null" value="null"/>
<element key="create_function" value="null"/>
</property>
</properties>
</rule>
</ruleset>

13
.phplint.yml Normal file

@ -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"

@ -12,12 +12,4 @@ pipeline:
image: composer image: composer
commands: commands:
- composer install - composer install
- composer analyze - vendor/bin/phpunit tests
test:
image: php:cli-bookworm
commands:
- vendor/bin/phpunit tests
# document:
# image: phpdoc/phpdoc
# commands:
# - phpdoc

@ -6,11 +6,10 @@
"php": "^8.2" "php": "^8.2"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^10", "phpstan/phpstan": "^1.0",
"phpstan/phpstan": "^1", "vimeo/psalm": "^5.21.1",
"squizlabs/php_codesniffer": "*", "phpmetrics/phpmetrics": "^3.0-dev",
"vimeo/psalm": "^5.14", "phpunit/phpunit": "^10.5"
"phpmetrics/phpmetrics": "^3.0-dev"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@ -23,18 +22,26 @@
} }
}, },
"scripts": { "scripts": {
"test": "vendor/bin/phpunit tests --display-warnings", "test": "phpunit",
"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",
"document": "phpDocumentor --setting=graphs.enabled=true",
"benchmark": "phpbench run --report=default --output=build-artifact", "benchmark": "phpbench run --report=default --output=build-artifact",
"metrics": "vendor/bin/phpmetrics --config=phpmetrics.json", "metrics": "vendor/bin/phpmetrics --config=phpmetrics.json",
"analyze": [ "lint": [
"phplint",
"phpcs"
],
"static": [
"@analyze-phpstan", "@analyze-phpstan",
"@analyze-psalm", "@analyze-psalm"
"@analyze-phpcs"
], ],
"analyze-phpstan":"vendor/bin/phpstan analyze --error-format=raw", "analyze-phpstan":"vendor/bin/phpstan analyze --error-format=raw",
"analyze-psalm": "vendor/bin/psalm --no-cache", "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"
]
} }
} }

82
composer.lock generated

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9d079e1055ee327f2d46ed48b8a25cd6", "content-hash": "129eec96c91a9ee234640b9d6bcd0f43",
"packages": [], "packages": [],
"packages-dev": [ "packages-dev": [
{ {
@ -2770,86 +2770,6 @@
], ],
"time": "2023-11-14T14:08:51+00:00" "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", "name": "symfony/console",
"version": "v7.0.3", "version": "v7.0.3",

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false"> <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.2/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false" displayDetailsOnTestsThatTriggerWarnings="true">
<coverage/>
<testsuites> <testsuites>
<testsuite name="PHPSkills Test Suite"> <testsuite name="PHPSkills Test Suite">
<directory>./tests/</directory> <directory>./tests/</directory>
@ -11,4 +10,14 @@
<directory suffix=".php">src/</directory> <directory suffix=".php">src/</directory>
</include> </include>
</source> </source>
<logging>
<junit outputFile="output/test/junit.xml"/>
<testdoxHtml outputFile="output/test/index.html"/>
</logging>
<coverage>
<report>
<html outputDirectory="output/coverage" />
</report>
</coverage>
</phpunit> </phpunit>

@ -8,7 +8,7 @@ class Team extends RatingContainer
{ {
parent::__construct(); parent::__construct();
if (! is_null($player) && ! is_null($rating)) { if ($player && $rating) {
$this->addPlayer($player, $rating); $this->addPlayer($player, $rating);
} }
} }