Skip to content

Commit

Permalink
Feat php cs fixer (#75)
Browse files Browse the repository at this point in the history
* Add workflows to sync locales

* Add php-cs-fixer
  • Loading branch information
Rom1-B authored Sep 12, 2024
1 parent baa072c commit f4d5808
Show file tree
Hide file tree
Showing 16 changed files with 2,422 additions and 775 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/locales-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: "Synchronize locales"

on:
schedule:
- cron: "0 0 * * 1-5"
workflow_dispatch:

jobs:
sync-with-transifex:
name: "Sync with transifex"
uses: "glpi-project/plugin-translation-workflows/.github/workflows/transifex-sync.yml@v1"
secrets:
github-token: "${{ secrets.LOCALES_SYNC_TOKEN }}"
transifex-token: "${{ secrets.TRANSIFEX_TOKEN }}"
13 changes: 13 additions & 0 deletions .github/workflows/locales-update-source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Update locales sources"

on:
push:
branches:
- "main"

jobs:
push-on-transifex:
name: "Push locales sources"
uses: "glpi-project/plugin-translation-workflows/.github/workflows/transifex-push-sources.yml@v1"
secrets:
transifex-token: "${{ secrets.TRANSIFEX_TOKEN }}"
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);
4 changes: 2 additions & 2 deletions ajax/extract_json.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
* -------------------------------------------------------------------------
*/

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

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

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"lcobucci/jwt": "^4.2"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.64",
"glpi-project/tools": "^0.7.3",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/phpstan": "^1.12",
"squizlabs/php_codesniffer": "^3.10"
"phpstan/phpstan": "^1.12"
},
"provide": {
"guzzlehttp/guzzle": "*",
Expand Down
Loading

0 comments on commit f4d5808

Please sign in to comment.