mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-25 03:57:54 +00:00
:octocat: i hate this less
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
* Miscellaneous stubs for phan
|
||||
*
|
||||
* @created 25.01.2021
|
||||
* @author smiley <smiley@chillerlan.net>
|
||||
* @copyright 2021 smiley
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
class GdImage{}
|
||||
@@ -25,7 +25,6 @@ final class GDLuminanceSource extends LuminanceSource{
|
||||
|
||||
/**
|
||||
* @var resource|\GdImage
|
||||
* @phan-suppress PhanUndeclaredTypeProperty
|
||||
*/
|
||||
private $gdImage;
|
||||
|
||||
@@ -33,15 +32,13 @@ final class GDLuminanceSource extends LuminanceSource{
|
||||
* GDLuminanceSource constructor.
|
||||
*
|
||||
* @param resource|\GdImage $gdImage
|
||||
* @phan-suppress PhanUndeclaredTypeParameter
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function __construct($gdImage){
|
||||
|
||||
/** @noinspection PhpElementIsNotAvailableInCurrentPhpVersionInspection, PhpFullyQualifiedNameUsageInspection */
|
||||
/** @noinspection PhpFullyQualifiedNameUsageInspection */
|
||||
if(
|
||||
/** @phan-suppress-next-line PhanUndeclaredClassInstanceof */
|
||||
(PHP_MAJOR_VERSION >= 8 && !$gdImage instanceof \GdImage)
|
||||
|| (PHP_MAJOR_VERSION < 8 && (!is_resource($gdImage) || get_resource_type($gdImage) !== 'gd'))
|
||||
){
|
||||
|
||||
@@ -45,8 +45,6 @@ class QRImage extends QROutputAbstract{
|
||||
*
|
||||
* @see imagecreatetruecolor()
|
||||
* @var resource|\GdImage
|
||||
*
|
||||
* @phan-suppress PhanUndeclaredTypeProperty
|
||||
*/
|
||||
protected $image;
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ final class QRCodeReader{
|
||||
* @param \Imagick|\GdImage|resource $im
|
||||
*
|
||||
* @return \chillerlan\QRCode\Decoder\DecoderResult
|
||||
* @phan-suppress PhanUndeclaredTypeParameter (GdImage)
|
||||
*/
|
||||
protected function decode($im):DecoderResult{
|
||||
|
||||
@@ -78,7 +77,6 @@ final class QRCodeReader{
|
||||
|
||||
/**
|
||||
* @param \Imagick|\GdImage|resource $imgSource
|
||||
* @phan-suppress PhanUndeclaredTypeParameter
|
||||
*
|
||||
* @return \chillerlan\QRCode\Decoder\DecoderResult
|
||||
*/
|
||||
|
||||
@@ -70,7 +70,7 @@ class QRImageTest extends QROutputTestAbstract{
|
||||
}
|
||||
|
||||
/**
|
||||
* @phan-suppress PhanUndeclaredClassReference
|
||||
*
|
||||
*/
|
||||
public function testOutputGetResource():void{
|
||||
$this->options->returnResource = true;
|
||||
@@ -78,7 +78,7 @@ class QRImageTest extends QROutputTestAbstract{
|
||||
|
||||
$actual = $this->outputInterface->dump();
|
||||
|
||||
/** @noinspection PhpElementIsNotAvailableInCurrentPhpVersionInspection */
|
||||
/** @noinspection PhpFullyQualifiedNameUsageInspection */
|
||||
\PHP_MAJOR_VERSION >= 8
|
||||
? $this::assertInstanceOf(\GdImage::class, $actual)
|
||||
: $this::assertIsResource($actual);
|
||||
|
||||
Reference in New Issue
Block a user