-
Notifications
You must be signed in to change notification settings - Fork 0
Modernize the code #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Modernize the code #403
Conversation
2bf4959 to
25c7cb4
Compare
34029a8 to
3af0375
Compare
sukhwinder33445
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have looked through the files up to MoveRotationForm.php.
3af0375 to
3723f76
Compare
0094a30 to
c043776
Compare
library/Notifications/Web/Control/SearchBar/ExtraTagSuggestions.php
Outdated
Show resolved
Hide resolved
1fa2990 to
5820718
Compare
sukhwinder33445
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
5820718 to
3cfc457
Compare
|
The last force push did not change anything, but only moved a change from one commit into another. |
| '24-7' => $rotation->options['at'], | ||
| 'partial' => $rotation->options['from'], | ||
| 'multi' => $rotation->options['from_at'], | ||
| default => throw new LogicException('Invalid mode') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is about modernizing code. A logic exception is something that must not happen. It's simply a programming error and an end-user should never face it. As such, this is only to prevent the routine continue and to not run into a even more convoluted error.
So, back to modernizing, what does a match expression do without a default case? Right, complain.
It's as simple as that. What does the logic exception do? Complain. The same thing. So let's get rid of it already.
| property: 'data', | ||
| ref: '#/components/schemas/' . $entityName, | ||
| description: sprintf('Successfull response with the %s object', $entityName), | ||
| description: sprintf('Successful response with the %s object', $entityName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has an influence on the rendered api description. Update it by running icingacli notifications openapi generate.
| $this->object instanceof Event => new EventRenderer(), | ||
| $this->object instanceof Incident => new IncidentRenderer(), | ||
| $this->object instanceof Contactgroup => new ContactgroupRenderer(), | ||
| default => throw new NotImplementedError('Not implemented') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, let the match throw
3cfc457 to
33260df
Compare
As we now use php 8.2 as minimal version, the following modernizations have been added to the code:
str_contains(),str_starts_with()andstr_ends_with())Additionally the import blocks have been sorted, indentation has been fixed, and some smaller adjustments.
resolve #378
require Icinga/ipl-web/pull/342