Code Modernization: Fix instances of using null as an array offset.

Addresses a new [https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_using_values_null_as_an_array_offset_and_when_calling_array_key_exists deprecation in PHP 8.5] in several block-related registry classes.

Follow-up to [60809].

Props mukesh27, swissspidy.
Fixes #63957.
Built from https://develop.svn.wordpress.org/trunk@60904


git-svn-id: http://core.svn.wordpress.org/trunk@60240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Pascal Birchler
2025-10-06 11:31:33 +00:00
parent 9bc90d7e66
commit a6cf78ca4d
6 changed files with 12 additions and 12 deletions

View File

@@ -249,11 +249,11 @@ final class WP_Block_Bindings_Registry {
*
* @since 6.5.0
*
* @param string $source_name The name of the source.
* @param string|null $source_name The name of the source.
* @return bool `true` if the block bindings source is registered, `false` otherwise.
*/
public function is_registered( $source_name ) {
return isset( $this->sources[ $source_name ] );
return isset( $source_name, $this->sources[ $source_name ] );
}
/**

View File

@@ -138,11 +138,11 @@ final class WP_Block_Pattern_Categories_Registry {
*
* @since 5.5.0
*
* @param string $category_name Pattern category name including namespace.
* @param string|null $category_name Pattern category name including namespace.
* @return bool True if the pattern category is registered, false otherwise.
*/
public function is_registered( $category_name ) {
return isset( $this->registered_categories[ $category_name ] );
return isset( $category_name, $this->registered_categories[ $category_name ] );
}
/**

View File

@@ -238,11 +238,11 @@ final class WP_Block_Patterns_Registry {
*
* @since 5.5.0
*
* @param string $pattern_name Block pattern name including namespace.
* @param string|null $pattern_name Block pattern name including namespace.
* @return bool True if the pattern is registered, false otherwise.
*/
public function is_registered( $pattern_name ) {
return isset( $this->registered_patterns[ $pattern_name ] );
return isset( $pattern_name, $this->registered_patterns[ $pattern_name ] );
}
public function __wakeup() {

View File

@@ -181,12 +181,12 @@ final class WP_Block_Styles_Registry {
*
* @since 5.3.0
*
* @param string $block_name Block type name including namespace.
* @param string $block_style_name Block style name.
* @param string|null $block_name Block type name including namespace.
* @param string|null $block_style_name Block style name.
* @return bool True if the block style is registered, false otherwise.
*/
public function is_registered( $block_name, $block_style_name ) {
return isset( $this->registered_block_styles[ $block_name ][ $block_style_name ] );
return isset( $block_name, $block_style_name, $this->registered_block_styles[ $block_name ][ $block_style_name ] );
}
/**

View File

@@ -204,11 +204,11 @@ final class WP_Block_Templates_Registry {
*
* @since 6.7.0
*
* @param string $template_name Template name.
* @param string|null $template_name Template name.
* @return bool True if the template is registered, false otherwise.
*/
public function is_registered( $template_name ) {
return isset( $this->registered_templates[ $template_name ] );
return isset( $template_name, $this->registered_templates[ $template_name ] );
}
/**

View File

@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.9-alpha-60903';
$wp_version = '6.9-alpha-60904';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.