[wp-trac] [WordPress Trac] #59630: wp_json_encode(): rename parameters for parity with PHP Core

WordPress Trac noreply at wordpress.org
Mon Oct 16 03:55:38 UTC 2023


#59630: wp_json_encode(): rename parameters for parity with PHP Core
------------------------------+--------------------
 Reporter:  jrf               |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  6.5
Component:  General           |    Version:  trunk
 Severity:  normal            |   Keywords:
  Focuses:  coding-standards  |
------------------------------+--------------------
 The `wp_json_encode()` is a wrapper for the PHP native `json_encode()`
 function with some extra safety checks.

 I propose to rename the `$data` parameter in the `wp_json_encode()`
 function and associated functions to `$value` and the `$options` parameter
 to `$flags` for parity with the parameter names used in PHP Core
 (principle of least surprise).

 Ref: https://www.php.net/manual/en/function.json-encode.php

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59630>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list