Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some docblock types related to the Template Registration API #65187

Merged
merged 5 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/compat/wordpress-6.7/block-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
* Register a template.
*
* @param string $template_name Template name in the form of `plugin_uri//template_name`.
* @param array|string $args Object type or array of object types with which the taxonomy should be associated.
* @param array|string $args {
* @type string $title Optional. Title of the template as it will be shown in the Site Editor
* and other UI elements.
Expand All @@ -33,7 +32,8 @@ function wp_register_block_template( $template_name, $args = array() ) {
* Unregister a template.
*
* @param string $template_name Template name in the form of `plugin_uri//template_name`.
* @return true|WP_Error True on success, WP_Error on failure or if the template doesn't exist.
* @return WP_Block_Template|WP_Error The unregistered template object on success, WP_Error object on failure or if
* the template doesn't exist.
*/
function wp_unregister_block_template( $template_name ) {
return WP_Block_Templates_Registry::get_instance()->unregister( $template_name );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class WP_Block_Templates_Registry {
*
* @param string $template_name Template name including namespace.
* @param array $args Optional. Array of template arguments.
* @return WP_Block_Template|WP_Error The registered template on success, or false on failure.
* @return WP_Block_Template|WP_Error The registered template on success, or WP_Error on failure.
*/
public function register( $template_name, $args = array() ) {

Expand Down Expand Up @@ -100,7 +100,7 @@ public function register( $template_name, $args = array() ) {
*
* @since 6.7.0
*
* @return WP_Block_Template[]|false Associative array of `$template_name => $template` pairs.
* @return WP_Block_Template[] Associative array of `$template_name => $template` pairs.
*/
public function get_all_registered() {
return $this->registered_templates;
Expand All @@ -112,7 +112,7 @@ public function get_all_registered() {
* @since 6.7.0
*
* @param string $template_name Template name including namespace.
* @return WP_Block_Template|null|false The registered template, or null if it is not registered.
* @return WP_Block_Template|null The registered template, or null if it is not registered.
*/
public function get_registered( $template_name ) {
if ( ! $this->is_registered( $template_name ) ) {
Expand Down Expand Up @@ -216,7 +216,7 @@ public function is_registered( $template_name ) {
* @since 6.7.0
*
* @param string $template_name Template name including namespace.
* @return WP_Block_Template|false The unregistered template on success, or false on failure.
* @return WP_Block_Template|WP_Error The unregistered template on success, or WP_Error on failure.
*/
public function unregister( $template_name ) {
if ( ! $this->is_registered( $template_name ) ) {
Expand Down
Loading