// Check if there is a language class for the code
$class = self::classFromCode( $code, $fallback );
- if ( class_exists( $class ) ) {
+ // LanguageCode does not inherit Language
+ if ( class_exists( $class ) && is_a( $class, 'Language', true ) ) {
$lang = new $class;
return $lang;
}
* @param string $ts 14-character timestamp
* YYYYMMDDHHMMSS
* 01234567890123
- * @param DateTimeZone $zone Timezone of $ts
+ * @param DateTimeZone|null $zone Timezone of $ts
* @param int &$ttl The amount of time (in seconds) the output may be cached for.
* Only makes sense if $ts is the current time.
* @todo handling of "o" format character for Iranian, Hebrew, Hijri & Thai?
* match up with it.
*
* @param string $str The validated block duration in English
- * @param User $user User object to use timezone from or null for $wgUser
+ * @param User|null $user User object to use timezone from or null for $wgUser
* @param int $now Current timestamp, for formatting relative block durations
* @return string Somehow translated block duration
* @see LanguageFi.php for example implementation
* @return bool
*/
public function equals( Language $lang ) {
- return $lang->getCode() === $this->mCode;
+ return $lang === $this || $lang->getCode() === $this->mCode;
}
/**