Skip to content

Fix linter warnings: add strict_types and replace isset with explicit checks#14

Merged
egorsmkv merged 2 commits intomainfrom
copilot/fix-code-warnings
Feb 18, 2026
Merged

Fix linter warnings: add strict_types and replace isset with explicit checks#14
egorsmkv merged 2 commits intomainfrom
copilot/fix-code-warnings

Conversation

Copy link
Contributor

Copilot AI commented Feb 18, 2026

Mago linter flagged missing declare(strict_types=1); directives and ambiguous isset() usage that conflates existence checks with null checks.

Changes

  • Added declare(strict_types=1); to all PHP files (test.php, packages/default/notifier/index.php, packages/default/notifier/test.php)
  • Replaced isset() with explicit array_key_exists() + null comparison in argument validation

Before:

if (!isset($args[$arg])) {
    return wrap(['error' => sprintf('Please supply %s argument.', $arg)]);
}

After:

if (!array_key_exists($arg, $args) || $args[$arg] === null) {
    return wrap(['error' => sprintf('Please supply %s argument.', $arg)]);
}

This separates the two concerns: key existence and null value checking. PHP's short-circuit OR evaluation prevents accessing non-existent keys.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/carthage-software/mago/releases
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/qCe2zj /usr/bin/composer mago:install-binary (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/qemt2m /usr/bin/composer mago:install-binary 63afe740e99a13ba87ec199bb07bbdee937a5b62 /bin/sh it s.git/ efault/notifier/--hard /bin/sh -c git-upload-pack '/home/REDACTED/.cREDACTED d1652f673303492272778051 e/git-upload-pack get (http block)
  • https://api.github.com/repos/carthage-software/mago/zipball/b50e6aa3e4e6abe144101720deddbf456cb7e0a1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/guzzle/psr7/zipball/21dc724a0583619cd1652f673303492272778051
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/http-client-contracts/zipball/75d7043853a42837e68111812f4d964b01e5101c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/http-client/zipball/333b9bd7639cbdaecd25a3a48a9d2dcfaa86e019
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/mime/zipball/e0a0f859148daf1edf6c60b398eb40bfc96697d1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/notifier/zipball/33e91495d9674b6ba5e2a1de810902ba976156f5
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/service-contracts/zipball/f021b05a130d35510bd6b25fe9053c2a8a15d5d4
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/symfony/telegram-notifier/zipball/71f709c0a1543581e8e7c28ca80cb7c40ed84651
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/SnZKCc /usr/bin/composer install --no-interaction --prefer-dist (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix warnings in the code</issue_title>
<issue_description>```
warning[strict-types]: Missing declare(strict_types=1); statement at the beginning of the file.
┌─ test.php:1:1

1 │ <?php
│ ^^^^^

= The `strict_types` directive enforces strict type checking, which can prevent subtle bugs.
= Help: Add `declare(strict_types=1);` at the top of your file.

warning[strict-types]: Missing declare(strict_types=1); statement at the beginning of the file.
┌─ index.php:1:1

1 │ <?php
│ ^^^^^

= The strict_types directive enforces strict type checking, which can prevent subtle bugs.
= Help: Add declare(strict_types=1); at the top of your file.

warning[no-isset]: Use of the isset construct.
┌─ index.php:45:14

45 │ if (!isset($args[$arg])) {
│ ^^^^^^^^^^^^^^^^^^ Ambiguous check due to isset() conflating existence and null comparison

= isset() returns false for both unset variables and null values.
= It is unclear whether you're checking for variable existence or non-null value.
= Help: Use explicit null comparison (!== null) or the null coalescing operator (??).

warning[strict-types]: Missing declare(strict_types=1); statement at the beginning of the file.
┌─ ../../../test.php:1:1

1 │ <?php
│ ^^^^^

= The strict_types directive enforces strict type checking, which can prevent subtle bugs.
= Help: Add declare(strict_types=1); at the top of your file.

warning: found 4 issues: 4 warning(s)
= 3 issues contain auto-fix suggestions


## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ecks

Co-authored-by: egorsmkv <7875085+egorsmkv@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix warnings related to strict types and isset Fix linter warnings: add strict_types and replace isset with explicit checks Feb 18, 2026
Copilot AI requested a review from egorsmkv February 18, 2026 09:36
@egorsmkv egorsmkv marked this pull request as ready for review February 18, 2026 09:39
@egorsmkv egorsmkv merged commit edeeb2a into main Feb 18, 2026
1 check passed
@egorsmkv egorsmkv deleted the copilot/fix-code-warnings branch February 18, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix warnings in the code

2 participants