refactor: safe PHP 7.4 modernization - #88
Conversation
There was a problem hiding this comment.
Pull request overview
This PR modernizes the servcheck plugin’s PHP code for PHP 7.4 by enabling strict typing and refactoring legacy array() usage to short array syntax, and it adds a unit test covering static array definitions / notify account label building.
Changes:
- Add
declare(strict_types=1);across plugin entrypoints and includes. - Replace many
array(...)constructs with[...](and related small syntax modernizations). - Add a unit test validating key lookup arrays and notify account label-building behavior.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/ArraysDefinitionTest.php | Adds unit coverage for static arrays and notify account label building logic. |
| setup.php | Adds strict types and modernizes prepared statement argument arrays. |
| servcheck_test.php | Adds strict types and modernizes multiple prepared statement argument arrays and filter config arrays. |
| servcheck_proxies.php | Adds strict types and modernizes local arrays / prepared statement argument arrays. |
| servcheck_process.php | Adds strict types and modernizes prepared statement argument arrays / local arrays. |
| servcheck_curl_code.php | Adds strict types. |
| servcheck_ca.php | Adds strict types and modernizes local arrays / prepared statement argument arrays. |
| poller_servcheck.php | Adds strict types and modernizes prepared statement argument arrays. |
| locales/po/index.php | Adds strict types. |
| locales/LC_MESSAGES/index.php | Adds strict types. |
| locales/index.php | Adds strict types. |
| index.php | Adds strict types. |
| includes/tests.php | Adds strict types and refactors arrays; currently introduces fatal syntax errors in cURL option application. |
| includes/mxlookup.php | Adds strict types and modernizes array initializations. |
| includes/index.php | Adds strict types. |
| includes/functions.php | Adds strict types; currently introduces a fatal syntax error in membership check logic. |
| includes/constants.php | Adds strict types. |
| includes/arrays.php | Adds strict types and modernizes key static arrays / notify accounts initialization and some field definitions. |
| .omc/sessions/07529e04-df5c-47a5-9f2b-aa71b09610a4.json | Adds a tool/session artifact file that likely shouldn’t be committed. |
| .omc/sessions/01068f21-52fc-4525-83a9-8d76d48b18d4.json | Adds a tool/session artifact file that likely shouldn’t be committed. |
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>
|
Copilot's 6 comments were against d09799b; the corrupted |
This PR adds strict typing, short array syntax, and null coalescing operators across the plugin. Standalone infrastructure files were removed per architectural mandate.