@@ -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 */
28522860function 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 */
28642876function 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 */
51745190function 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 */
58155839function 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 */
58385870function wp_unslash ( $ value ) {
58395871 return stripslashes_deep ( $ value );
0 commit comments