Skip to content

Commit

Permalink
Add php-cs-fixer (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rom1-B authored Oct 18, 2024
1 parent 88f6a5b commit fc47155
Show file tree
Hide file tree
Showing 16 changed files with 2,828 additions and 1,136 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);
6 changes: 3 additions & 3 deletions ajax/ack.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

Session::checkRight('computer', UPDATE);

header("Content-Type: text/html; charset=UTF-8");
header('Content-Type: text/html; charset=UTF-8');

if (isset($_POST['hostid'])) {
$host = new Host();
$res_a = $host->acknowledgement($_POST['hostid'], $_POST['params']);
$host = new Host();
$res_a = $host->acknowledgement($_POST['hostid'], $_POST['params']);
}
6 changes: 3 additions & 3 deletions ajax/cancelDowntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

Session::checkRight('computer', UPDATE);

header("Content-Type: text/html; charset=UTF-8");
header('Content-Type: text/html; charset=UTF-8');

if (isset($_POST['downtimeid'])) {
$host = new Host();
$res_d = $host->cancelActualDownTime($_POST['downtimeid']);
$host = new Host();
$res_d = $host->cancelActualDownTime($_POST['downtimeid']);
}
6 changes: 3 additions & 3 deletions ajax/hostTimeline.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@

Session::checkRight('computer', READ);

header("Content-Type: text/html; charset=UTF-8");
header('Content-Type: text/html; charset=UTF-8');

if (isset($_GET['period']) && isset($_GET['hostid'])) {
$param_period = $_GET['period'];
$param_hostid = $_GET['hostid'];
$host = new Host();
$res = $host->hostTimeline($param_hostid, $_GET['period']);
$host = new Host();
$res = $host->hostTimeline($param_hostid, $_GET['period']);
}
4 changes: 2 additions & 2 deletions ajax/sendCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

Session::checkRight('computer', UPDATE);

header("Content-Type: text/html; charset=UTF-8");
header('Content-Type: text/html; charset=UTF-8');

if (isset($_POST['hostid'])) {
$host = new Host();
$host = new Host();
$rescheck = $host->sendCheck($_POST['hostid']);
}
8 changes: 4 additions & 4 deletions ajax/setDowntime.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@

Session::checkRight('computer', UPDATE);

header("Content-Type: text/html; charset=UTF-8");
header('Content-Type: text/html; charset=UTF-8');

if (isset($_POST['params'])) {
$params = $_POST['params'];
$hostid = (int) $_POST['hostid'];
$host = new Host();
$params = $_POST['params'];
$hostid = (int) $_POST['hostid'];
$host = new Host();
$resdowntime = $host->setDowntime($hostid, $params);
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"php": ">=7.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.64",
"glpi-project/tools": "^0.7.4",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/phpstan": "^1.12",
Expand Down
Loading

0 comments on commit fc47155

Please sign in to comment.