Make WordPress Core

#62735 closed defect (bug) (fixed)

Change documented type of get_network_option, update_network_option and delete_network_option's $network_id parameter to int|null

Reported by: maikelraow Owned by: audrasjb
Priority: normal Milestone: 6.8
Component: Options, Meta APIs Version:
Severity: minor Keywords: has-patch
Cc: Focuses: docs

Description

get_network_option, update_network_option and delete_network_option all have a $network_id as first parameter.

@param int $network_id ID of the network. Can be null to default to the current network ID.

It's @param type is set to INT yet it also explicitly says that NULL can be passed to use the current network ID. If passing NULL is valid then should the type not be INT|NULL?

Change History (5)

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


21 months ago
#1

  • Keywords has-patch added

This PR updates the documented type of the $network_id parameter in get_network_option, update_network_option, and delete_network_option methods to int|null, reflecting that NULL can be passed to default to the current network ID.

@im3dabasia1 commented on PR #8038:


21 months ago
#2

I also confirmed that int|null has been used in other functions, such as get_blog_count, which internally calls get_network_option: https://github.com/WordPress/wordpress-develop/blob/dc9b16ba4224259bd3ae2153f81686ed902391f2/src/wp-includes/ms-functions.php#L103-L117

#3 @audrasjb
21 months ago

  • Focuses php-compatibility removed
  • Milestone Awaiting Review6.8
  • Owner set to audrasjb
  • Status newreviewing
  • Type enhancementdefect (bug)
  • Version trunk

Hello and welcome to WordPress Core Trac @maikelraow,

Thanks for reporting this. Moving to milestone 6.8.

@audrasjb commented on PR #8038:


18 months ago
#4

I approved this PR but I also spotted some other places that I'll fix directly when committing this changeset :)

#5 @audrasjb
18 months ago

  • Resolutionfixed
  • Status reviewingclosed

In 59940:

Docs: Update $network_id parameter type to int|null in Network Option methods.

Props maikelraow, im3dabasia1, audrasjb, mukesh27.
Fixes #62735.
See #62281.

Note: See TracTickets for help on using tickets.