-
Notifications
You must be signed in to change notification settings - Fork 3
Modernize code #63
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 code #63
Conversation
52f1357 to
415ad2b
Compare
4bc935f to
422c34e
Compare
BastianLedererIcinga
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.
The return type of BaseFilter::setBaseFilter can be changed to static.
01fc4fa to
2030a2d
Compare
src/Filter.php
Outdated
| * @return Condition | ||
| */ | ||
| public static function equal($column, $value) | ||
| public static function equal(string $column, array|bool|float|int|string|DateTime|null $value): Condition |
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.
Please remove the param types for $value. The phpDoc is fine.
Please remove this from other methods where DateTime can be specified as a parameter.
src/Filter.php
Outdated
| if (! $rule instanceof Equal && ! $rule instanceof Unequal) { | ||
| throw new InvalidArgumentException(sprintf( | ||
| 'Rule must be of type %s or %s, got %s instead', | ||
| Equal::class, | ||
| Unequal::class, | ||
| get_php_type($rule) | ||
| )); | ||
| } |
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 can be removed now.
src/Filter.php
Outdated
| if (! $rule instanceof Like && ! $rule instanceof Unlike) { | ||
| throw new InvalidArgumentException(sprintf( | ||
| 'Rule must be of type %s or %s, got %s instead', | ||
| Like::class, | ||
| Unlike::class, | ||
| get_php_type($rule) | ||
| )); | ||
| } |
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 superfluous and can be removed now.
src/Filter.php
Outdated
| switch (true) { | ||
| case $rule instanceof All: | ||
| return $this->matchAll($rule, $row); |
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.
You can use match() instead of switch() and then remove the default case.
5c7ad36 to
0e8fbc5
Compare
6408fa8 to
d67ed2a
Compare
d67ed2a to
dd095bd
Compare
The base branch was changed.
|
Please rebase. |
properties, parameters and returntypes
extended in ipl/Sql/Filter/...
In, NotIn, Exists, NotExists
implemented in ipl/Sql/Filter/...
In, NotIn, Exists, NotExists
prevent the error:
Typed property
Icinga\Module\Icingadb\Widget\Detail\ObjectStatistics::$baseFilter
must not be accessed before initialization
e.g. ipl\Html\FormElement::addElementLoader() allows to call the method with null
Depends on removing the ipl\Sql\Filter\InAndNotInUtils trait
removing parameter uniontypes & unnecessary typechecking, change switch to match
0e8fbc5 to
20d500b
Compare
No description provided.