Skip to content

Commit

Permalink
fix: replace ECS with PHP-CS-Fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
montchr committed Jun 26, 2024
1 parent 0edcfcc commit bf2b6b1
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.direnv
.local
result
.php-cs-fixer.cache

composer.phar
/vendor/
Expand Down
31 changes: 31 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

/*
* This document has been generated with
* https://mlocati.github.io/php-cs-fixer-configurator/#version:3.58.1|configurator
* you can change this configuration by importing this file.
*/
$config = new PhpCsFixer\Config();

return $config
->setRules([
'@Symfony' => true,
'@PER-CS' => true,
'function_declaration' => ['closure_fn_spacing' => 'one'],
'global_namespace_import' => true,
'multiline_whitespace_before_semicolons' => true,
'no_alternative_syntax' => [
'fix_non_monolithic_code' => false,
],
'yoda_style' => [
'equal' => false,
'identical' => false,
],
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->ignoreVCSIgnored(true),
);
15 changes: 7 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kleinweb/php-coding-standards",
"description": "PHP coding standards for Klein Digitial Initiatives",
"description": "PHP coding standards for Klein College of Media and Communication",
"license": "GPL-3.0-or-later",
"type": "phpcodesniffer-standard",
"keywords": ["phpcs", "static analysis"],
Expand All @@ -14,7 +14,7 @@
},
"require-dev": {
"ergebnis/composer-normalize": "^2.43",
"symplify/easy-coding-standard": "^12.3"
"friendsofphp/php-cs-fixer": "^3.59"
},
"config": {
"allow-plugins": {
Expand All @@ -23,11 +23,10 @@
}
},
"scripts": {
"ecs": "ecs check --config=$PRJ_ROOT/ecs.php",
"fix": ["@ecs --fix --ansi", "@phpcbf"],
"check": ["@phpcs"],
"lint": ["@ecs --ansi", "@check"],
"phpcbf": "phpcbf --extensions=php --standard=$PRJ_ROOT/phpcs.xml.dist",
"phpcs": "phpcs --extensions=php --standard=$PRJ_ROOT/phpcs.xml.dist"
"php-cs-fixer": "php-cs-fixer",
"phpcbf": "phpcbf --extensions=php --standard=$PRJ_ROOT/.phpcs.xml.dist",
"phpcs": "phpcs --extensions=php --standard=$PRJ_ROOT/.phpcs.xml.dist",
"lint": ["@phpcs"],
"fix": ["@php-cs-fixer fix", "@phpcbf"]
}
}
48 changes: 0 additions & 48 deletions ecs.php

This file was deleted.

2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset name="Kleinweb PHP Coding Standards">
<file>./ecs.php</file>
<file>./.php-cs-fixer.dist.php</file>

<rule ref="Kleinweb" />
</ruleset>

0 comments on commit bf2b6b1

Please sign in to comment.