Make WordPress Core

Changeset 64295


Ignore:
Timestamp:
10/10/2026 10:31:03 PM (4 weeks ago)
Author:
SergeyBiryukov
Message:

Docs: Allow false in the documented type of WP_REST_Posts_Controller::$allow_batch.

WP_REST_Posts_Controller::$allow_batch is documented as array, while WP_REST_Attachments_Controller, WP_REST_Font_Faces_Controller and WP_REST_Font_Families_Controller override it with false to opt out of batching. PHPStan reports this as a PHPDoc type that is not covariant with the parent.

false is a supported value, as documented for the allow_batch route option in WP_REST_Server (array{v1?: bool}|false). WP_REST_Server::serve_batch_request_v1() explicitly handles this value, rejecting the request with rest_batch_not_allowed when allow_batch is not an array. The parent type is therefore widened to array|false to match. This is a documentation-only change.

This resolves all three errors in the property.phpDocType PHPStan baseline, which is deleted.

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

Follow-up to r52068, r57548.

Props Soean.
See #65817.

Location:
trunk
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpstan.neon.dist

    r64294 r64295  
    6363        - tests/phpstan/baselines/property.nonObject.neon
    6464        - tests/phpstan/baselines/property.notFound.neon
    65         - tests/phpstan/baselines/property.phpDocType.neon
    6665        - tests/phpstan/baselines/property.private.neon
    6766        - tests/phpstan/baselines/property.protected.neon
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r64130 r64295  
    4444         *
    4545         * @since 5.9.0
    46          * @var array
     46         * @var array|false
    4747         */
    4848        protected $allow_batch = array( 'v1' => true );
Note: See TracChangeset for help on using the changeset viewer.