refactor: safe PHP 7.4 modernization - #43
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the HMIB plugin’s PHP code by enabling strict typing and updating legacy array syntax to PHP 7.4-friendly constructs across core entrypoints, pollers, SNMP helpers, and locale/template index stubs.
Changes:
- Added
declare(strict_types=1);to multiple PHP entrypoints/files. - Replaced
array(...)with short array syntax[...]in various functions (DB calls, config arrays, helpers). - Introduced two
.omc/sessions/*.jsonfiles into the repo.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/index.php | Adds strict types declaration. |
| snmp.php | Adds strict types; converts arrays; introduces invalid is_[...] syntax (parse errors). |
| snmp_functions.php | Adds strict types declaration. |
| setup.php | Adds strict types; converts arrays to short syntax. |
| poller_hmib.php | Converts prepared-statement parameter arrays to short syntax. |
| poller_graphs.php | Converts prepared-statement parameter arrays and local arrays to short syntax. |
| locales/LC_MESSAGES/index.php | Adds strict types declaration. |
| locales/index.php | Adds strict types declaration. |
| index.php | Adds strict types declaration. |
| hmib.php | Converts many filter/config arrays to short syntax. |
| hmib_types.php | Adds strict types; converts arrays; introduces invalid is_[...] / in_[...] syntax (parse errors). |
| .omc/sessions/df36c0d4-5118-49a8-b66b-5f851e645aa8.json | New tooling/session artifact committed (should not be in source). |
| .omc/sessions/c0ab85d1-d888-4fad-b941-516cdad3f729.json | New tooling/session artifact committed (should not be in source). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Converted to draft to serialize the stack in this repo. Blocked by #40; will un-draft after that merges to avoid cross-PR merge conflicts. |
Revert bulk array()->[] rewrite damage affecting: - is_array, in_array, xml2array - call_user_func_array, filter_var_array - Function declarations with _array suffix Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
…ction declarations Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
26db242 to
cde19ce
Compare
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
Verified all 8 Copilot findings against the current diff: the Cherry-picked the CI workflow from #40 (11ffc52, 9e4dbb6) so this branch gets integration test coverage instead of Branch is not behind develop (0 commits). |
This PR adds strict typing, short array syntax, and null coalescing operators across the plugin. Standalone infrastructure files were removed per architectural mandate.