Changeset 56803
- Timestamp:
- 10/09/2023 11:21:30 AM (14 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-block-list.php
r56547 r56803 64 64 65 65 /** 66 * Returns true if a block exists by the specified block index, or false66 * Returns true if a block exists by the specified block offset, or false 67 67 * otherwise. 68 68 * … … 71 71 * @link https://www.php.net/manual/en/arrayaccess.offsetexists.php 72 72 * 73 * @param string $ index Index of block to check.73 * @param string $offset Offset of block to check for. 74 74 * @return bool Whether block exists. 75 75 */ 76 76 #[ReturnTypeWillChange] 77 public function offsetExists( $ index) {78 return isset( $this->blocks[ $ index] );79 } 80 81 /** 82 * Returns the value by the specified block index.77 public function offsetExists( $offset ) { 78 return isset( $this->blocks[ $offset ] ); 79 } 80 81 /** 82 * Returns the value by the specified block offset. 83 83 * 84 84 * @since 5.5.0 … … 86 86 * @link https://www.php.net/manual/en/arrayaccess.offsetget.php 87 87 * 88 * @param string $ index Indexof block value to retrieve.88 * @param string $offset Offset of block value to retrieve. 89 89 * @return mixed|null Block value if exists, or null. 90 90 */ 91 91 #[ReturnTypeWillChange] 92 public function offsetGet( $ index) {93 $block = $this->blocks[ $ index];92 public function offsetGet( $offset ) { 93 $block = $this->blocks[ $offset ]; 94 94 95 95 if ( isset( $block ) && is_array( $block ) ) { 96 96 $block = new WP_Block( $block, $this->available_context, $this->registry ); 97 $this->blocks[ $ index] = $block;97 $this->blocks[ $offset ] = $block; 98 98 } 99 99 … … 102 102 103 103 /** 104 * Assign a block value by the specified block index.104 * Assign a block value by the specified block offset. 105 105 * 106 106 * @since 5.5.0 … … 108 108 * @link https://www.php.net/manual/en/arrayaccess.offsetset.php 109 109 * 110 * @param string $ index Indexof block value to set.110 * @param string $offset Offset of block value to set. 111 111 * @param mixed $value Block value. 112 112 */ 113 113 #[ReturnTypeWillChange] 114 public function offsetSet( $ index, $value ) {115 if ( is_null( $ index) ) {114 public function offsetSet( $offset, $value ) { 115 if ( is_null( $offset ) ) { 116 116 $this->blocks[] = $value; 117 117 } else { 118 $this->blocks[ $ index] = $value;118 $this->blocks[ $offset ] = $value; 119 119 } 120 120 } … … 127 127 * @link https://www.php.net/manual/en/arrayaccess.offsetunset.php 128 128 * 129 * @param string $ index Indexof block value to unset.130 */ 131 #[ReturnTypeWillChange] 132 public function offsetUnset( $ index) {133 unset( $this->blocks[ $ index] );129 * @param string $offset Offset of block value to unset. 130 */ 131 #[ReturnTypeWillChange] 132 public function offsetUnset( $offset ) { 133 unset( $this->blocks[ $offset ] ); 134 134 } 135 135
Note: See TracChangeset
for help on using the changeset viewer.