X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Ftitle%2FTitleValue.php;h=18e578dbb9f92ba66d0434ec700abb090f5d915d;hb=532b15c80083f97ab00e42c2a03ccb461db0bc5d;hp=3e133006d087fb4b62fc737a202f05d91c789b19;hpb=9bf44d08f938cc9a85dc647b8a00665d5bd01fb6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/title/TitleValue.php b/includes/title/TitleValue.php index 3e133006d0..18e578dbb9 100644 --- a/includes/title/TitleValue.php +++ b/includes/title/TitleValue.php @@ -22,6 +22,7 @@ */ use MediaWiki\Linker\LinkTarget; use Wikimedia\Assert\Assert; +use Wikimedia\Assert\ParameterTypeException; /** * Represents a page (or page fragment) title within MediaWiki. @@ -76,10 +77,18 @@ class TitleValue implements LinkTarget { * @throws InvalidArgumentException */ public function __construct( $namespace, $dbkey, $fragment = '', $interwiki = '' ) { - Assert::parameterType( 'integer', $namespace, '$namespace' ); - Assert::parameterType( 'string', $dbkey, '$dbkey' ); - Assert::parameterType( 'string', $fragment, '$fragment' ); - Assert::parameterType( 'string', $interwiki, '$interwiki' ); + if ( !is_int( $namespace ) ) { + throw new ParameterTypeException( '$namespace', 'int' ); + } + if ( !is_string( $dbkey ) ) { + throw new ParameterTypeException( '$dbkey', 'string' ); + } + if ( !is_string( $fragment ) ) { + throw new ParameterTypeException( '$fragment', 'string' ); + } + if ( !is_string( $interwiki ) ) { + throw new ParameterTypeException( '$interwiki', 'string' ); + } // Sanity check, no full validation or normalization applied here! Assert::parameter( !preg_match( '/^_|[ \r\n\t]|_$/', $dbkey ), '$dbkey',