Merged in feature/81-dev-dev01 (pull request #5)
auto-patch 81-dev-dev01-2023-12-05T22_45_26 * auto-patch 81-dev-dev01-2023-12-05T22_45_26
This commit is contained in:
@@ -63,59 +63,59 @@ class WP_Block_List implements Iterator, ArrayAccess, Countable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if a block exists by the specified block index, or false
|
||||
* Returns true if a block exists by the specified block offset, or false
|
||||
* otherwise.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @link https://www.php.net/manual/en/arrayaccess.offsetexists.php
|
||||
*
|
||||
* @param string $index Index of block to check.
|
||||
* @param string $offset Offset of block to check for.
|
||||
* @return bool Whether block exists.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetExists( $index ) {
|
||||
return isset( $this->blocks[ $index ] );
|
||||
public function offsetExists( $offset ) {
|
||||
return isset( $this->blocks[ $offset ] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value by the specified block index.
|
||||
* Returns the value by the specified block offset.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @link https://www.php.net/manual/en/arrayaccess.offsetget.php
|
||||
*
|
||||
* @param string $index Index of block value to retrieve.
|
||||
* @param string $offset Offset of block value to retrieve.
|
||||
* @return mixed|null Block value if exists, or null.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetGet( $index ) {
|
||||
$block = $this->blocks[ $index ];
|
||||
public function offsetGet( $offset ) {
|
||||
$block = $this->blocks[ $offset ];
|
||||
|
||||
if ( isset( $block ) && is_array( $block ) ) {
|
||||
$block = new WP_Block( $block, $this->available_context, $this->registry );
|
||||
$this->blocks[ $index ] = $block;
|
||||
$this->blocks[ $offset ] = $block;
|
||||
}
|
||||
|
||||
return $block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assign a block value by the specified block index.
|
||||
* Assign a block value by the specified block offset.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @link https://www.php.net/manual/en/arrayaccess.offsetset.php
|
||||
*
|
||||
* @param string $index Index of block value to set.
|
||||
* @param string $offset Offset of block value to set.
|
||||
* @param mixed $value Block value.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetSet( $index, $value ) {
|
||||
if ( is_null( $index ) ) {
|
||||
public function offsetSet( $offset, $value ) {
|
||||
if ( is_null( $offset ) ) {
|
||||
$this->blocks[] = $value;
|
||||
} else {
|
||||
$this->blocks[ $index ] = $value;
|
||||
$this->blocks[ $offset ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,11 +126,11 @@ class WP_Block_List implements Iterator, ArrayAccess, Countable {
|
||||
*
|
||||
* @link https://www.php.net/manual/en/arrayaccess.offsetunset.php
|
||||
*
|
||||
* @param string $index Index of block value to unset.
|
||||
* @param string $offset Offset of block value to unset.
|
||||
*/
|
||||
#[ReturnTypeWillChange]
|
||||
public function offsetUnset( $index ) {
|
||||
unset( $this->blocks[ $index ] );
|
||||
public function offsetUnset( $offset ) {
|
||||
unset( $this->blocks[ $offset ] );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -210,5 +210,4 @@ class WP_Block_List implements Iterator, ArrayAccess, Countable {
|
||||
public function count() {
|
||||
return count( $this->blocks );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user