diff --git a/includes/ApiEmbedVideo.php b/includes/ApiEmbedVideo.php index 9cfd5a7..576aa3f 100644 --- a/includes/ApiEmbedVideo.php +++ b/includes/ApiEmbedVideo.php @@ -13,6 +13,7 @@ namespace MediaWiki\Extension\EmbedVideo; use ApiBase; +use Wikimedia\ParamValidator\ParamValidator; class ApiEmbedVideo extends ApiBase { /** @@ -53,36 +54,36 @@ public function execute(): bool { public function getAllowedParams(): array { return array_merge( parent::getAllowedParams(), [ 'service' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => true + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => true ], 'id' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => true + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => true ], 'dimensions' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => false + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => false ], 'alignment' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => false + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => false ], 'description' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => false + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => false ], 'container' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => false + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => false ], 'urlargs' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => false + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => false ], 'autoresize' => [ - ApiBase::PARAM_TYPE => 'string', - ApiBase::PARAM_REQUIRED => false + ParamValidator::PARAM_TYPE => 'string', + ParamValidator::PARAM_REQUIRED => false ], ] ); } diff --git a/includes/EmbedVideo.php b/includes/EmbedVideo.php index 1bba0dd..5c100fa 100644 --- a/includes/EmbedVideo.php +++ b/includes/EmbedVideo.php @@ -102,9 +102,7 @@ public static function parseEV( Parser $parser, PPFrame $frame, array $args, boo } } - $embedVideo = new EmbedVideo( $parser, $expandedArgs, $fromTag ); - - return $embedVideo->output(); + return ( new EmbedVideo( $parser, $expandedArgs, $fromTag ) )->output(); } /** @@ -496,11 +494,11 @@ private function addModules(): void { } } - $out->addModules( 'ext.embedVideo' ); - $out->addModuleStyles( 'ext.embedVideo.styles' ); + $out->addModules( [ 'ext.embedVideo' ] ); + $out->addModuleStyles( [ 'ext.embedVideo.styles' ] ); if ( MediaWikiServices::getInstance()->getMainConfig()->get( 'EmbedVideoRequireConsent' ) === true ) { - $out->addModules( 'ext.embedVideo.consent' ); + $out->addModules( [ 'ext.embedVideo.consent' ] ); } } }