From a4a009820236cf76692e55c53a9ee7694464bd7e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2026 16:42:23 +0000 Subject: [PATCH 1/2] Bump actions/stale from 10 to 11 Bumps [actions/stale](https://github.com/actions/stale) from 10 to 11. - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/stale/compare/v10...v11) --- updated-dependencies: - dependency-name: actions/stale dependency-version: '11' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/close_stale_issue.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/close_stale_issue.yml b/.github/workflows/close_stale_issue.yml index da40bb2..1b455b7 100644 --- a/.github/workflows/close_stale_issue.yml +++ b/.github/workflows/close_stale_issue.yml @@ -10,7 +10,7 @@ jobs: issues: write # for actions/stale to close stale issues runs-on: ubuntu-latest steps: - - uses: actions/stale@v10 + - uses: actions/stale@v11 with: stale-issue-message: >- There has been no activity on this issue for some time and therefore it is considered stale From 2611079ec61ff326f6c91158a4682c8a23c1cf16 Mon Sep 17 00:00:00 2001 From: Rom1-B <8530352+Rom1-B@users.noreply.github.com> Date: Mon, 3 Aug 2026 14:30:38 +0200 Subject: [PATCH 2/2] lint --- Makefile | 1 + ajax/dropdownReplaceFindDevice.php | 4 +-- rector.php | 45 ++++++++++++++---------------- 3 files changed, 24 insertions(+), 26 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ef1bed5 --- /dev/null +++ b/Makefile @@ -0,0 +1 @@ +include ../../PluginsMakefile.mk diff --git a/ajax/dropdownReplaceFindDevice.php b/ajax/dropdownReplaceFindDevice.php index 85cbf49..f2528de 100644 --- a/ajax/dropdownReplaceFindDevice.php +++ b/ajax/dropdownReplaceFindDevice.php @@ -50,9 +50,9 @@ throw new AccessDeniedHttpException(__s("You don't have permission to perform this action.")); } -if (class_exists($_REQUEST['itemtype']) && is_a($_REQUEST['itemtype'], CommonDBTM::class, true)) { +$item = getItemForItemtype($_REQUEST['itemtype']); +if ($item instanceof CommonDBTM) { $itemtypeisplugin = isPluginItemType($_REQUEST['itemtype']); - $item = new $_REQUEST['itemtype'](); $table = getTableForItemType($_REQUEST['itemtype']); $options = []; $count = 0; diff --git a/rector.php b/rector.php index 14bbcf4..aa2ab86 100644 --- a/rector.php +++ b/rector.php @@ -28,30 +28,27 @@ * ------------------------------------------------------------------------- */ +use Rector\Configuration\RectorConfigBuilder; + require_once __DIR__ . '/../../src/Plugin.php'; -use Rector\Caching\ValueObject\Storage\FileCacheStorage; -use Rector\Config\RectorConfig; -use Rector\ValueObject\PhpVersion; +$baseline_file = __DIR__ . '/../../PluginsRector.php'; +if (!file_exists($baseline_file)) { + throw new RuntimeException( + sprintf( + 'Unable to find "%s". Running rector on a plugin requires a GLPI development checkout that ships PluginsRector.php.', + $baseline_file, + ), + ); +} + +$baseline = require $baseline_file; + +/** @var RectorConfigBuilder $config */ +$config = $baseline([ + __DIR__ . '/ajax', + __DIR__ . '/front', + __DIR__ . '/inc', +]); -return RectorConfig::configure() - ->withPaths([ - __DIR__ . '/ajax', - __DIR__ . '/front', - __DIR__ . '/inc', - ]) - ->withPhpVersion(PhpVersion::PHP_82) - ->withCache( - cacheDirectory: __DIR__ . '/var/rector', - cacheClass: FileCacheStorage::class, - ) - ->withRootFiles() - ->withParallel(timeoutSeconds: 300) - ->withImportNames(removeUnusedImports: true) - ->withPreparedSets( - deadCode: true, - codeQuality: true, - codingStyle: true, - ) - ->withPhpSets(php82: true) // apply PHP sets up to PHP 8.2 -; +return $config;