Skip to content

Commit f968c7c

Browse files
authored
Add php-cs-fixer (#29)
1 parent f6d1297 commit f968c7c

26 files changed

Lines changed: 2516 additions & 780 deletions

.php-cs-fixer.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
use PhpCsFixer\Config;
4+
use PhpCsFixer\Finder;
5+
6+
$finder = Finder::create()
7+
->in(__DIR__)
8+
->name('*.php');
9+
10+
$config = new Config();
11+
12+
$rules = [
13+
'@PER-CS2.0' => true,
14+
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'array_destructuring', 'arrays']], // For PHP 7.4 compatibility
15+
];
16+
17+
return $config
18+
->setRules($rules)
19+
->setFinder($finder)
20+
->setUsingCache(false);

ajax/agent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
$agent = new Agent();
4242
if (!$agent->getFromDB($_POST['id'])) {
4343
Response::sendError(404, 'Unable to load agent #' . $_POST['id']);
44+
4445
return;
4546
};
4647
$answer = [];

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"php": ">=7.4"
44
},
55
"require-dev": {
6+
"friendsofphp/php-cs-fixer": "^3.64",
67
"glpi-project/tools": "^0.7.3",
78
"php-parallel-lint/php-parallel-lint": "^1.4",
8-
"phpstan/phpstan": "^1.12",
9-
"squizlabs/php_codesniffer": "^3.10"
9+
"phpstan/phpstan": "^1.12"
1010
},
1111
"config": {
1212
"optimize-autoloader": true,

0 commit comments

Comments
 (0)