Make WordPress Core

Changeset 65182


Ignore:
Timestamp:
11/01/2026 07:19:44 PM (4 hours ago)
Author:
lancewillett
Message:

I18N: Correct the documented return type of translation entries.

Document WP_Translation_File::entries() as returning string values rather than arrays of strings. Remove the three PHPStan baseline suppressions resolved by this correction.

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

Props abcd95.

See #65817.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/l10n/class-wp-translation-file.php

    r58009 r65182  
    159159         * @since 6.5.0
    160160         *
    161          * @return array<string, string[]> Entries.
     161         * @return array<string, string> Entries.
    162162         */
    163163        public function entries(): array {
  • trunk/tests/phpstan/baselines/assign.propertyType.neon

    r64868 r65182  
    105105                        path: ../../../src/wp-includes/customize/class-wp-customize-header-image-control.php
    106106                -
    107                         message: '#^Property WP_Translation_File\:\:\$entries \(array\<string, string\>\) does not accept array\<string, array\<string\>\>\.$#'
    108                         identifier: assign.propertyType
    109                         count: 1
    110                         path: ../../../src/wp-includes/l10n/class-wp-translation-file.php
    111                 -
    112107                        message: '#^Property WP_REST_Autosaves_Controller\:\:\$revisions_controller \(WP_REST_Revisions_Controller\) does not accept WP_REST_Controller\.$#'
    113108                        identifier: assign.propertyType
  • trunk/tests/phpstan/baselines/return.type.neon

    r64994 r65182  
    7070                        path: ../../../src/wp-includes/fonts.php
    7171                -
    72                         message: '#^Method WP_Translation_Controller\:\:get_entries\(\) should return array\<string, string\> but returns array\<string, array\<string\>\>\.$#'
    73                         identifier: return.type
    74                         count: 1
    75                         path: ../../../src/wp-includes/l10n/class-wp-translation-controller.php
    76                 -
    77                         message: '#^Method WP_Translation_File\:\:entries\(\) should return array\<string, array\<string\>\> but returns array\<string, string\>\.$#'
    78                         identifier: return.type
    79                         count: 1
    80                         path: ../../../src/wp-includes/l10n/class-wp-translation-file.php
    81                 -
    8272                        message: '#^Function update_meta_cache\(\) should return array\|false but returns bool\.$#'
    8373                        identifier: return.type
Note: See TracChangeset for help on using the changeset viewer.