You want to check wether an image has an alpha channel? But you have no control which Imagick Version is used?
Background:
Method available since ImageMagick 6.4.0
Method returns boolean instead of int since 6.9.x
Example:
$image= new Imagick();
$image->readImage($source_file);
$imageHasAlphaChannel = (method_exists($image, 'getImageAlphaChannel') && ($document->getImageAlphaChannel() === \Imagick::ALPHACHANNEL_ACTIVATE || $document->getImageAlphaChannel() === true));