Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d35dd96

Browse files
committedApr 11, 2024·
Remove unnecessary type hints
1 parent 2debaeb commit d35dd96

File tree

5 files changed

+0
-46
lines changed

5 files changed

+0
-46
lines changed
 

‎application/controllers/EventRuleController.php

-6
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ public function indexAction(): void
5050
$this->addTitleTab(t('Event Rule'));
5151
$this->controls->addAttributes(['class' => 'event-rule-detail']);
5252

53-
/** @var string $ruleId */
5453
$ruleId = $this->params->getRequired('id');
55-
/** @var array<string, mixed>|null $configValues */
5654
$configValues = $this->sessionNamespace->get($ruleId);
5755
$this->controls->addAttributes(['class' => 'event-rule-detail']);
5856

@@ -99,7 +97,6 @@ public function indexAction(): void
9997
})
10098
->handleRequest($this->getServerRequest());
10199

102-
/** @var array<string, mixed> $cache */
103100
$cache = $this->sessionNamespace->get($ruleId);
104101
$discardChangesButton = null;
105102
if ($cache !== null) {
@@ -188,7 +185,6 @@ public function fromDb(int $ruleId): array
188185
foreach ($rule->rule_escalation as $re) {
189186
foreach ($re as $k => $v) {
190187
if (in_array($k, ['id', 'condition'])) {
191-
/** @var int|string|null $v */
192188
$config[$re->getTableName()][$re->position][$k] = (string) $v;
193189
}
194190
}
@@ -245,7 +241,6 @@ public function searchEditorAction(): void
245241

246242
$editor = new SearchEditor();
247243

248-
/** @var string $objectFilter */
249244
$objectFilter = $eventRule['object_filter'] ?? '';
250245
$editor->setQueryString($objectFilter);
251246
$editor->setAction(Url::fromRequest()->getAbsoluteUrl());
@@ -302,7 +297,6 @@ public function editAction(): void
302297
{
303298
/** @var string $ruleId */
304299
$ruleId = $this->params->getRequired('id');
305-
/** @var array<string, mixed>|null $config */
306300
$config = $this->sessionNamespace->get($ruleId);
307301
if ($config === null) {
308302
if ($ruleId === '-1') {

‎application/controllers/EventRulesController.php

-9
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,12 @@ public function addAction(): void
107107
$this->getTabs()->setRefreshUrl(Url::fromPath('notifications/event-rules/add'));
108108

109109
$this->controls->addAttributes(['class' => 'event-rule-detail']);
110-
/** @var string $ruleId */
111110
$ruleId = $this->params->get('id') ?? '-1';
112111

113112
$params = $this->params->toArray(false);
114-
/** @var array<string, mixed>|null $config */
115113
$config = $this->sessionNamespace->get($ruleId);
116114

117115
if ($config === null) {
118-
/** @var array<string, mixed> $config */
119116
$config = $params;
120117
}
121118

@@ -139,9 +136,7 @@ public function addAction(): void
139136

140137
$eventRuleConfig
141138
->on(Form::ON_SUCCESS, function (EventRuleConfigForm $form) use ($config) {
142-
/** @var string $ruleId */
143139
$ruleId = $config['id'];
144-
/** @var string $ruleName */
145140
$ruleName = $config['name'];
146141
$form->addOrUpdateRule($ruleId, $config);
147142
$this->sessionNamespace->delete($ruleId);
@@ -181,10 +176,7 @@ public function completeAction(): void
181176

182177
public function searchEditorAction(): void
183178
{
184-
/** @var string $ruleId */
185179
$ruleId = $this->params->shiftRequired('id');
186-
187-
/** @var array<string, mixed>|null $eventRule */
188180
$eventRule = $this->sessionNamespace->get($ruleId);
189181

190182
if ($eventRule === null) {
@@ -193,7 +185,6 @@ public function searchEditorAction(): void
193185

194186
$editor = new SearchEditor();
195187

196-
/** @var string $objectFilter */
197188
$objectFilter = $eventRule['object_filter'] ?? '';
198189
$editor->setQueryString($objectFilter);
199190
$editor->setAction(Url::fromRequest()->getAbsoluteUrl());

‎application/forms/EventRuleConfigElements/EscalationCondition.php

-11
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ protected function assemble(): void
5555
['value' => (string) $defaultCount]
5656
);
5757

58-
/** @var SubmitButtonElement $addCondition */
5958
$addCondition = $this->createElement(
6059
'submitButton',
6160
'add-condition',
@@ -69,7 +68,6 @@ protected function assemble(): void
6968

7069
$this->registerElement($addCondition);
7170

72-
/** @var string|int $conditionCount */
7371
$conditionCount = $this->getValue('condition-count');
7472
$conditionCount = (int) $conditionCount;
7573
$this->addElement(
@@ -88,7 +86,6 @@ protected function assemble(): void
8886
$typeName = 'type_' . $i;
8987
$valName = 'val_' . $i;
9088

91-
/** @var BaseFormElement $col */
9289
$col = $this->createElement(
9390
'select',
9491
$colName,
@@ -105,7 +102,6 @@ protected function assemble(): void
105102
);
106103

107104
$operators = ['=', '>', '>=', '<', '<=', '!='];
108-
/** @var BaseFormElement $op */
109105
$op = $this->createElement(
110106
'select',
111107
$opName,
@@ -118,7 +114,6 @@ protected function assemble(): void
118114

119115
switch ($this->getPopulatedValue('column_' . $i)) {
120116
case 'incident_severity':
121-
/** @var BaseFormElement $val */
122117
$val = $this->createElement(
123118
'select',
124119
$valName,
@@ -152,7 +147,6 @@ protected function assemble(): void
152147

153148
break;
154149
case 'incident_age':
155-
/** @var BaseFormElement $val */
156150
$val = $this->createElement(
157151
'text',
158152
$valName,
@@ -193,7 +187,6 @@ protected function assemble(): void
193187

194188
break;
195189
default:
196-
/** @var BaseFormElement $val */
197190
$val = $this->createElement('text', $valName, [
198191
'class' => 'right-operand',
199192
'placeholder' => $this->translate('Please make a decision'),
@@ -206,7 +199,6 @@ protected function assemble(): void
206199
$this->registerElement($val);
207200

208201
(new EventRuleDecorator())->decorate($val);
209-
/** @var ?SubmitButtonElement $removeButton */
210202
$removeButton = $this->createRemoveButton($i);
211203

212204
$this->conditions[$i] = new EscalationConditionListItem(
@@ -217,7 +209,6 @@ protected function assemble(): void
217209
);
218210
}
219211

220-
/** @var string $removePosition */
221212
$removePosition = $this->getValue('remove');
222213
if ($removePosition) {
223214
unset($this->conditions[$removePosition]);
@@ -261,13 +252,11 @@ protected function assemble(): void
261252
protected function createRemoveButton(int $count): ?SubmitButtonElement
262253
{
263254
// check for count and if allow zero conditions
264-
/** @var string|int $conditionCount */
265255
$conditionCount = $this->getValue('condition-count');
266256
if ((int) $conditionCount === 1 && ! $this->allowZeroConditions) {
267257
return null;
268258
}
269259

270-
/** @var SubmitButtonElement $removeButton */
271260
$removeButton = $this->createElement(
272261
'submitButton',
273262
'remove',

‎application/forms/EventRuleConfigElements/EscalationRecipient.php

-9
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ protected function assemble(): void
3131
['value' => '1']
3232
);
3333

34-
/** @var SubmitButtonElement $addRecipientButton */
3534
$addRecipientButton = $this->createElement(
3635
'submitButton',
3736
'add-recipient',
@@ -44,7 +43,6 @@ protected function assemble(): void
4443
);
4544

4645
$this->registerElement($addRecipientButton);
47-
/** @var int $recipientCount */
4846
$recipientCount = $this->getValue('recipient-count');
4947
if ($addRecipientButton->hasBeenPressed()) {
5048
$recipientCount += 1;
@@ -77,7 +75,6 @@ protected function assemble(): void
7775
$options = ['' => sprintf(' - %s - ', $this->translate('Please choose'))];
7876
$options += Channel::fetchChannelNames(Database::get());
7977

80-
/** @var SelectElement $val */
8178
$val = $this->createElement(
8279
'select',
8380
'val_' . $i,
@@ -89,7 +86,6 @@ protected function assemble(): void
8986
]
9087
);
9188

92-
/** @var string $recipientVal */
9389
$recipientVal = $this->getValue('column_' . $i);
9490
if ($recipientVal !== null) {
9591
$recipient = explode('_', $recipientVal);
@@ -105,7 +101,6 @@ protected function assemble(): void
105101
}
106102
}
107103
} else {
108-
/** @var BaseFormElement $val */
109104
$val = $this->createElement('text', 'val_' . $i, [
110105
'class' => 'right-operand',
111106
'placeholder' => $this->translate('Please make a decision'),
@@ -116,7 +111,6 @@ protected function assemble(): void
116111

117112
$this->registerElement($val);
118113

119-
/** @var ?SubmitButtonElement $removeButton */
120114
$removeButton = $this->createRemoveButton($i);
121115

122116
$this->recipients[$i] = new EscalationRecipientListItem(
@@ -126,7 +120,6 @@ protected function assemble(): void
126120
);
127121
}
128122

129-
/** @var string $removePosition */
130123
$removePosition = $this->getValue('remove');
131124
if ($removePosition) {
132125
unset($this->recipients[$removePosition]);
@@ -189,7 +182,6 @@ protected function fetchOptions(): array
189182
*/
190183
protected function createRemoveButton(int $pos): ?FormElement
191184
{
192-
/** @var string|int $recipientCount */
193185
$recipientCount = $this->getValue('recipient-count');
194186
if ((int) $recipientCount === 1) {
195187
return null;
@@ -228,7 +220,6 @@ public function getRecipients(): array
228220
/** @var int $count */
229221
$count = $this->getValue('recipient-count');
230222

231-
/** @var array<int, array<string, mixed>> $values */
232223
$values = [];
233224
for ($i = 1; $i <= $count; $i++) {
234225
$value = [];

‎application/forms/EventRuleConfigForm.php

-11
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ protected function assemble(): void
125125
]
126126
);
127127

128-
/** @var string $ruleId */
129128
$ruleId = $this->config['id'];
130129
if ($ruleId === '-1') {
131130
$initialZeroConditionEscalation = bin2hex('1');
@@ -139,7 +138,6 @@ protected function assemble(): void
139138
['value' => $initialZeroConditionEscalation]
140139
);
141140

142-
/** @var string $objectFilter */
143141
$objectFilter = $this->config['object_filter'] ?? '';
144142
$configFilter = (new EventRuleConfigFilter('config-filter'))
145143
->setObjectFilter($objectFilter)
@@ -168,10 +166,8 @@ protected function assemble(): void
168166
$this->addElement($prefixesElement);
169167
$this->handleAdd();
170168

171-
/** @var string $prefixesMapString */
172169
$prefixesMapString = $prefixesElement->getValue();
173170

174-
/** @var array<int, string> $prefixesMap */
175171
$prefixesMap = explode(',', $prefixesMapString);
176172
$escalationCount = count($prefixesMap);
177173

@@ -183,15 +179,13 @@ protected function assemble(): void
183179
$removeEscalationButtons[$prefixMap] = $this->createRemoveButton($prefixMap);
184180
}
185181

186-
/** @var ?string $removePosition */
187182
$removePosition = $this->getValue('remove-escalation');
188183
if ($removePosition) {
189184
if ($escalationCount === 2) {
190185
$removeEscalationButtons = [];
191186
}
192187
}
193188

194-
/** @var ?string $zeroConditionEscalation */
195189
$zeroConditionEscalation = $this->getValue('zero-condition-escalation');
196190

197191
$escalations = [];
@@ -280,7 +274,6 @@ protected function handleAdd(): void
280274

281275
if ($pressedButton && $pressedButton->getName() === 'add-escalation') {
282276
$this->clearPopulatedValue('prefixes-map');
283-
/** @var string $prefixesMapString */
284277
$prefixesMapString = $this->getValue('prefixes-map');
285278
$prefixesMap = explode(',', $prefixesMapString);
286279
$escalationFakePos = bin2hex(random_bytes(4));
@@ -508,7 +501,6 @@ public function addOrUpdateRule(string $id, array $config): void
508501
$escalationsFromDb = RuleEscalation::on($db)
509502
->filter(Filter::equal('rule_id', $id));
510503

511-
/** @var array<int, array<string, mixed>> $escalationsInCache */
512504
$escalationsInCache = $config['rule_escalation'];
513505

514506
$escalationsToUpdate = [];
@@ -567,7 +559,6 @@ private function insertOrUpdateEscalations(
567559
bool $insert = false
568560
): void {
569561
foreach ($escalations as $position => $escalationConfig) {
570-
/** @var array<int, array<string, mixed>> $recipientsFromConfig */
571562
$recipientsFromConfig = $escalationConfig['recipients'] ?? [];
572563
if ($insert) {
573564
$db->insert('rule_escalation', [
@@ -578,7 +569,6 @@ private function insertOrUpdateEscalations(
578569
'fallback_for' => $escalationConfig['fallback_for'] ?? null
579570
]);
580571

581-
/** @var string $escalationId */
582572
$escalationId = $db->lastInsertId();
583573
} else {
584574
/** @var string $escalationId */
@@ -618,7 +608,6 @@ function (array $element) use ($recipientId) {
618608
}
619609
}
620610

621-
/** @var array<string, mixed> $recipientConfig */
622611
foreach ($recipientsFromConfig as $recipientConfig) {
623612
$data = [
624613
'rule_escalation_id' => $escalationId,

0 commit comments

Comments
 (0)
Please sign in to comment.