Last active
January 17, 2023 07:23
-
-
Save fzed51/1ad76506ce5dd47a88efda449723750a to your computer and use it in GitHub Desktop.
Fichier de configuration pour PhpCs, PhpUnit, PhpStan et script composer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
composer require --dev phpunit/phpunit | |
composer require --dev squizlabs/php_codesniffer | |
composer require --dev phpstan/phpstan | |
composer require --dev ocramius/package-versions | |
wget "https://gist.github.com/fzed51/1ad76506ce5dd47a88efda449723750a/archive/ab318f190a80008262cd01b4627b4e6aabbe8b3b.zip" -OutFile ./gist.zip | |
7z e .\gist.zip -o'.' */*.xml | |
7z e .\gist.zip -o'.' */*.neon | |
7z e .\gist.zip -o'.' */*.php | |
del ./gist.zip | |
php ./add-composer-scripts.php | |
del ./add-composer-scripts.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$f = './composer.json'; | |
$c = json_decode(file_get_contents($f), true); | |
$c['scripts'] = array_merge( | |
$c['scripts'] ?? [], | |
[ | |
'lint' => ['phpcs --cache', "php -d xdebug.mode="" vendor/bin/phpstan"], | |
'fixed' => 'phpcbf', | |
'test' => ['Composer\Config::disableProcessTimeout', 'phpunit'] | |
] | |
); | |
file_put_contents($f, json_encode($c, 128)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<ruleset name="PHP_CodeSniffer"> | |
<description>The coding standard for fzed51</description> | |
<file>src</file> | |
<file>test</file> | |
<arg name="colors"/> | |
<arg name="parallel" value="75"/> | |
<arg value="np"/> | |
<!-- Don't hide tokenizer exceptions --> | |
<rule ref="Internal.Tokenizer.Exception"> | |
<type>error</type> | |
</rule> | |
<rule ref="PSR2" /> | |
<rule ref="PSR1.Methods.CamelCapsMethodName"> | |
<exclude-pattern>test/*</exclude-pattern> | |
<exclude-pattern>test/**/*</exclude-pattern> | |
</rule> | |
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses"> | |
<exclude-pattern>test/*</exclude-pattern> | |
<exclude-pattern>test/**/*</exclude-pattern> | |
</rule> | |
<rule ref="Generic.Files.LineEndings"> | |
<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/> | |
</rule> | |
<rule ref="PEAR.Commenting.ClassComment.Missing"/> | |
<rule ref="PEAR.Commenting.FunctionComment.Missing"> | |
<exclude-pattern>test/*</exclude-pattern> | |
<exclude-pattern>test/**/*</exclude-pattern> | |
</rule> | |
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/> | |
<rule ref="Generic.PHP.RequireStrictTypes"/> | |
</ruleset> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parameters: | |
# editorUrl: 'vscode://file/%%file%%:%%line%%' | |
# editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' | |
level: 6 | |
paths: | |
- src | |
- test | |
# bootstrapFiles: | |
# - bootstrap/define.php | |
ignoreErrors: | |
- '#Strict comparison using === between PDOStatement and false will always evaluate to false.#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" | |
bootstrap="vendor/autoload.php" | |
cacheResultFile=".phpunit.cache/test-results" | |
executionOrder="depends,defects" | |
forceCoversAnnotation="false" | |
beStrictAboutCoversAnnotation="true" | |
beStrictAboutOutputDuringTests="true" | |
beStrictAboutTodoAnnotatedTests="true" | |
convertDeprecationsToExceptions="true" | |
failOnRisky="true" | |
failOnWarning="true" | |
verbose="true" | |
testdox="true"> | |
<coverage cacheDirectory=".phpunit.cache/code-coverage" | |
processUncoveredFiles="true"> | |
<include> | |
<directory suffix=".php">src</directory> | |
</include> | |
</coverage> | |
<php> | |
<ini name="xdebug.default_enable" value="1"/> | |
<ini name="xdebug.remote_enable" value="1"/> | |
<ini name="xdebug.remote_autostart" value="1"/> | |
<ini name="xdebug.remote_connect_back" value="1"/> | |
<ini name="xdebug.remote_port" value="9000"/> | |
</php> | |
<testsuites> | |
<testsuite name="default"> | |
<directory suffix="Test.php">test</directory> | |
</testsuite> | |
</testsuites> | |
</phpunit> |
ajout du script de modification de composer.json
modification de command-line pour prendre en compte le nouveau script
- modification du titre "command-line"
- modification du script composer "lint"
- modification du lien de téléchargement de l'archive
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
modification du phpunit.xml pour v9.5