Merge "Replace some manual checks and exceptions with type hints"

This commit is contained in:
jenkins-bot 2024-09-17 23:22:13 +00:00 committed by Gerrit Code Review
commit 40ae308f0d
2 changed files with 2 additions and 15 deletions

View file

@ -98,15 +98,7 @@ class ApiModuleManager extends ContextSource {
* or a class name to instantiate.
* @param callable|null $factory Callback for instantiating the module (deprecated).
*/
public function addModule( $name, $group, $spec, $factory = null ) {
if ( !is_string( $name ) ) {
throw new InvalidArgumentException( '$name must be a string' );
}
if ( !is_string( $group ) ) {
throw new InvalidArgumentException( '$group must be a string' );
}
public function addModule( string $name, string $group, $spec, $factory = null ) {
if ( is_string( $spec ) ) {
$spec = [
'class' => $spec

View file

@ -20,7 +20,6 @@
namespace MediaWiki\Language;
use InvalidArgumentException;
use MediaWiki\Message\Message;
/**
@ -49,11 +48,7 @@ class RawMessage extends Message {
* @param string $text Message to use.
* @param array $params Parameters for the message.
*/
public function __construct( $text, $params = [] ) {
if ( !is_string( $text ) ) {
throw new InvalidArgumentException( '$text must be a string' );
}
public function __construct( string $text, $params = [] ) {
parent::__construct( $text, $params );
// The key is the message.