Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Replace PHPCS with PHP-CS-Fixer to enforce coding guidelines #4949

Open
wants to merge 4 commits into
base: 9.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions .composer.json
Expand Up @@ -13,16 +13,19 @@
"provide": {
},
"scripts": {
"lint:phpcs": "../../bin/phpcs --colors",
"lint:phpcs:fix": "../../bin/phpcbf --colors",
"lint:php-cs-fixer": "../../bin/php-cs-fixer check",
"lint:php-cs-fixer:fix": "../../bin/php-cs-fixer fix",
"lint:phpstan": "../../bin/phpstan analyse",
"lint:phpstan-generate-baseline": "../../bin/phpstan analyse --generate-baseline",
"lint:distributionintegrity": "[ -d 'Neos.ContentRepository' ] && { echo 'Package Neos.ContentRepository should not exist.' 1>&2; exit 1; } || exit 0;",
"lint": [
"@lint:phpcs",
"@lint:php-cs-fixer",
"@lint:phpstan",
"@lint:distributionintegrity"
],
"lint:fix": [
"@lint:php-cs-fixer:fix"
],
"test:unit": [
"../../bin/phpunit --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/UnitTests.xml Neos.ContentRepository.Core/Tests/Unit",
"../../bin/phpunit --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/UnitTests.xml Neos.ContentRepositoryRegistry/Tests/Unit"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
/.php-cs-fixer.cache
21 changes: 21 additions & 0 deletions .php-cs-fixer.dist.php
@@ -0,0 +1,21 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in([
'./Neos.ContentGraph.DoctrineDbalAdapter/src',
'./Neos.ContentGraph.PostgreSQLAdapter/src',
'./Neos.ContentRepository.BehavioralTests/Classes',
'./Neos.ContentRepository.TestSuite/Classes',
'./Neos.ContentRepository.Core/Classes',
'./Neos.Neos/Classes',
]);

return (new PhpCsFixer\Config())
->setRules([
'@PSR12' => true,
'no_unused_imports' => true,
'ordered_imports' => [
'sort_algorithm' => 'alpha',
]
])
->setFinder($finder);
11 changes: 7 additions & 4 deletions composer.json
Expand Up @@ -98,16 +98,19 @@
"neos/contentrepositoryregistry-storageclient": "self.version"
},
"scripts": {
"lint:phpcs": "../../bin/phpcs --colors",
"lint:phpcs:fix": "../../bin/phpcbf --colors",
"lint:php-cs-fixer": "../../bin/php-cs-fixer check",
"lint:php-cs-fixer:fix": "../../bin/php-cs-fixer fix",
"lint:phpstan": "../../bin/phpstan analyse",
"lint:phpstan-generate-baseline": "../../bin/phpstan analyse --generate-baseline",
"lint:distributionintegrity": "[ -d 'Neos.ContentRepository' ] && { echo 'Package Neos.ContentRepository should not exist.' 1>&2; exit 1; } || exit 0;",
"lint": [
"@lint:phpcs",
"@lint:php-cs-fixer",
"@lint:phpstan",
"@lint:distributionintegrity"
],
"lint:fix": [
"@lint:php-cs-fixer:fix"
],
"test:unit": [
"../../bin/phpunit --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/UnitTests.xml Neos.ContentRepository.Core/Tests/Unit",
"../../bin/phpunit --colors --stop-on-failure -c ../../Build/BuildEssentials/PhpUnit/UnitTests.xml Neos.ContentRepositoryRegistry/Tests/Unit"
Expand Down Expand Up @@ -310,7 +313,7 @@
"require-dev": {
"roave/security-advisories": "dev-latest",
"phpstan/phpstan": "^1.8",
"squizlabs/php_codesniffer": "^3.6",
"friendsofphp/php-cs-fixer": "^3.5",
"phpunit/phpunit": "^9.0",
"neos/behat": "*",
"league/flysystem-memory": "^3"
Expand Down
15 changes: 0 additions & 15 deletions phpcs.xml.dist

This file was deleted.