File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 232
232
'wp_nonce_field ' => [null , 'action ' => '-1|string ' ],
233
233
'did_action ' => ['int<0, max> ' ],
234
234
'get_current_blog_id ' => ['int<0, max> ' ],
235
+ 'wp_extract_urls ' => ['($content is empty ? array{} : list<string>) ' ],
235
236
];
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ public function dataFileAsserts(): iterable
57
57
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/wp_die.php ' );
58
58
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/wp_dropdown_languages.php ' );
59
59
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/wp_error_parameter.php ' );
60
+ yield from $ this ->gatherAssertTypes (__DIR__ . '/data/wp_extract_urls.php ' );
60
61
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/wp_generate_tag_cloud.php ' );
61
62
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/wp_get_archives.php ' );
62
63
yield from $ this ->gatherAssertTypes (__DIR__ . '/data/wp_get_post_categories.php ' );
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace PhpStubs \WordPress \Core \Tests ;
6
+
7
+ use function wp_extract_urls ;
8
+ use function PHPStan \Testing \assertType ;
9
+
10
+ assertType ('array{} ' , wp_extract_urls ('' ));
11
+
12
+ assertType ('list<string> ' , wp_extract_urls ('content with no URLs ' ));
13
+ assertType ('list<string> ' , wp_extract_urls ('content with one URL: https://example.com ' ));
14
+ assertType ('list<string> ' , wp_extract_urls ('content with multiple URLs: https://example.com and http://another-example.com ' ));
15
+
16
+ assertType ('list<string> ' , wp_extract_urls (Faker::string ()));
Original file line number Diff line number Diff line change @@ -111116,6 +111116,7 @@ function xmlrpc_removepostdata($content)
111116
111116
*
111117
111117
* @param string $content Content to extract URLs from.
111118
111118
* @return string[] Array of URLs found in passed string.
111119
+ * @phpstan-return ($content is empty ? array{} : list<string>)
111119
111120
*/
111120
111121
function wp_extract_urls($content)
111121
111122
{
You can’t perform that action at this time.
0 commit comments