Skip to content

Commit 6964ecc

Browse files
Bump the dev-dependencies group with 2 updates (#19341)
* Bump the dev-dependencies group with 2 updates Bumps the dev-dependencies group with 2 updates: [phpstan/phpstan](https://github.com/phpstan/phpstan) and [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer). Updates `phpstan/phpstan` from 2.1.6 to 2.1.11 - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.1.x/CHANGELOG.md) - [Commits](phpstan/phpstan@2.1.6...2.1.11) Updates `squizlabs/php_codesniffer` from 3.11.3 to 3.12.0 - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](PHPCSStandards/PHP_CodeSniffer@3.11.3...3.12.0) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch dependency-group: dev-dependencies - dependency-name: squizlabs/php_codesniffer dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies ... Signed-off-by: dependabot[bot] <[email protected]> * Fix CS * Fix Cannot unset property CommonDBRelation::$_force_log_option because it might have hooks in a subclass * Fix Cannot unset property CommonDBTM::$fields because it might have hooks in a subclass * Fix Cannot unset property NotificationTarget::$(recipient_)?data because it might have hooks in a subclass --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Johan Cwiklinski <[email protected]>
1 parent a7b01dc commit 6964ecc

31 files changed

+86
-128
lines changed

.phpstan-baseline.php

-30
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,6 @@
121121
'count' => 1,
122122
'path' => __DIR__ . '/front/inventory.php',
123123
];
124-
$ignoreErrors[] = [
125-
'message' => '#^PHPDoc tag @var with type class\\-string is not subtype of native type array\\<mixed\\>\\.$#',
126-
'identifier' => 'varTag.nativeType',
127-
'count' => 2,
128-
'path' => __DIR__ . '/front/item_device.php',
129-
];
130124
$ignoreErrors[] = [
131125
'message' => '#^Expression on left side of \\?\\? is not nullable\\.$#',
132126
'identifier' => 'nullCoalesce.expr',
@@ -1129,12 +1123,6 @@
11291123
'count' => 1,
11301124
'path' => __DIR__ . '/src/CommonDBRelation.php',
11311125
];
1132-
$ignoreErrors[] = [
1133-
'message' => '#^Property CommonDBRelation\\:\\:\\$_force_log_option \\(int\\) in isset\\(\\) is not nullable\\.$#',
1134-
'identifier' => 'isset.property',
1135-
'count' => 1,
1136-
'path' => __DIR__ . '/src/CommonDBRelation.php',
1137-
];
11381126
$ignoreErrors[] = [
11391127
'message' => '#^Unreachable statement \\- code above always terminates\\.$#',
11401128
'identifier' => 'deadCode.unreachable',
@@ -3133,12 +3121,6 @@
31333121
'count' => 1,
31343122
'path' => __DIR__ . '/src/Item_Rack.php',
31353123
];
3136-
$ignoreErrors[] = [
3137-
'message' => '#^PHPDoc tag @var with type int is not subtype of native type mixed\\.$#',
3138-
'identifier' => 'varTag.nativeType',
3139-
'count' => 1,
3140-
'path' => __DIR__ . '/src/Item_Rack.php',
3141-
];
31423124
$ignoreErrors[] = [
31433125
'message' => '#^Right side of && is always true\\.$#',
31443126
'identifier' => 'booleanAnd.rightAlwaysTrue',
@@ -3337,12 +3319,6 @@
33373319
'count' => 1,
33383320
'path' => __DIR__ . '/src/Log.php',
33393321
];
3340-
$ignoreErrors[] = [
3341-
'message' => '#^If condition is always true\\.$#',
3342-
'identifier' => 'if.alwaysTrue',
3343-
'count' => 1,
3344-
'path' => __DIR__ . '/src/Log.php',
3345-
];
33463322
$ignoreErrors[] = [
33473323
'message' => '#^Strict comparison using \\!\\=\\= between null and string will always evaluate to true\\.$#',
33483324
'identifier' => 'notIdentical.alwaysTrue',
@@ -4603,12 +4579,6 @@
46034579
'count' => 3,
46044580
'path' => __DIR__ . '/src/Search.php',
46054581
];
4606-
$ignoreErrors[] = [
4607-
'message' => '#^Offset 2 on array\\{0\\: string, 1\\: string, 2\\: string, 3\\: numeric\\-string, 4\\?\\: string, 5\\?\\: non\\-empty\\-string\\} in isset\\(\\) always exists and is not nullable\\.$#',
4608-
'identifier' => 'isset.offset',
4609-
'count' => 1,
4610-
'path' => __DIR__ . '/src/Search.php',
4611-
];
46124582
$ignoreErrors[] = [
46134583
'message' => '#^Offset 2 on array\\{string, string, string\\} in isset\\(\\) always exists and is not nullable\\.$#',
46144584
'identifier' => 'isset.offset',

ajax/dropdownMassiveActionField.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@
6161

6262

6363
if (
64-
isset($_POST["itemtype"])
65-
&& isset($_POST["id_field"]) && $_POST["id_field"]
64+
isset($_POST["id_field"]) && $_POST["id_field"]
6665
) {
6766
$search = Search::getOptions($_POST["itemtype"]);
6867
if (!isset($search[$_POST["id_field"]])) {

ajax/dropdownProjectTaskTicket.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@
5858
];
5959

6060
if (isset($_POST["used"]) && !empty($_POST["used"])) {
61-
if (isset($_POST["used"])) {
62-
$p["used"] = $_POST["used"];
63-
}
61+
$p["used"] = $_POST["used"];
6462
}
6563

6664
ProjectTask::dropdown($p);

ajax/savedsearch.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
return;
8181
}
8282

83-
$action = $_REQUEST['action'] ?? null;
83+
$action = $_REQUEST['action'];
8484

8585
if ($action == 'display_mine') {
8686
header("Content-Type: text/html; charset=UTF-8");

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"phpstan/phpstan": "^2.1",
8989
"phpstan/phpstan-deprecation-rules": "^2.0",
9090
"phpunit/phpunit": "^9.6",
91-
"squizlabs/php_codesniffer": "^3.11",
91+
"squizlabs/php_codesniffer": "^3.12",
9292
"symfony/browser-kit": "^5.4",
9393
"symfony/http-client": "^5.4",
9494
"symfony/mime": "^5.4"

composer.lock

+14-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/change.form.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@
201201
$change::showKanban(0);
202202
} else {
203203
$menus = ["helpdesk", "change"];
204-
Change::displayFullPageForItem($_REQUEST['id'] ?? 0, $menus, $_REQUEST);
204+
Change::displayFullPageForItem((int)($_REQUEST['id'] ?? 0), $menus, $_REQUEST);
205205
}
206206

207-
if (isset($_GET['id']) && ($_GET['id'] > 0)) {
208-
$url = KnowbaseItem::getFormURLWithParam($_GET) . '&_in_modal=1&item_itemtype=Change&item_items_id=' . $_GET['id'];
207+
$id = (int)$_GET['id'];
208+
if ($id > 0) {
209+
$url = KnowbaseItem::getFormURLWithParam($_GET) . '&_in_modal=1&item_itemtype=Change&item_items_id=' . $id;
209210
if (strpos($url, '_to_kb=') !== false) {
210211
Ajax::createIframeModalWindow(
211212
'savetokb',

front/item_device.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@
3838

3939
include('../inc/includes.php');
4040

41-
if (!isset($_GET['itemtype']) || !class_exists($_GET['itemtype'])) {
41+
$itemDevice = getItemForItemtype($_GET['itemtype']);
42+
if (!$itemDevice) {
4243
throw new \RuntimeException(
4344
'Missing or incorrect item device type called!'
4445
);
4546
}
4647

47-
/** @var class-string $_GET['itemtype'] */
48-
$itemDevice = getItemForItemtype($_GET['itemtype']);
4948
if (!$itemDevice->canView()) {
5049
Session::redirectIfNotLoggedIn();
5150
Html::displayRightError();
@@ -57,6 +56,6 @@
5756
Html::header($itemDevice->getTypeName(Session::getPluralNumber()), '', "config", "commondevice", $itemDevice->getType());
5857
}
5958

60-
Search::show($_GET['itemtype']);
59+
Search::show($itemDevice->getType());
6160

6261
Html::footer();

front/knowbaseitem.form.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
}
147147
}
148148
Html::back();
149-
} else if (isset($_GET["id"]) and isset($_GET['to_rev'])) {
149+
} else if (isset($_GET['to_rev'])) {
150150
$kb->check($_GET["id"], UPDATE);
151151
if ($kb->revertTo($_GET['to_rev'])) {
152152
Session::addMessageAfterRedirect(
@@ -166,7 +166,7 @@
166166
);
167167
}
168168
Html::redirect($kb->getFormURLWithID($_GET['id']));
169-
} else if (isset($_GET["id"])) {
169+
} else {
170170
if (!Session::getLoginUserID()) {
171171
Html::redirect("helpdesk.faq.php?id=" . $_GET['id']);
172172
}

front/networkalias.form.php

-4
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@
102102
$alias->showForm($_GET["id"], $_GET);
103103
Html::popFooter();
104104
} else {
105-
if (!isset($_GET["id"])) {
106-
$_GET["id"] = "";
107-
}
108-
109105
Session::checkRight("internet", UPDATE);
110106

111107
$menus = ['assets'];

front/problem.form.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120

121121
// Copy solution to KB redirect to KB
122122
if (isset($_POST['_sol_to_kb']) && $_POST['_sol_to_kb']) {
123-
Html::redirect(KnowbaseItem::getFormURL() . "?id=new&item_itemtype=Problem&item_items_id=" . $_POST["id"]);
123+
Html::redirect(KnowbaseItem::getFormURL() . "?id=new&item_itemtype=Problem&item_items_id=" . (int)$_POST["id"]);
124124
} else {
125125
Html::back();
126126
}
@@ -205,8 +205,9 @@
205205
Html::footer();
206206
} else {
207207
$options = $_REQUEST;
208-
if (isset($_GET['id']) && ($_GET['id'] > 0)) {
209-
$url = KnowbaseItem::getFormURLWithParam($_GET) . '&_in_modal=1&item_itemtype=Problem&item_items_id=' . $_GET['id'];
208+
$id = (int)$_GET['id'];
209+
if ($id > 0) {
210+
$url = KnowbaseItem::getFormURLWithParam($_GET) . '&_in_modal=1&item_itemtype=Problem&item_items_id=' . $id;
210211
if (strpos($url, '_to_kb=') !== false) {
211212
$options['after_display'] = Ajax::createIframeModalWindow(
212213
'savetokb',
@@ -222,7 +223,7 @@
222223
}
223224

224225
$menus = ["helpdesk", "problem"];
225-
Problem::displayFullPageForItem($_GET['id'] ?? 0, $menus, $options);
226+
Problem::displayFullPageForItem($id, $menus, $options);
226227
}
227228

228229
Html::footer();

front/report.location.list.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,8 @@
5252
echo "<div class='center spaced'><h2>" . sprintf(__('Network report by location: %s'), $name) .
5353
"</h2></div>";
5454

55-
$where = [];
56-
if (!empty($_POST['locations_id'])) {
57-
$sons = getSonsOf('glpi_locations', $_POST['locations_id']);
58-
$where = ['glpi_locations.id' => $sons];
59-
}
55+
$sons = getSonsOf('glpi_locations', $_POST['locations_id']);
56+
$where = ['glpi_locations.id' => $sons];
6057

6158
Report::reportForNetworkInformations(
6259
'glpi_locations', //from

front/socket.form.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@
140140
}
141141

142142
$options = [];
143-
if (isset($_GET["id"])) {
143+
if ($_GET["id"]) {
144144
$options['id'] = $_GET["id"];
145145
}
146146

147-
if (isset($_GET["items_id"])) {
147+
if ($_GET["items_id"]) {
148148
$options['items_id'] = $_GET["items_id"];
149149
}
150150

front/stat.location.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@
138138
echo "</form>";
139139

140140
if (
141-
empty($_GET["dropdown"])
142-
|| !($item = getItemForItemtype($_GET["dropdown"]))
141+
!($item = getItemForItemtype($_GET["dropdown"]))
143142
) {
144143
// Do nothing
145144
Html::footer();

front/ticket.form.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@
234234
Html::back();
235235
}
236236

237-
if (isset($_GET["id"]) && ($_GET["id"] > 0)) {
237+
$id = (int)$_GET['id'];
238+
if ($id > 0) {
238239
$available_options = ['load_kb_sol', '_openfollowup'];
239240
$options = [];
240241

@@ -244,7 +245,7 @@
244245
}
245246
}
246247

247-
$url = KnowbaseItem::getFormURLWithParam($_GET) . '&_in_modal=1&item_itemtype=Ticket&item_items_id=' . $_GET['id'];
248+
$url = KnowbaseItem::getFormURLWithParam($_GET) . '&_in_modal=1&item_itemtype=Ticket&item_items_id=' . $id;
248249
if (strpos($url, '_to_kb=') !== false) {
249250
$options['after_display'] = Ajax::createIframeModalWindow(
250251
'savetokb',

front/tracking.injector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
$track = new Ticket();
5757

5858
// Security check
59-
if (empty($_POST) || (count($_POST) == 0)) {
59+
if (count($_POST) == 0) {
6060
Html::redirect($CFG_GLPI["root_doc"] . "/front/helpdesk.public.php");
6161
}
6262

inc/autoload.function.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function isAPI()
6060
/** @var array $CFG_GLPI */
6161
global $CFG_GLPI;
6262

63-
$called_url = (!empty($_SERVER['HTTPS'] ?? "") && ($_SERVER['HTTPS'] ?? "") !== 'off'
63+
$called_url = (($_SERVER['HTTPS'] ?? "") !== 'off'
6464
? 'https'
6565
: 'http') .
6666
'://' . ($_SERVER['HTTP_HOST'] ?? "") .
@@ -71,7 +71,7 @@ function isAPI()
7171
return true;
7272
}
7373

74-
$script = isset($_SERVER['SCRIPT_FILENAME']) ? $_SERVER['SCRIPT_FILENAME'] : '';
74+
$script = $_SERVER['SCRIPT_FILENAME'] ?? '';
7575
if (strpos($script, 'apirest.php') !== false) {
7676
return true;
7777
}

src/Auth.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ public function login($login_name, $login_password, $noauto = false, $remember_m
10321032
} else if ($CFG_GLPI["is_users_auto_add"]) {
10331033
// Auto add user
10341034
$input = $this->user->fields;
1035-
unset($this->user->fields);
1035+
$this->user->fields = [];
10361036
if ($authtype == self::EXTERNAL && !isset($input["authtype"])) {
10371037
$input["authtype"] = $authtype;
10381038
}

src/CommonDBConnexity.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public function checkAttachedItemChangesAllowed(array $input, array $fields)
308308

309309
// Solution 1 : If we cannot create the new item or delete the old item,
310310
// then we cannot update the item
311-
unset($new_item->fields);
311+
$new_item->fields = [];
312312

313313
if (
314314
$new_item->can(-1, CREATE, $input)

0 commit comments

Comments
 (0)