Make WordPress Core

Changeset 65086


Ignore:
Timestamp:
10/30/2026 08:21:22 PM (45 hours ago)
Author:
lancewillett
Message:

Tests: Add types to text formatting tests and providers.

Add parameter and return types and document provider array shapes in the wptexturize() and wp_html_split() tests and their shared whole-post fixture. Remove returns of void assertion results while preserving the existing cases and expected values.

Developed in: ​https://github.com/WordPress/wordpress-develop/pull/14898

Props nickchomey.
See #63997.

Location:
trunk/tests/phpunit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/data/formatting/whole-posts.php

    r60627 r65086  
    11<?php
    22
    3 function data_whole_posts() {
     3/**
     4 * @return non-empty-list<array{ non-falsy-string }>
     5 */
     6function data_whole_posts(): array {
    47        return array(
    58
  • trunk/tests/phpunit/tests/formatting/wpHtmlSplit.php

    r64439 r65086  
    1212         *
    1313         * @dataProvider data_basic_features
     14         *
     15         * @param non-falsy-string       $input
     16         * @param list<non-falsy-string> $output
    1417         */
    15         public function test_basic_features( $input, $output ) {
    16                 return $this->assertSame( $output, wp_html_split( $input ) );
     18        public function test_basic_features( string $input, array $output ): void {
     19                $this->assertSame( $output, wp_html_split( $input ) );
    1720        }
    1821
    19         public static function data_basic_features() {
     22        /**
     23         * Data provider for {@see self::test_basic_features()}.
     24         *
     25         * @return list<array{ 0: non-falsy-string, 1: list<non-falsy-string> }>
     26         */
     27        public static function data_basic_features(): array {
    2028                return array(
    2129                        array(
    … …  
    4452         *
    4553         * @covers ::get_html_split_regex
     54         *
     55         * @param non-falsy-string $input
    4656         */
    47         public function test_pcre_performance( $input ) {
     57        public function test_pcre_performance( string $input ): void {
    4858                $regex  = get_html_split_regex();
    4959                $result = benchmark_pcre_backtracking( $regex, $input, 'split' );
    50                 return $this->assertLessThan( 200, $result );
     60                $this->assertLessThan( 200, $result );
    5161        }
    5262
    53         public static function data_whole_posts() {
     63        /**
     64         * Data provider for {@see self::test_pcre_performance()}.
     65         *
     66         * @return non-empty-list<array{ non-falsy-string }>
     67         */
     68        public static function data_whole_posts(): array {
    5469                require_once DIR_TESTDATA . '/formatting/whole-posts.php';
    5570                return data_whole_posts();
  • trunk/tests/phpunit/tests/formatting/wpTexturize.php

    r64439 r65086  
    88class Tests_Formatting_wpTexturize extends WP_UnitTestCase {
    99
    10         public function test_dashes() {
     10        /**
     11         * Tests smart dash conversion.
     12         */
     13        public function test_dashes(): void {
    1114                $this->assertSame( 'Hey &#8212; boo?', wptexturize( 'Hey -- boo?' ) );
    1215                $this->assertSame( '<a href="http://xx--xx">Hey &#8212; boo?</a>', wptexturize( '<a href="http://xx--xx">Hey -- boo?</a>' ) );
    1316        }
    1417
    15         public function test_disable() {
     18        /**
     19         * Tests texturization is disabled inside certain HTML elements.
     20         */
     21        public function test_disable(): void {
    1622                $this->assertSame( '<pre>---&</pre>', wptexturize( '<pre>---&</pre>' ) );
    1723                $this->assertSame( '<pre><code></code>--&</pre>', wptexturize( '<pre><code></code>--&</pre>' ) );
    … …  
    3642
    3743        /**
     44         * Tests bracketed quote conversion.
     45         *
    3846         * @ticket 1418
    3947         */
    40         public function test_bracketed_quotes_1418() {
     48        public function test_bracketed_quotes_1418(): void {
    4149                $this->assertSame( '(&#8220;test&#8221;)', wptexturize( '("test")' ) );
    4250                $this->assertSame( '(&#8216;test&#8217;)', wptexturize( "('test')" ) );
    … …  
    4553
    4654        /**
     55         * Tests bracketed quote conversion with a specific example.
     56         *
    4757         * @ticket 3810
    4858         */
    49         public function test_bracketed_quotes_3810() {
     59        public function test_bracketed_quotes_3810(): void {
    5060                $this->assertSame( 'A dog (&#8220;Hubertus&#8221;) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) );
    5161        }
    5262
    5363        /**
     64         * Tests basic quote conversion (apostrophes, single quotes, double quotes).
     65         *
    5466         * @ticket 4539
    5567         */
    56         public function test_basic_quotes() {
     68        public function test_basic_quotes(): void {
    5769                $this->assertSame( 'test&#8217;s', wptexturize( 'test\'s' ) );
    5870
    … …  
    7486
    7587        /**
     88         * Tests full sentences with unmatched single quotes.
     89         *
    7690         * @ticket 4539
    7791         * @ticket 15241
    7892         */
    79         public function test_full_sentences_with_unmatched_single_quotes() {
     93        public function test_full_sentences_with_unmatched_single_quotes(): void {
    8094                $this->assertSame(
    8195                        'That means every moment you&#8217;re working on something without it being in the public it&#8217;s actually dying.',
    … …  
    8599
    86100        /**
     101         * Tests quote conversion with various surrounding contexts.
     102         *
    87103         * @ticket 4539
    88104         */
    89         public function test_quotes() {
     105        public function test_quotes(): void {
    90106                $this->assertSame( '&#8220;Quoted String&#8221;', wptexturize( '"Quoted String"' ) );
    91107                // $this->assertSame( 'Here is &#8220;<a href="http://example.com">a test with a link</a>&#8221;', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>"' ) );
    … …  
    104120
    105121        /**
     122         * Tests quotes before an "s" (possessives and contractions).
     123         *
    106124         * @ticket 4539
    107125         */
    108         public function test_quotes_before_s() {
     126        public function test_quotes_before_s(): void {
    109127                $this->assertSame( 'test&#8217;s', wptexturize( "test's" ) );
    110128                $this->assertSame( '&#8216;test&#8217;s', wptexturize( "'test's" ) );
    … …  
    115133
    116134        /**
     135         * Tests quotes before numbers (year abbreviations, etc.).
     136         *
    117137         * @ticket 4539
    118138         */
    119         public function test_quotes_before_numbers() {
     139        public function test_quotes_before_numbers(): void {
    120140                $this->assertSame( 'Class of &#8217;99', wptexturize( "Class of '99" ) );
    121141                $this->assertSame( 'Class of &#8217;99&#8217;s', wptexturize( "Class of '99's" ) );
    … …  
    144164        }
    145165
    146         public function test_quotes_after_numbers() {
     166        /**
     167         * Tests quotes after numbers.
     168         */
     169        public function test_quotes_after_numbers(): void {
    147170                $this->assertSame( 'Class of &#8217;99', wptexturize( "Class of '99" ) );
    148171        }
    149172
    150173        /**
     174         * Tests quotes next to HTML tags.
     175         *
    151176         * @ticket 4539
    152177         * @ticket 15241
    153178         */
    154         public function test_other_html() {
     179        public function test_other_html(): void {
    155180                $this->assertSame( '&#8216;<strong>', wptexturize( "'<strong>" ) );
    156181                // $this->assertSame( '&#8216;<strong>Quoted Text</strong>&#8217;,', wptexturize( "'<strong>Quoted Text</strong>'," ) );
    … …  
    158183        }
    159184
    160         public function test_x() {
     185        /**
     186         * Tests multiplication sign (x between digits) conversion.
     187         */
     188        public function test_x(): void {
    161189                $this->assertSame( '14&#215;24', wptexturize( '14x24' ) );
    162190        }
    163191
    164         public function test_minutes_seconds() {
     192        /**
     193         * Tests prime (minutes/feet) and double-prime (seconds/inches) conversion.
     194         */
     195        public function test_minutes_seconds(): void {
    165196                $this->assertSame( '9&#8242;', wptexturize( '9\'' ) );
    166197                $this->assertSame( '9&#8243;', wptexturize( '9"' ) );
    … …  
    174205
    175206        /**
     207         * Tests quotes around numbers.
     208         *
    176209         * @ticket 8775
    177210         */
    178         public function test_wptexturize_quotes_around_numbers() {
     211        public function test_wptexturize_quotes_around_numbers(): void {
    179212                $this->assertSame( '&#8220;12345&#8221;', wptexturize( '"12345"' ) );
    180213                $this->assertSame( '&#8216;12345&#8217;', wptexturize( '\'12345\'' ) );
    … …  
    184217
    185218        /**
     219         * Tests HTML comments are not texturized.
     220         *
    186221         * @ticket 8912
    187222         */
    188         public function test_wptexturize_html_comments() {
     223        public function test_wptexturize_html_comments(): void {
    189224                $this->assertSame( '<!--[if !IE]>--><!--<![endif]-->', wptexturize( '<!--[if !IE]>--><!--<![endif]-->' ) );
    190225                $this->assertSame( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->', wptexturize( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->' ) );
    … …  
    193228
    194229        /**
     230         * Tests quote cuddling with HTML entities.
     231         *
    195232         * @ticket 4539
    196233         * @ticket 15241
    197234         */
    198         public function test_entity_quote_cuddling() {
     235        public function test_entity_quote_cuddling(): void {
    199236                $this->assertSame( '&nbsp;&#8220;Testing&#8221;', wptexturize( '&nbsp;"Testing"' ) );
    200237                // $this->assertSame( '&#38;&#8220;Testing&#8221;', wptexturize( '&#38;"Testing"' ) );
    … …  
    202239
    203240        /**
     241         * Tests apostrophes before primes in version numbers.
     242         *
    204243         * @ticket 22823
    205244         */
    206         public function test_apostrophes_before_primes() {
     245        public function test_apostrophes_before_primes(): void {
    207246                $this->assertSame( 'WordPress 3.5&#8217;s release date', wptexturize( "WordPress 3.5's release date" ) );
    208247        }
    209248
    210249        /**
     250         * Tests spaces around hyphens and dashes.
     251         *
    211252         * @ticket 23185
    212253         */
    213         public function test_spaces_around_hyphens() {
     254        public function test_spaces_around_hyphens(): void {
    214255                $nbsp = "\xC2\xA0";
    215256
    … …  
    232273
    233274        /**
     275         * Tests hyphens and dashes at the start or end of strings.
     276         *
    234277         * @ticket 31030
    235278         */
    236         public function test_hyphens_at_start_and_end() {
     279        public function test_hyphens_at_start_and_end(): void {
    237280                $this->assertSame( '&#8211; ', wptexturize( '- ' ) );
    238281                $this->assertSame( '&#8211; &#8211;', wptexturize( '- -' ) );
    … …  
    251294         * @ticket 22692
    252295         */
    253         public function test_spaces_around_quotes_never() {
     296        public function test_spaces_around_quotes_never(): void {
    254297                $nbsp = "\xC2\xA0";
    255298
    … …  
    268311         * @dataProvider data_spaces_around_quotes
    269312         */
    270         public function test_spaces_around_quotes( $input, $output ) {
     313        public function test_spaces_around_quotes( string $input, string $output ): void {
    271314                $this->assertSame( $output, wptexturize( $input ) );
    272315        }
    273316
    274         public static function data_spaces_around_quotes() {
     317        /**
     318         * Data provider for {@see self::test_spaces_around_quotes()}.
     319         *
     320         * @return list<array{0: string, 1: string}>
     321         */
     322        public static function data_spaces_around_quotes(): array {
    275323                $nbsp = "\xC2\xA0";
    276324                $pi   = "\xCE\xA0";
    … …  
    324372         * @dataProvider data_apos_before_digits
    325373         */
    326         public function test_apos_before_digits( $input, $output ) {
     374        public function test_apos_before_digits( string $input, string $output ): void {
    327375                $this->assertSame( $output, wptexturize( $input ) );
    328376        }
    329377
    330         public static function data_apos_before_digits() {
     378        /**
     379         * Data provider for {@see self::test_apos_before_digits()}.
     380         *
     381         * @return list<array{0: string, 1: string}>
     382         */
     383        public static function data_apos_before_digits(): array {
    331384                return array(
    332385                        array(
    … …  
    365418         * @dataProvider data_opening_single_quote
    366419         */
    367         public function test_opening_single_quote( $input, $output ) {
     420        public function test_opening_single_quote( string $input, string $output ): void {
    368421                $this->assertSame( $output, wptexturize( $input ) );
    369422        }
    370423
    371         public static function data_opening_single_quote() {
     424        /**
     425         * Data provider for {@see self::test_opening_single_quote()}.
     426         *
     427         * @return list<array{0: string, 1: string}>
     428         */
     429        public static function data_opening_single_quote(): array {
    372430                return array(
    373431                        array(
    … …  
    494552         * @dataProvider data_double_prime
    495553         */
    496         public function test_double_prime( $input, $output ) {
     554        public function test_double_prime( string $input, string $output ): void {
    497555                $this->assertSame( $output, wptexturize( $input ) );
    498556        }
    499557
    500         public static function data_double_prime() {
     558        /**
     559         * Data provider for {@see self::test_double_prime()}.
     560         *
     561         * @return list<array{0: string, 1: string}>
     562         */
     563        public static function data_double_prime(): array {
    501564                return array(
    502565                        array(
    … …  
    527590         * @dataProvider data_single_prime
    528591         */
    529         public function test_single_prime( $input, $output ) {
     592        public function test_single_prime( string $input, string $output ): void {
    530593                $this->assertSame( $output, wptexturize( $input ) );
    531594        }
    532595
    533         public static function data_single_prime() {
     596        /**
     597         * Data provider for {@see self::test_single_prime()}.
     598         *
     599         * @return list<array{0: string, 1: string}>
     600         */
     601        public static function data_single_prime(): array {
    534602                return array(
    535603                        array(
    … …  
    560628         * @dataProvider data_contractions
    561629         */
    562         public function test_contractions( $input, $output ) {
     630        public function test_contractions( string $input, string $output ): void {
    563631                $this->assertSame( $output, wptexturize( $input ) );
    564632        }
    565633
    566         public static function data_contractions() {
     634        /**
     635         * Data provider for {@see self::test_contractions()}.
     636         *
     637         * @return list<array{0: string, 1: string}>
     638         */
     639        public static function data_contractions(): array {
    567640                return array(
    568641                        array(
    … …  
    601674         * @dataProvider data_opening_quote
    602675         */
    603         public function test_opening_quote( $input, $output ) {
     676        public function test_opening_quote( string $input, string $output ): void {
    604677                $this->assertSame( $output, wptexturize( $input ) );
    605678        }
    606679
    607         public static function data_opening_quote() {
     680        /**
     681         * Data provider for {@see self::test_opening_quote()}.
     682         *
     683         * @return list<array{0: string, 1: string}>
     684         */
     685        public static function data_opening_quote(): array {
    608686                return array(
    609687                        array(
    … …  
    678756         * @dataProvider data_closing_quote
    679757         */
    680         public function test_closing_quote( $input, $output ) {
     758        public function test_closing_quote( string $input, string $output ): void {
    681759                $this->assertSame( $output, wptexturize( $input ) );
    682760        }
    683761
    684         public static function data_closing_quote() {
     762        /**
     763         * Data provider for {@see self::test_closing_quote()}.
     764         *
     765         * @return list<array{0: string, 1: string}>
     766         */
     767        public static function data_closing_quote(): array {
    685768                return array(
    686769                        array(
    … …  
    767850         * @dataProvider data_closing_single_quote
    768851         */
    769         public function test_closing_single_quote( $input, $output ) {
     852        public function test_closing_single_quote( string $input, string $output ): void {
    770853                $this->assertSame( $output, wptexturize( $input ) );
    771854        }
    772855
    773         public static function data_closing_single_quote() {
     856        /**
     857         * Data provider for {@see self::test_closing_single_quote()}.
     858         *
     859         * @return list<array{0: string, 1: string}>
     860         */
     861        public static function data_closing_single_quote(): array {
    774862                return array(
    775863                        array(
    … …  
    857945         * @dataProvider data_multiplication
    858946         */
    859         public function test_multiplication( $input, $output ) {
     947        public function test_multiplication( string $input, string $output ): void {
    860948                $this->assertSame( $output, wptexturize( $input ) );
    861949        }
    862950
    863         public static function data_multiplication() {
     951        /**
     952         * Data provider for {@see self::test_multiplication()}.
     953         *
     954         * @return list<array{0: string, 1: string}>
     955         */
     956        public static function data_multiplication(): array {
    864957                return array(
    865958                        array(
    … …  
    9071000         * @dataProvider data_ampersand
    9081001         */
    909         public function test_ampersand( $input, $output ) {
     1002        public function test_ampersand( string $input, string $output ): void {
    9101003                $this->assertSame( $output, wptexturize( $input ) );
    9111004        }
    9121005
    913         public static function data_ampersand() {
     1006        /**
     1007         * Data provider for {@see self::test_ampersand()}.
     1008         *
     1009         * @return list<array{0: string, 1: string}>
     1010         */
     1011        public static function data_ampersand(): array {
    9141012                return array(
    9151013                        array(
    … …  
    9721070         * @dataProvider data_cockney
    9731071         */
    974         public function test_cockney( $input, $output ) {
     1072        public function test_cockney( string $input, string $output ): void {
    9751073                $this->assertSame( $output, wptexturize( $input ) );
    9761074        }
    9771075
    978         public static function data_cockney() {
     1076        /**
     1077         * Data provider for {@see self::test_cockney()}.
     1078         *
     1079         * @return list<array{0: string, 1: string}>
     1080         */
     1081        public static function data_cockney(): array {
    9791082                return array(
    9801083                        array(
    … …  
    10331136         * @dataProvider data_smart_dashes
    10341137         */
    1035         public function test_smart_dashes( $input, $output ) {
     1138        public function test_smart_dashes( string $input, string $output ): void {
    10361139                $this->assertSame( $output, wptexturize( $input ) );
    10371140        }
    10381141
    1039         public static function data_smart_dashes() {
     1142        /**
     1143         * Data provider for {@see self::test_smart_dashes()}.
     1144         *
     1145         * @return list<array{0: string, 1: string}>
     1146         */
     1147        public static function data_smart_dashes(): array {
    10401148                return array(
    10411149                        array(
    … …  
    10861194         * @dataProvider data_misc_static_replacements
    10871195         */
    1088         public function test_misc_static_replacements( $input, $output ) {
     1196        public function test_misc_static_replacements( string $input, string $output ): void {
    10891197                $this->assertSame( $output, wptexturize( $input ) );
    10901198        }
    10911199
    1092         public static function data_misc_static_replacements() {
     1200        /**
     1201         * Data provider for {@see self::test_misc_static_replacements()}.
     1202         *
     1203         * @return list<array{0: string, 1: string}>
     1204         */
     1205        public static function data_misc_static_replacements(): array {
    10931206                return array(
    10941207                        array(
    … …  
    11411254         * @dataProvider data_quoted_numbers
    11421255         */
    1143         public function test_quoted_numbers( $input, $output ) {
     1256        public function test_quoted_numbers( string $input, string $output ): void {
    11441257                $this->assertSame( $output, wptexturize( $input ) );
    11451258        }
    11461259
    1147         public static function data_quoted_numbers() {
     1260        /**
     1261         * Data provider for {@see self::test_quoted_numbers()}.
     1262         *
     1263         * @return list<array{0: string, 1: string}>
     1264         */
     1265        public static function data_quoted_numbers(): array {
    11481266                return array(
    11491267                        array(
    … …  
    11921310         * @dataProvider data_quotes_and_dashes
    11931311         */
    1194         public function test_quotes_and_dashes( $input, $output ) {
     1312        public function test_quotes_and_dashes( string $input, string $output ): void {
    11951313                $this->assertSame( $output, wptexturize( $input ) );
    11961314        }
    11971315
    1198         public static function data_quotes_and_dashes() {
     1316        /**
     1317         * Data provider for {@see self::test_quotes_and_dashes()}.
     1318         *
     1319         * @return list<array{0: string, 1: string}>
     1320         */
     1321        public static function data_quotes_and_dashes(): array {
    11991322                return array(
    12001323                        array(
    … …  
    12551378         * @dataProvider data_tag_avoidance
    12561379         */
    1257         public function test_tag_avoidance( $input, $output ) {
     1380        public function test_tag_avoidance( string $input, string $output ): void {
    12581381                $this->assertSame( $output, wptexturize( $input ) );
    12591382        }
    12601383
    1261         public static function data_tag_avoidance() {
     1384        /**
     1385         * Data provider for {@see self::test_tag_avoidance()}.
     1386         *
     1387         * @return list<array{0: string, 1: string}>
     1388         */
     1389        public static function data_tag_avoidance(): array {
    12621390                return array(
    12631391                        array(
    … …  
    14781606         * @dataProvider data_year_abbr
    14791607         */
    1480         public function test_year_abbr( $input, $output ) {
     1608        public function test_year_abbr( string $input, string $output ): void {
    14811609                $this->assertSame( $output, wptexturize( $input ) );
    14821610        }
    14831611
    1484         public static function data_year_abbr() {
     1612        /**
     1613         * Data provider for {@see self::test_year_abbr()}.
     1614         *
     1615         * @return list<array{0: string, 1: string}>
     1616         */
     1617        public static function data_year_abbr(): array {
    14851618                return array(
    14861619                        array(
    … …  
    15671700         * @dataProvider data_translate
    15681701         */
    1569         public function test_translate( $input, $output ) {
     1702        public function test_translate( string $input, string $output ): void {
    15701703                add_filter( 'gettext_with_context', array( $this, 'filter_translate' ), 10, 4 );
    15711704
    … …  
    16071740        }
    16081741
    1609         public static function data_translate() {
     1742        /**
     1743         * Data provider for {@see self::test_translate()}.
     1744         *
     1745         * @return list<array{0: string, 1: string}>
     1746         */
     1747        public static function data_translate(): array {
    16101748                return array(
    16111749                        array(
    … …  
    17941932         * @dataProvider data_element_stack
    17951933         */
    1796         public function test_element_stack( $input, $output ) {
     1934        public function test_element_stack( string $input, string $output ): void {
    17971935                $this->assertSame( $output, wptexturize( $input ) );
    17981936        }
    17991937
    1800         public static function data_element_stack() {
     1938        /**
     1939         * Data provider for {@see self::test_element_stack()}.
     1940         *
     1941         * @return list<array{0: string, 1: string}>
     1942         */
     1943        public static function data_element_stack(): array {
    18011944                return array(
    18021945                        array(
    … …  
    18451988         * @dataProvider data_unregistered_shortcodes
    18461989         */
    1847         public function test_unregistered_shortcodes( $input, $output ) {
     1990        public function test_unregistered_shortcodes( string $input, string $output ): void {
    18481991                add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 );
    18491992
    1850                 $output = $this->assertSame( $output, wptexturize( $input ) );
     1993                $this->assertSame( $output, wptexturize( $input ) );
    18511994
    18521995                remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ) );
    1853                 return $output;
    18541996        }
    18551997
    … …  
    18592001        }
    18602002
    1861         public static function data_unregistered_shortcodes() {
     2003        /**
     2004         * Data provider for {@see self::test_unregistered_shortcodes()}.
     2005         *
     2006         * @return list<array{0: string, 1: string}>
     2007         */
     2008        public static function data_unregistered_shortcodes(): array {
    18622009                return array(
    18632010                        array(
    … …  
    19302077         * @dataProvider data_primes_vs_quotes
    19312078         */
    1932         public function test_primes_vs_quotes( $input, $output ) {
     2079        public function test_primes_vs_quotes( string $input, string $output ): void {
    19332080                $this->assertSame( $output, wptexturize( $input ) );
    19342081        }
    19352082
    1936         public static function data_primes_vs_quotes() {
     2083        /**
     2084         * Data provider for {@see self::test_primes_vs_quotes()}.
     2085         *
     2086         * @return list<array{0: string, 1: string}>
     2087         */
     2088        public static function data_primes_vs_quotes(): array {
    19372089                return array(
    19382090                        array(
    … …  
    19922144         * @dataProvider data_primes_quotes_translation
    19932145         */
    1994         public function test_primes_quotes_translation( $input, $output ) {
     2146        public function test_primes_quotes_translation( string $input, string $output ): void {
    19952147                add_filter( 'gettext_with_context', array( $this, 'filter_translate2' ), 10, 4 );
    19962148
    … …  
    20302182        }
    20312183
    2032         public static function data_primes_quotes_translation() {
     2184        /**
     2185         * Data provider for {@see self::test_primes_quotes_translation()}.
     2186         *
     2187         * @return list<array{0: string, 1: string}>
     2188         */
     2189        public static function data_primes_quotes_translation(): array {
    20332190                return array(
    20342191                        array(
    … …  
    20872244         * @covers ::_get_wptexturize_split_regex
    20882245         * @covers ::_get_wptexturize_shortcode_regex
    2089          */
    2090         public function test_pcre_performance( $input ) {
     2246         * @covers ::get_html_split_regex
     2247         */
     2248        public function test_pcre_performance( string $input ): void {
    20912249                global $shortcode_tags;
    20922250
    … …  
    21002258                $regex           = _get_wptexturize_split_regex( $shortcode_regex );
    21012259                $result          = benchmark_pcre_backtracking( $regex, $input, 'split' );
    2102                 return $this->assertLessThan( 200, $result );
     2260                $this->assertLessThan( 200, $result );
    21032261        }
    21042262
    … …  
    21082266         * @ticket 35864
    21092267         */
    2110         public function test_trailing_less_than() {
     2268        public function test_trailing_less_than(): void {
    21112269                $this->assertSame( 'F&#8211;oo<', wptexturize( 'F--oo<', true ) );
    21122270        }
    21132271
    2114         public static function data_whole_posts() {
     2272        /**
     2273         * Data provider for {@see self::test_pcre_performance()}.
     2274         *
     2275         * @return array<int, array{0: string}>
     2276         */
     2277        public static function data_whole_posts(): array {
    21152278                require_once DIR_TESTDATA . '/formatting/whole-posts.php';
    21162279                return data_whole_posts();
Note: See TracChangeset for help on using the changeset viewer.