Skip to content

fix: replace non-canonical (integer) cast deprecated in PHP 8.5#53

Open
wombatbuddy wants to merge 1 commit into
S1lentium:masterfrom
wombatbuddy:fix/php85-type-casts
Open

fix: replace non-canonical (integer) cast deprecated in PHP 8.5#53
wombatbuddy wants to merge 1 commit into
S1lentium:masterfrom
wombatbuddy:fix/php85-type-casts

Conversation

@wombatbuddy

Copy link
Copy Markdown

PHP 8.5+ deprecates non-canonical type cast aliases (integer), (boolean), (double) and (binary). Using these aliases produces a deprecation notice on PHP 8.5+ which will become a fatal error in a future PHP version.

Steps to reproduce

  1. Run tests on PHP 8.5:
    vendor/bin/phpunit --display-deprecations

  2. You will see:
    Non-canonical cast (integer) is deprecated, use the (int) cast instead

    • src/Network.php:377
    • src/Range.php:240

Solution

Replace with canonical alias:
(integer) → (int)

References

  1. https://php.watch/versions/8.5/boolean-double-integer-binary-casts-deprecated
  2. https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_non-standard_cast_names

Note on maintainability

Meanwhile, a compatible fork is available at: https://packagist.org/packages/wombatbuddy/iptools

@wombatbuddy wombatbuddy changed the title fix: replace non-canonical (integer) cast deprecated in PHP 8.5 in Ne… fix: replace non-canonical (integer) cast deprecated in PHP 8.5 Jun 29, 2026
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.

1 participant