Skip to content

Commit e8cb101

Browse files
authored
phpstan level 5 (#650)
* phpstan level 5 * Fix phpstan * Typo, indent, typehint
1 parent c983bcb commit e8cb101

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

inc/deployfile.class.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function getTypes()
6464
'Computer' => __("Upload from computer", 'glpiinventory')
6565
];
6666

67-
if (GLPI_INSTALL_MODE !== 'CLOUD') {
67+
if (GLPI_INSTALL_MODE !== 'CLOUD') { //@phpstan-ignore-line
6868
$types['Server'] = __("Upload from server", 'glpiinventory');
6969
}
7070

inc/task.class.php

+15-11
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ public function getJoblogs(array $task_ids = [], $with_logs = true, $only_active
879879

880880
if (count($data_structure['result']) <= 0) {
881881
// Not useful to go further, we will not have any result to send!
882-
// Perharps the required tasks are not even active ;)
882+
// Perhaps the required tasks are not even active ;)
883883
return ['tasks' => $logs, 'agents' => $agents];
884884
}
885885

@@ -905,28 +905,29 @@ public function getJoblogs(array $task_ids = [], $with_logs = true, $only_active
905905
"Job: " . print_r($result, true)
906906
);
907907

908-
$task_id = $result['task_id'];
908+
$task_id = (int)$result['task_id'];
909909
if (!array_key_exists($task_id, $logs)) {
910910
$logs[$task_id] = [
911-
'task_name' => $result['task_name'],
912-
'task_id' => $result['task_id'],
913-
'expanded' => false,
914-
'jobs' => []
911+
'task_name' => $result['task_name'],
912+
'task_id' => $result['task_id'],
913+
'expanded' => false,
914+
'jobs' => []
915915
];
916916
}
917917

918918
if (isset($expanded[$task_id])) {
919919
$logs[$task_id]['expanded'] = $expanded[$task_id];
920920
}
921921

922-
$job_id = $result['job_id'];
922+
$job_id = (int)$result['job_id'];
923+
/** @var array $jobs_handle */
923924
$jobs_handle = &$logs[$task_id]['jobs'];
924925
if (!isset($jobs_handle[$job_id])) {
925926
$jobs_handle[$job_id] = [
926-
'name' => $result['job_name'],
927-
'id' => $result['job_id'],
928-
'method' => $result['job_method'],
929-
'targets' => []
927+
'name' => $result['job_name'],
928+
'id' => $result['job_id'],
929+
'method' => $result['job_method'],
930+
'targets' => []
930931
];
931932
}
932933
$targets = importArrayFromDB($result['job_targets']);
@@ -1090,6 +1091,7 @@ public function getJoblogs(array $task_ids = [], $with_logs = true, $only_active
10901091
continue;
10911092
}
10921093
$job_id = (int)$taskjob['id'];
1094+
/** @var array $jobs */
10931095
$jobs = &$logs[$task_id]['jobs'];
10941096
if (!isset($jobs[$job_id])) {
10951097
continue;
@@ -1265,7 +1267,9 @@ public function getJoblogs(array $task_ids = [], $with_logs = true, $only_active
12651267
$run_id = $log_result['run_id'];
12661268
$run_data = $runs_id[$run_id];
12671269

1270+
/** @var array $jobs */
12681271
$jobs = &$logs[$run_data['task_id']]['jobs'];
1272+
/** @var array $targets */
12691273
$targets = &$jobs[$run_data['jobs_id']]['targets'];
12701274

12711275
$targets[$run_data['target_id']]['agents'][$run_data['agent_id']][] = [

phpstan.neon

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parameters:
22
parallel:
33
maximumNumberOfProcesses: 2
4-
level: 2
4+
level: 5
55
bootstrapFiles:
66
- ../../inc/based_config.php
77
- setup.php

0 commit comments

Comments
 (0)