Skip to content

Commit 38ce739

Browse files
authored
Feat(CI): standardize CI conf (#1091)
* Fix(CI): clean dependencies * rector * fix * fix
1 parent 0b3de7c commit 38ce739

35 files changed

+538
-2705
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
.phpunit.result.cache
66
tests/files/
77
*.min.*
8+
var/

.php-cs-fixer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55

66
$finder = Finder::create()
77
->in(__DIR__)
8-
->name('*.php');
8+
->name('*.php')
9+
->ignoreVCSIgnored(true);
910

1011
$config = new Config();
1112

1213
$rules = [
13-
'@PER-CS2.0' => true,
14-
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'array_destructuring', 'arrays']], // For PHP 7.4 compatibility
14+
'@PER-CS' => true, // Latest PER rules.
1515
];
1616

1717
return $config
1818
->setRules($rules)
1919
->setFinder($finder)
20-
->setUsingCache(false);
20+
->setCacheFile(__DIR__ . '/var/php-cs-fixer/.php-cs-fixer.cache')
21+
;

ajax/container.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
if ($items_id > 0 && !$item->getFromDB($items_id)) {
5353
throw new NotFoundHttpException();
5454
}
55+
5556
$item->input = $input;
5657

5758
$display_condition = new PluginFieldsContainerDisplayCondition();

ajax/field_specific_fields.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
'multiple' => true,
6060
]);
6161
} else {
62-
$allowed_itemtypes = !empty($field->fields['allowed_values'])
63-
? json_decode($field->fields['allowed_values'])
64-
: [];
62+
$allowed_itemtypes = empty($field->fields['allowed_values'])
63+
? []
64+
: json_decode((string) $field->fields['allowed_values']);
6565
echo implode(
6666
', ',
6767
array_map(
@@ -72,10 +72,11 @@
7272
),
7373
);
7474
}
75+
7576
echo '</td>';
7677
} else {
7778
$dropdown_matches = [];
78-
$is_dropdown = $type == 'dropdown' || preg_match('/^dropdown-(?<class>.+)$/', $type, $dropdown_matches) === 1;
79+
$is_dropdown = $type == 'dropdown' || preg_match('/^dropdown-(?<class>.+)$/', (string) $type, $dropdown_matches) === 1;
7980
$is_dropdown_multi = ($is_dropdown && ($type != 'dropdown-Document'));
8081

8182
// Display "default value(s)" field
@@ -84,10 +85,12 @@
8485
echo __('Multiple dropdown', 'fields') . ' :';
8586
echo '<br />';
8687
}
88+
8789
echo __('Default value', 'fields') . ' :';
8890
if (in_array($type, ['date', 'datetime'])) {
8991
echo '<i class="pointer fa fa-info" title="' . __s("You can use 'now' for date and datetime field") . '"></i>';
9092
}
93+
9194
echo '</td>';
9295

9396
echo '<td>';
@@ -107,6 +110,7 @@
107110
} else {
108111
echo Dropdown::getYesNo($multiple);
109112
}
113+
110114
echo '<br />';
111115
} else {
112116
$multiple = false;
@@ -119,6 +123,7 @@
119123
if (!$multiple) {
120124
echo '<input type="hidden" name="default_value" value="" />';
121125
}
126+
122127
echo '</em>';
123128
} else {
124129
$itemtype = $type == 'dropdown'
@@ -127,6 +132,7 @@
127132
if ($field->fields['default_value'] === null) {
128133
$field->fields['default_value'] = '';
129134
}
135+
130136
$default_value = $multiple ? json_decode($field->fields['default_value']) : $field->fields['default_value'];
131137
Dropdown::show(
132138
$itemtype,
@@ -139,10 +145,11 @@
139145
],
140146
);
141147
}
148+
142149
echo '</div>';
143150
Ajax::updateItemOnSelectEvent(
144-
"dropdown_multiple$rand",
145-
"plugin_fields_specific_fields_$rand",
151+
'dropdown_multiple' . $rand,
152+
'plugin_fields_specific_fields_' . $rand,
146153
'../ajax/field_specific_fields.php',
147154
[
148155
'id' => $id,
@@ -159,5 +166,6 @@
159166
],
160167
);
161168
}
169+
162170
echo '</td>';
163171
}

composer.json

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,14 @@
44
"symfony/yaml": "^7.3"
55
},
66
"require-dev": {
7-
"friendsofphp/php-cs-fixer": "^3.89",
8-
"friendsoftwig/twigcs": "^6.1",
9-
"glpi-project/tools": "^0.8.3",
10-
"php-parallel-lint/php-parallel-lint": "^1.4",
11-
"phpstan/extension-installer": "^1.4",
12-
"phpstan/phpstan": "^2.1",
13-
"phpstan/phpstan-deprecation-rules": "^2.0"
7+
"glpi-project/tools": "^0.8.3"
148
},
159
"config": {
1610
"optimize-autoloader": true,
1711
"platform": {
1812
"php": "8.2.99"
1913
},
20-
"sort-packages": true,
21-
"allow-plugins": {
22-
"phpstan/extension-installer": true
23-
}
14+
"sort-packages": true
2415
},
2516
"autoload-dev": {
2617
"psr-4": {

0 commit comments

Comments
 (0)