Conversation
bdf6581 to
db4e52f
Compare
03fb727 to
4d6f364
Compare
Contributor
Author
|
The last two force pushes fixed the failed jobs. |
5 tasks
- Use `use` statements to import classes instead of using namespaced references. - Drop unnecessary global prefixes for built-in function calls. (for example `\strlen`, `\sprintf` -> ´strlen`, `sprintf`)
Use match espressions where possible.
Replace old function patterns by more modern functions. - `strpos(...) !== false` with `str_contains(...)` - `substr(..., 0, N) === '...'` and `/^.../` regex checks with `str_starts_with(...)` - `substr(..., -N) === '...'` and `/...$/` regex checks with `str_ends_with(...)`
Refactor a few simple `function (...) { return ...; }` closures over to
`fn (...) => ...` where the callback is a single expression.
Modernize IcingaCliRunner::command() by switching from func_get_args() to a variadic signature. Preserves backwards compatibility with callers that pass a single array: if the method receives exactly one argument and it’s an array, it unwraps it.
Replace passing raw arrays into `addAttributes()` with `Attributes::create([...])`.
Remove obsolete PHP < 8.1 compatibility code - Remove stored closure workaround for normalizeBatchResult, decodeResponse, and requireValueProperty - Remove related comments referencing future PHP 8.1 changes
Add PHPDoc `@deprecated` annotations so IDEs and static analysis tools recognize them as deprecated.
- Drop a bunch of temporary variables that were only used once, replacing them with direct expressions. - Replace small loops used only for editing each entry of an array with `array_map()`. - Remove unused variables: - `$e`/`$_` Exception variables. - `foreach` keys. - Other
Remove trailing commas from multi-line arrays for consistency.
Rewrite many `$db->select()->from()->join()->where();` calls to a consistent “one method per line” style. Split longer `from()`/`join()`/`where()` argument lists across lines and align indentation so chained queries are easier to scan and edit.
This commit does **not** format all array to the same format. It formats all keys of each array in the same way so they are uniform in themselves. - If array keys are aligned partly now the full array is aligned. - Remove trailing spaces in inline arrays `[ 'a', 'b' ]` -> `['a', 'b']`.
- Use arrow functions for simple renderers and keep full closures only when multi step logic is needed. - Consistent method chaining layout. - Add empty lines between column objects.
Mixed commit that reformats code for readability. - Reflow a few multi-line calls into a clearer style. - Add spaces after `!` and type casts. - Override `protected $method` instead of setting it in the constructor. - Add empty lines.
Comment out... - code below a return statement, - code inside of an `if (false)` block, - variable assignments directly before the variable is overwritten, - empty `if` block ...to improve readability by reducing noise.
Sort imports alphabetically and remove unused imports.
The DB readiness check was incorrect due to operator precedence. The logical NOT operator (`!`) was applied before the strict comparison (`===`), causing the component state to be negated and then compared to `STATE_READY`. This resulted in the condition never evaluating as intended. Replace the negated comparison with an explicit `!== STATE_READY` check to correctly detect when the DB component is not ready.
`updateDb()` returns either an **integer** or **true**, but never **false**. Because the check works with a strict comparison, this means it will never be **false**. Thus the strict `!== false` comparison is replaced by a truthy check to correctly handle integer return values and failures.
For the methods `Form::onSuccess()` and `HtmlDocument::assemble()`.
This reverts commit e77d6eead174169719298ba2c2123c7f07c8516e. This fix caused the daemon to freeze.
Remove all types from `isValidEvent()` the forward compatibility change is moved to a different PR This commit will be squashed into the original commit later.
db98d77 to
af27ffd
Compare
|
I moved return type additions for ipl forward compatibilty to a different PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a broad modernization and cleanup sweep across the whole codebase. The goal is to move the project toward more idiomatic modern PHP, improve type safety, reduce deprecated usages, and improve readability.
Because the vast amount of changes PR explicitly makes no claim to completeness. It is a best effort refactor pass: there may still be remaining places that could benefit from the same transformations. So this should be treated as first big step in an incremental modernization rather than a finished “cleanup of everything”.
Typing and signatures
static/self, consistent return types).@deprecatedtags.?Typeshorthand for nullable PHPDoc annotations.Modern PHP language features
Replace older constructs with modern equivalents where appropriate:
match, nullsafe?->, null coalescing??/??=, ternary, arrow functionsfn() =>, first-class callables.str_starts_with,str_ends_with,str_contains) instead ofsubstr/strpos/regexfor simple checks.func_get_args().Consistency / formatting / readability
Internal structure improvements
,MonitoringStateTrigger,CheckPluginState, andResultStatus`).