Mostly revert "Verify parameter for MapCacheLRU::has() can be passed to array_key_exists()"
This broke a few things, and the debug line was basically pointless.
Instead, continue to only throw an exception if $text is an object, but only
warn if it's otherwise not a string.
This reverts commit 372ded2fea.
Change-Id: I060da9191cdbd00c4873caba875bfb77c917bcd7
This commit is contained in:
parent
372ded2fea
commit
156bcbec81
2 changed files with 5 additions and 7 deletions
|
|
@ -260,8 +260,10 @@ class Title {
|
|||
* @return Title|null Title or null on an error.
|
||||
*/
|
||||
public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
|
||||
if ( !is_string( $text ) ) {
|
||||
throw new InvalidArgumentException( 'Title::newFromText given something that isn\'t a string' );
|
||||
if ( is_object( $text ) ) {
|
||||
throw new InvalidArgumentException( '$text must be a string.' );
|
||||
} elseif ( !is_string( $text ) ) {
|
||||
wfWarn( __METHOD__ . ': $text must be a string. This will throw an InvalidArgumentException in future.' );
|
||||
}
|
||||
|
||||
$cache = self::getTitleCache();
|
||||
|
|
|
|||
|
|
@ -74,11 +74,7 @@ class MapCacheLRU {
|
|||
* @return bool
|
||||
*/
|
||||
public function has( $key ) {
|
||||
if ( is_string( $key ) || is_integer( $key ) ) {
|
||||
return array_key_exists( $key, $this->cache );
|
||||
}
|
||||
wfWarn( __METHOD__ . ": Key passed isn't a string or an integer.", 2 );
|
||||
return false;
|
||||
return array_key_exists( $key, $this->cache );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue