Make WordPress Core

Opened 2 months ago

Last modified 7 weeks ago

#64913 new defect (bug)

Code Quality: Replace is_integer() with is_int() for consistency

Reported by: soean's profile Soean Owned by:
Milestone: 7.1 Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: coding-standards Cc:

Description

is_integer() is an alias for is_int(). While they function identically, the WordPress Coding Standards and modern PHP practices generally lean towards using the official function name rather than its alias to maintain consistency across the codebase.

There is also a proposal to deprecate is_integer() in PHP 8.6, see RFC

I am proposing to replace all occurrences of is_integer() with is_int() throughout the WordPress Core. This is a non-breaking change as the functionality remains exactly the same.

Change History (5)

This ticket was mentioned in PR #11319 on WordPress/wordpress-develop by @Soean.


2 months ago
#1

  • Keywords has-patch added

is_integer() is an alias for is_int(). While they function identically, the WordPress Coding Standards and modern PHP practices generally lean towards using the official function name rather than its alias to maintain consistency across the codebase.

There is also a proposal to deprecate is_integer() in PHP 8.6, see RFC

I am proposing to replace all occurrences of is_integer() with is_int() throughout the WordPress Core. This is a non-breaking change as the functionality remains exactly the same.

Trac ticket: https://core.trac.wordpress.org/ticket/64913

#2 follow-up: @Soean
2 months ago

Maybe we should include:

is_double() => is_float()
is_long() => is_int()

#3 in reply to: ↑ 2 @westonruter
8 weeks ago

  • Milestone changed from Awaiting Review to 7.1

Replying to Soean:

Maybe we should include:

is_double() => is_float()
is_long() => is_int()

Makes sense to me.

#4 @SergeyBiryukov
7 weeks ago

In 62175:

Code Quality: Replace is_integer() with is_int() for consistency.

is_integer() is an alias for is_int(). While they function identically, the WordPress Coding Standards and modern PHP practices generally lean towards using the official function name rather than its alias to maintain consistency across the codebase.

Props Soean, westonruter, SergeyBiryukov.
See #64913.

@SergeyBiryukov commented on PR #11319:


7 weeks ago
#5

Thanks for the PR! Merged in r62175.

Note: See TracTickets for help on using tickets.