Skip to content

Commit 5c79f1d

Browse files
authored
Merge branch 'WordPress:trunk' into trunk
2 parents 710cf76 + fb532ba commit 5c79f1d

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

src/wp-includes/formatting.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2848,6 +2848,14 @@ function untrailingslashit( $value ) {
28482848
*
28492849
* @param mixed $value The value to be stripped.
28502850
* @return mixed Stripped value.
2851+
*
2852+
* @phpstan-template T
2853+
* @phpstan-param T $value
2854+
* @phpstan-return (
2855+
* T is string ? string : (
2856+
* T is array ? array<key-of<T>, ( value-of<T> is string ? string : value-of<T> )> : T
2857+
* )
2858+
* )
28512859
*/
28522860
function stripslashes_deep( $value ) {
28532861
return map_deep( $value, 'stripslashes_from_strings_only' );
@@ -2860,6 +2868,10 @@ function stripslashes_deep( $value ) {
28602868
*
28612869
* @param mixed $value The array or string to be stripped.
28622870
* @return mixed The stripped value.
2871+
*
2872+
* @phpstan-template T
2873+
* @phpstan-param T $value
2874+
* @phpstan-return (T is string ? string : T)
28632875
*/
28642876
function stripslashes_from_strings_only( $value ) {
28652877
return is_string( $value ) ? stripslashes( $value ) : $value;
@@ -5170,6 +5182,10 @@ function sanitize_option( $option, $value ) {
51705182
* @param mixed $value The array, object, or scalar.
51715183
* @param callable $callback The function to map onto $value.
51725184
* @return mixed The value with the callback applied to all non-arrays and non-objects inside it.
5185+
*
5186+
* @phpstan-template T
5187+
* @phpstan-param T $value
5188+
* @phpstan-return (T is array ? array<key-of<T>, mixed> : (T is object ? T : mixed))
51735189
*/
51745190
function map_deep( $value, $callback ) {
51755191
if ( is_array( $value ) ) {
@@ -5811,6 +5827,14 @@ function sanitize_trackback_urls( $to_ping ) {
58115827
*
58125828
* @param string|array $value String or array of data to slash.
58135829
* @return string|array Slashed `$value`, in the same type as supplied.
5830+
*
5831+
* @phpstan-template T
5832+
* @phpstan-param T $value
5833+
* @phpstan-return (
5834+
* T is string ? string : (
5835+
* T is array ? array<key-of<T>, ( value-of<T> is string ? string : value-of<T> )> : T
5836+
* )
5837+
* )
58145838
*/
58155839
function wp_slash( $value ) {
58165840
if ( is_array( $value ) ) {
@@ -5834,6 +5858,14 @@ function wp_slash( $value ) {
58345858
*
58355859
* @param string|array $value String or array of data to unslash.
58365860
* @return string|array Unslashed `$value`, in the same type as supplied.
5861+
*
5862+
* @phpstan-template T
5863+
* @phpstan-param T $value
5864+
* @phpstan-return (
5865+
* T is string ? string : (
5866+
* T is array ? array<key-of<T>, ( value-of<T> is string ? string : value-of<T> )> : T
5867+
* )
5868+
* )
58375869
*/
58385870
function wp_unslash( $value ) {
58395871
return stripslashes_deep( $value );

src/wp-includes/functions.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,10 @@ function wp_removable_query_args() {
12891289
*
12901290
* @param array $input_array Array to walk while sanitizing contents.
12911291
* @return array Sanitized $input_array.
1292+
*
1293+
* @phpstan-template T of array
1294+
* @phpstan-param T $input_array
1295+
* @phpstan-return array<key-of<T>, ( value-of<T> is string ? string : value-of<T> )>
12921296
*/
12931297
function add_magic_quotes( $input_array ) {
12941298
foreach ( (array) $input_array as $k => $v ) {

0 commit comments

Comments
 (0)