if ( $targetFile->exists() ) {
$newThumbName = $targetFile->thumbName( $params );
if ( $isOld ) {
+ /** @var array $bits */
$newThumbUrl = $targetFile->getArchiveThumbUrl(
$bits[0] . '!' . $targetFile->getName(), $newThumbName );
} else {
list( $thumb, $errorMsg ) = wfGenerateThumbnail( $img, $params, $thumbName, $thumbPath );
- /** @var MediaTransformOutput|bool $thumb */
+ /** @var MediaTransformOutput|MediaTransformError|bool $thumb */
// Check for thumbnail generation errors...
$msg = wfMessage( 'thumbnail_error' );
'fallback' => function () {
return wfMessage( 'generic-pool-error' )->parse();
},
- 'error' => function ( $status ) {
+ 'error' => function ( Status $status ) {
return $status->getHTML();
}
)
// Tried to select a page on a non-paged file?
}
+ /** @noinspection PhpUnusedLocalVariableInspection */
$done = true; // no PHP fatal occured
if ( !$thumb || $thumb->isError() ) {
*/
function wfExtractThumbParams( $file, $params ) {
if ( !isset( $params['thumbName'] ) ) {
- throw new MWException( "No thumbnail name passed to wfExtractThumbParams" );
+ throw new InvalidArgumentException( "No thumbnail name passed to wfExtractThumbParams" );
}
$thumbname = $params['thumbName'];
// As a last ditch fallback, use the traditional common parameters
if ( preg_match( '!^(page(\d*)-)*(\d*)px-[^/]*$!', $thumbname, $matches ) ) {
- list( /* all */, $pagefull, $pagenum, $size ) = $matches;
+ list( /* all */, /* pagefull */, $pagenum, $size ) = $matches;
$params['width'] = $size;
if ( $pagenum ) {
$params['page'] = $pagenum;
* Output a thumbnail generation error message
*
* @param int $status
- * @param string $msg Plain text (will be html escaped)
+ * @param string $msgText Plain text (will be html escaped)
* @return void
*/
function wfThumbErrorText( $status, $msgText ) {