1
0
mirror of https://github.com/php/pie.git synced 2026-03-23 23:12:17 +01:00

Apply coding standards tooling

This commit is contained in:
James Titcumb
2024-02-28 20:57:51 +00:00
parent 47f37e27ff
commit e014807765
6 changed files with 304 additions and 3 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
/vendor/
/psalm.xml
/.phpunit.cache/
/.phpcs-cache

View File

@@ -29,11 +29,15 @@
"symfony/console": "^6.4"
},
"require-dev": {
"doctrine/coding-standard": "^12.0",
"phpunit/phpunit": "^10.5",
"vimeo/psalm": "^5.22"
},
"config": {
"sort-packages": true,
"preferred-install": "dist"
"preferred-install": "dist",
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}

281
composer.lock generated
View File

@@ -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": "e7cdf489763a8586119680d49cab3dbf",
"content-hash": "84a9164241781879ce2a3156ecb3fd35",
"packages": [
{
"name": "psr/container",
@@ -1092,6 +1092,84 @@
],
"time": "2022-02-25T21:32:43+00:00"
},
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/composer-installer.git",
"reference": "4be43904336affa5c2f70744a348312336afd0da"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da",
"reference": "4be43904336affa5c2f70744a348312336afd0da",
"shasum": ""
},
"require": {
"composer-plugin-api": "^1.0 || ^2.0",
"php": ">=5.4",
"squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0"
},
"require-dev": {
"composer/composer": "*",
"ext-json": "*",
"ext-zip": "*",
"php-parallel-lint/php-parallel-lint": "^1.3.1",
"phpcompatibility/php-compatibility": "^9.0",
"yoast/phpunit-polyfills": "^1.0"
},
"type": "composer-plugin",
"extra": {
"class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
},
"autoload": {
"psr-4": {
"PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Franck Nijhof",
"email": "franck.nijhof@dealerdirect.com",
"homepage": "http://www.frenck.nl",
"role": "Developer / IT Manager"
},
{
"name": "Contributors",
"homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors"
}
],
"description": "PHP_CodeSniffer Standards Composer Installer Plugin",
"homepage": "http://www.dealerdirect.com",
"keywords": [
"PHPCodeSniffer",
"PHP_CodeSniffer",
"code quality",
"codesniffer",
"composer",
"installer",
"phpcbf",
"phpcs",
"plugin",
"qa",
"quality",
"standard",
"standards",
"style guide",
"stylecheck",
"tests"
],
"support": {
"issues": "https://github.com/PHPCSStandards/composer-installer/issues",
"source": "https://github.com/PHPCSStandards/composer-installer"
},
"time": "2023-01-05T11:28:13+00:00"
},
{
"name": "dnoegel/php-xdg-base-dir",
"version": "v0.1.1",
@@ -1129,6 +1207,62 @@
},
"time": "2019-12-04T15:06:13+00:00"
},
{
"name": "doctrine/coding-standard",
"version": "12.0.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/coding-standard.git",
"reference": "1b2b7dc58c68833af481fb9325c25abd40681c79"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/coding-standard/zipball/1b2b7dc58c68833af481fb9325c25abd40681c79",
"reference": "1b2b7dc58c68833af481fb9325c25abd40681c79",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0.0",
"php": "^7.2 || ^8.0",
"slevomat/coding-standard": "^8.11",
"squizlabs/php_codesniffer": "^3.7"
},
"type": "phpcodesniffer-standard",
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Steve Müller",
"email": "st.mueller@dzh-online.de"
}
],
"description": "The Doctrine Coding Standard is a set of PHPCS rules applied to all Doctrine projects.",
"homepage": "https://www.doctrine-project.org/projects/coding-standard.html",
"keywords": [
"checks",
"code",
"coding",
"cs",
"dev",
"doctrine",
"rules",
"sniffer",
"sniffs",
"standard",
"style"
],
"support": {
"issues": "https://github.com/doctrine/coding-standard/issues",
"source": "https://github.com/doctrine/coding-standard/tree/12.0.0"
},
"time": "2023-04-24T17:43:28+00:00"
},
{
"name": "doctrine/deprecations",
"version": "1.1.3",
@@ -3217,6 +3351,71 @@
],
"time": "2023-02-07T11:34:05+00:00"
},
{
"name": "slevomat/coding-standard",
"version": "8.14.1",
"source": {
"type": "git",
"url": "https://github.com/slevomat/coding-standard.git",
"reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/slevomat/coding-standard/zipball/fea1fd6f137cc84f9cba0ae30d549615dbc6a926",
"reference": "fea1fd6f137cc84f9cba0ae30d549615dbc6a926",
"shasum": ""
},
"require": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0",
"php": "^7.2 || ^8.0",
"phpstan/phpdoc-parser": "^1.23.1",
"squizlabs/php_codesniffer": "^3.7.1"
},
"require-dev": {
"phing/phing": "2.17.4",
"php-parallel-lint/php-parallel-lint": "1.3.2",
"phpstan/phpstan": "1.10.37",
"phpstan/phpstan-deprecation-rules": "1.1.4",
"phpstan/phpstan-phpunit": "1.3.14",
"phpstan/phpstan-strict-rules": "1.5.1",
"phpunit/phpunit": "8.5.21|9.6.8|10.3.5"
},
"type": "phpcodesniffer-standard",
"extra": {
"branch-alias": {
"dev-master": "8.x-dev"
}
},
"autoload": {
"psr-4": {
"SlevomatCodingStandard\\": "SlevomatCodingStandard/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.",
"keywords": [
"dev",
"phpcs"
],
"support": {
"issues": "https://github.com/slevomat/coding-standard/issues",
"source": "https://github.com/slevomat/coding-standard/tree/8.14.1"
},
"funding": [
{
"url": "https://github.com/kukulich",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/slevomat/coding-standard",
"type": "tidelift"
}
],
"time": "2023-10-08T07:28:08+00:00"
},
{
"name": "spatie/array-to-xml",
"version": "3.2.3",
@@ -3280,6 +3479,86 @@
],
"time": "2024-02-07T10:39:02+00:00"
},
{
"name": "squizlabs/php_codesniffer",
"version": "3.9.0",
"source": {
"type": "git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b",
"reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b",
"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-02-16T15:06:51+00:00"
},
{
"name": "symfony/filesystem",
"version": "v6.4.3",

16
phpcs.xml.dist Normal file
View File

@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<ruleset name="PIE Coding Standard">
<config name="php_version" value="80100"/>
<arg value="p"/>
<arg value="s"/>
<arg name="colors"/>
<arg name="cache" value=".phpcs-cache"/>
<file>bin/pie</file>
<file>src</file>
<file>test/unit</file>
<rule ref="Doctrine">
<exclude name="Generic.Files.LineLength.TooLong"/>
</rule>
</ruleset>

View File

@@ -18,6 +18,7 @@ final class DownloadCommand extends Command
public function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('<info>to do</info>'); // @todo
return Command::SUCCESS;
}
}

View File

@@ -15,7 +15,7 @@ class DownloadCommandTest extends TestCase
{
public function testDownloadCommand(): void
{
$input = $this->createMock(InputInterface::class);
$input = $this->createMock(InputInterface::class);
$output = $this->createMock(OutputInterface::class);
$output->expects(self::once())