Skip to content

Commit

Permalink
Feature/ci (#364)
Browse files Browse the repository at this point in the history
* Add CI

* phpcbf

* phpcbf+mano

* visibility

* phpstan level 0

* phpstan level 1

* Add phpstan config

* Some phpstan lvl 2 fixes, won't be enforced

* Fix CI
  • Loading branch information
trasher authored Nov 15, 2023
1 parent ef7c4b9 commit 66dc3be
Show file tree
Hide file tree
Showing 33 changed files with 5,638 additions and 4,989 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: "Continuous integration"

on:
push:
branches:
- "master"
tags:
- "*"
pull_request:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
ci:
name: "GLPI ${{ matrix.glpi-version }} - php:${{ matrix.php-version }} - ${{ matrix.db-image }}"
strategy:
fail-fast: false
matrix:
include:
- {glpi-version: "10.0.x", php-version: "7.4", db-image: "mysql:5.7"}
- {glpi-version: "10.0.x", php-version: "8.0", db-image: "mysql:8.0"}
- {glpi-version: "10.0.x", php-version: "8.1", db-image: "mariadb:10.2"}
- {glpi-version: "10.0.x", php-version: "8.2", db-image: "mariadb:11.0"}
- {glpi-version: "10.0.x", php-version: "8.3-rc", db-image: "mysql:8.0"}
uses: "glpi-project/plugin-ci-workflows/.github/workflows/continuous-integration.yml@v1"
with:
plugin-key: "genericobject"
glpi-version: "${{ matrix.glpi-version }}"
php-version: "${{ matrix.php-version }}"
db-image: "${{ matrix.db-image }}"
17 changes: 17 additions & 0 deletions .phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<ruleset>
<file>.</file>
<exclude-pattern>/.git/</exclude-pattern>
<exclude-pattern type="relative">^vendor/</exclude-pattern>

<arg name="colors" />
<arg name="extensions" value="php" />
<arg value="p" />
<arg name="warning-severity" value="0" />

<rule ref="PSR12">
<exclude name="Generic.Files.LineLength" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
<rule ref="Generic.Arrays.ArrayIndent"></rule>
</ruleset>
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"php": ">=7.4"
},
"require-dev": {
"glpi-project/tools": "^0.6"
"glpi-project/tools": "^0.7.1",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "^3.7"
},
"config": {
"optimize-autoloader": true,
Expand Down
196 changes: 188 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions front/commondropdown.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@
* -------------------------------------------------------------------------
*/

include ("../../../inc/includes.php");
include("../../../inc/includes.php");

if (isset($_REQUEST['itemtype'])) {
$itemtype = $_REQUEST['itemtype'];
if (class_exists($itemtype)) {
$dropdown = new $itemtype();
include (GLPI_ROOT . "/front/dropdown.common.form.php");
} else {
Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject'));
}
$itemtype = $_REQUEST['itemtype'];
if (class_exists($itemtype)) {
$dropdown = new $itemtype();
include(GLPI_ROOT . "/front/dropdown.common.form.php");
} else {
Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject'));
}
} else {

Html::displayErrorAndDie(__('Not Found!'));
Html::displayErrorAndDie(__('Not Found!'));
}
21 changes: 9 additions & 12 deletions front/commondropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,16 @@
* -------------------------------------------------------------------------
*/

include ("../../../inc/includes.php");
include("../../../inc/includes.php");

if (isset($_REQUEST['itemtype'])) {
$itemtype = $_REQUEST['itemtype'];
if (class_exists($itemtype)) {
$dropdown = new $itemtype();
include (GLPI_ROOT . "/front/dropdown.common.php");
} else {
Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject'));
}
$itemtype = $_REQUEST['itemtype'];
if (class_exists($itemtype)) {
$dropdown = new $itemtype();
include(GLPI_ROOT . "/front/dropdown.common.php");
} else {
Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject'));
}
} else {

Html::displayErrorAndDie(__('Not Found!'));
Html::displayErrorAndDie(__('Not Found!'));
}


19 changes: 9 additions & 10 deletions front/commontreedropdown.form.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@
* -------------------------------------------------------------------------
*/

include ("../../../inc/includes.php");
include("../../../inc/includes.php");

if (isset($_REQUEST['itemtype'])) {
$itemtype = $_REQUEST['itemtype'];
if (class_exists($itemtype)) {
$dropdown = new $itemtype();
include (GLPI_ROOT . "/front/dropdown.common.form.php");
} else {
Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject'));
}
$itemtype = $_REQUEST['itemtype'];
if (class_exists($itemtype)) {
$dropdown = new $itemtype();
include(GLPI_ROOT . "/front/dropdown.common.form.php");
} else {
Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject'));
}
} else {

Html::displayErrorAndDie(__('Not Found!'));
Html::displayErrorAndDie(__('Not Found!'));
}
4 changes: 2 additions & 2 deletions front/commontreedropdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
* -------------------------------------------------------------------------
*/

include ("../../../inc/includes.php");
include ("./commondropdown.php");
include("../../../inc/includes.php");
include("./commondropdown.php");
Loading

0 comments on commit 66dc3be

Please sign in to comment.