Skip to content

Commit

Permalink
Add php-cs-fixer (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rom1-B authored Sep 12, 2024
1 parent 7a3aa4a commit 7304e7e
Show file tree
Hide file tree
Showing 17 changed files with 2,141 additions and 440 deletions.
20 changes: 20 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use PhpCsFixer\Config;
use PhpCsFixer\Finder;

$finder = Finder::create()
->in(__DIR__)
->name('*.php');

$config = new Config();

$rules = [
'@PER-CS2.0' => true,
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'array_destructuring', 'arrays']], // For PHP 7.4 compatibility
];

return $config
->setRules($rules)
->setFinder($finder)
->setUsingCache(false);
14 changes: 7 additions & 7 deletions ajax/dropdownAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* -------------------------------------------------------------------------
*/

include("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
include('../../../inc/includes.php');
header('Content-Type: text/html; charset=UTF-8');
Html::header_nocache();

Session::checkLoginUser();
Expand All @@ -39,14 +39,14 @@

$iterator = $DB->request(
[
'FROM' => PluginOauthimapAuthorization::getTable(),
'WHERE' => [
'FROM' => PluginOauthimapAuthorization::getTable(),
'WHERE' => [
PluginOauthimapApplication::getForeignKeyField() => $_POST['application_id'] ?? null,
],
]
],
);
$authorizations = [
'-1' => __('Create authorization for another user', 'oauthimap')
'-1' => __('Create authorization for another user', 'oauthimap'),
];
$value = -1;
foreach ($iterator as $row) {
Expand All @@ -62,5 +62,5 @@
[
'display_emptychoice' => false,
'value' => $value,
]
],
);
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"php": ">=7.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.64",
"glpi-project/tools": "^0.7.3",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-deprecation-rules": "^1.2",
"squizlabs/php_codesniffer": "^3.10"
"phpstan/phpstan-deprecation-rules": "^1.2"
},
"provide": {
"guzzlehttp/guzzle": "*"
Expand Down
Loading

0 comments on commit 7304e7e

Please sign in to comment.