PHP docs disagree with reality when it comes to return type of offsetGet, so switching to offsetExists.
Issue spotted by Brad Jorsch
Change-Id: I4ce1651d4ed681ab55cf297090ee963b64584bbf
* @param mixed $index
*/
public function offsetUnset( $index ) {
- /**
- * @var Site $site
- */
- $site = $this->offsetGet( $index );
+ if ( $this->offsetExists( $index ) ) {
+ /**
+ * @var Site $site
+ */
+ $site = $this->offsetGet( $index );
- if ( $site !== false ) {
unset( $this->byGlobalId[$site->getGlobalId()] );
unset( $this->byInternalId[$site->getInternalId()] );
}