Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHPDocBlock of Images library #3250

Merged
merged 1 commit into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Config/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Images extends BaseConfig
/**
* The available handler classes.
*
* @var array
* @var \CodeIgniter\Images\Handlers\BaseHandler[]
*/
public $handlers = [
'gd' => \CodeIgniter\Images\Handlers\GDHandler::class,
Expand Down
6 changes: 3 additions & 3 deletions system/Config/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,9 @@ public static function honeypot(BaseConfig $config = null, bool $getShared = tru
* Acts as a factory for ImageHandler classes and returns an instance
* of the handler. Used like Services::image()->withFile($path)->rotate(90)->save();
*
* @param string $handler
* @param mixed $config
* @param boolean $getShared
* @param string|null $handler
* @param \Config\Images|null $config
* @param boolean $getShared
*
* @return \CodeIgniter\Images\Handlers\BaseHandler
*/
Expand Down
52 changes: 26 additions & 26 deletions system/Images/Handlers/BaseHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use CodeIgniter\Images\Exceptions\ImageException;
use CodeIgniter\Images\Image;
use CodeIgniter\Images\ImageHandlerInterface;
use Config\Images;

/**
* Base image handling implementation
Expand Down Expand Up @@ -86,7 +87,7 @@ abstract class BaseHandler implements ImageHandlerInterface
/**
* File permission mask.
*
* @var type
* @var integer
*/
protected $filePermissions = 0644;

Expand Down Expand Up @@ -143,11 +144,11 @@ abstract class BaseHandler implements ImageHandlerInterface
/**
* Constructor.
*
* @param type $config
* @param \Config\Images|null $config
*/
public function __construct($config = null)
{
$this->config = $config;
$this->config = $config ?? new Images();
}

//--------------------------------------------------------------------
Expand Down Expand Up @@ -199,9 +200,9 @@ public function getFile()
* Verifies that a file has been supplied and it is an image.
*
* @return Image The image instance
* @throws type ImageException
* @throws ImageException
*/
protected function image(): ?Image
protected function image(): Image
{
if ($this->verified)
{
Expand Down Expand Up @@ -308,7 +309,7 @@ public function resize(int $width, int $height, bool $maintainRatio = false, str
* @param boolean $maintainRatio
* @param string $masterDim
*
* @return mixed
* @return $this
*/
public function crop(int $width = null, int $height = null, int $x = null, int $y = null, bool $maintainRatio = false, string $masterDim = 'auto')
{
Expand Down Expand Up @@ -354,7 +355,7 @@ public function convert(int $imageType)
*
* @param float $angle
*
* @return mixed
* @return $this
*/
public function rotate(float $angle)
{
Expand Down Expand Up @@ -396,7 +397,7 @@ public function rotate(float $angle)
* @param integer $green
* @param integer $blue
*
* @return mixed
* @return $this
*/
public function flatten(int $red = 255, int $green = 255, int $blue = 255)
{
Expand All @@ -415,8 +416,8 @@ public function flatten(int $red = 255, int $green = 255, int $blue = 255)
* @param integer $green
* @param integer $blue
*
* @return mixed
* @internal param int $angle
* @return $this
* @internal
*/
protected abstract function _flatten(int $red = 255, int $green = 255, int $blue = 255);

Expand Down Expand Up @@ -460,7 +461,7 @@ public function flip(string $dir = 'vertical')
*
* @param string $direction
*
* @return mixed
* @return $this
*/
protected abstract function _flip(string $direction);

Expand Down Expand Up @@ -556,7 +557,6 @@ public function reorient(bool $silent = false)
* EXIF data is only supported fr JPEG & TIFF formats.
*
* @param string|null $key If specified, will only return this piece of EXIF data.
*
* @param boolean $silent If true, will not throw our own exceptions.
*
* @return mixed
Expand Down Expand Up @@ -606,7 +606,7 @@ public function getEXIF(string $key = null, bool $silent = false)
* @param integer $height
* @param string $position
*
* @return boolean
* @return $this
*/
public function fit(int $width, int $height = null, string $position = 'center')
{
Expand All @@ -631,10 +631,10 @@ public function fit(int $width, int $height = null, string $position = 'center')
/**
* Calculate image aspect ratio.
*
* @param $width
* @param null $height
* @param $origWidth
* @param $origHeight
* @param integer|float $width
* @param integer|float|null $height
* @param integer|float $origWidth
* @param integer|float $origHeight
*
* @return array
*/
Expand Down Expand Up @@ -675,11 +675,11 @@ protected function calcAspectRatio($width, $height = null, $origWidth, $origHeig
* Based on the position, will determine the correct x/y coords to
* crop the desired portion from the image.
*
* @param $width
* @param $height
* @param $origWidth
* @param $origHeight
* @param $position
* @param integer|float $width
* @param integer|float $height
* @param integer|float $origWidth
* @param integer|float $origHeight
* @param string $position
*
* @return array
*/
Expand Down Expand Up @@ -752,10 +752,10 @@ public abstract function getVersion();
* $image->resize(100, 200, true)
* ->save($target);
*
* @param string $target
* @param integer $quality
* @param string|null $target
* @param integer $quality
*
* @return mixed
* @return boolean
*/
public abstract function save(string $target = null, int $quality = 90);

Expand Down Expand Up @@ -866,7 +866,7 @@ public function getWidth()
*
* accessor for testing; not part of interface
*
* @return type
* @return integer
*/
public function getHeight()
{
Expand Down
16 changes: 9 additions & 7 deletions system/Images/Handlers/GDHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ class GDHandler extends BaseHandler
/**
* Constructor.
*
* @param type $config
* @throws type
* @param \Config\Images|null $config
* @throws ImageException
*/
public function __construct($config = null)
{
Expand Down Expand Up @@ -184,7 +184,7 @@ public function getVersion()
/**
* Resizes the image.
*
* @return boolean|\CodeIgniter\Images\Handlers\GDHandler
* @return \CodeIgniter\Images\Handlers\GDHandler
*/
public function _resize()
{
Expand All @@ -196,7 +196,7 @@ public function _resize()
/**
* Crops the image.
*
* @return boolean|\CodeIgniter\Images\Handlers\GDHandler
* @return \CodeIgniter\Images\Handlers\GDHandler
*/
public function _crop()
{
Expand All @@ -210,7 +210,7 @@ public function _crop()
*
* @param string $action
*
* @return $this|bool
* @return $this
*/
protected function process(string $action)
{
Expand Down Expand Up @@ -404,8 +404,8 @@ protected function ensureResource()
* @param string $path Image path
* @param integer $imageType Image type
*
* @return resource
* @throws type ImageException
* @return resource|boolean
* @throws ImageException
*/
protected function getImageResource(string $path, int $imageType)
{
Expand Down Expand Up @@ -549,6 +549,8 @@ protected function _text(string $text, array $options = [])
* @param string $text
* @param array $options
* @param boolean $isShadow Whether we are drawing the dropshadow or actual text
*
* @return void
*/
protected function textOverlay(string $text, array $options = [], bool $isShadow = false)
{
Expand Down
10 changes: 5 additions & 5 deletions system/Images/Handlers/ImageMagickHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ImageMagickHandler extends BaseHandler
/**
* Stores image resource in memory.
*
* @var
* @var string
*/
protected $resource;

Expand All @@ -69,8 +69,8 @@ class ImageMagickHandler extends BaseHandler
/**
* Constructor.
*
* @param type $config
* @throws type
* @param \Config\Images $config
* @throws ImageException
*/
public function __construct($config = null)
{
Expand Down Expand Up @@ -496,7 +496,7 @@ protected function _text(string $text, array $options = [])
/**
* Return the width of an image.
*
* @return type
* @return integer
*/
public function _getWidth()
{
Expand All @@ -506,7 +506,7 @@ public function _getWidth()
/**
* Return the height of an image.
*
* @return type
* @return integer
*/
public function _getHeight()
{
Expand Down
6 changes: 3 additions & 3 deletions system/Images/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ class Image extends File
/**
* The original image width in pixels.
*
* @var
* @var integer|float
*/
public $origWidth;

/**
* The original image height in pixels.
*
* @var
* @var integer|float
*/
public $origHeight;

Expand Down Expand Up @@ -131,7 +131,7 @@ public function copy(string $targetPath, string $targetName = null, int $perms =
*
* @param boolean $return
*
* @return mixed
* @return array|boolean
*/
public function getProperties(bool $return = false)
{
Expand Down
15 changes: 9 additions & 6 deletions system/Images/ImageHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ interface ImageHandlerInterface
* @param integer $height
* @param boolean $maintainRatio If true, will get the closest match possible while keeping aspect ratio true.
* @param string $masterDim
*
* @return $this
*/
public function resize(int $width, int $height, bool $maintainRatio = false, string $masterDim = 'auto');

Expand All @@ -69,7 +71,7 @@ public function resize(int $width, int $height, bool $maintainRatio = false, str
* @param boolean $maintainRatio
* @param string $masterDim
*
* @return mixed
* @return $this
*/
public function crop(int $width = null, int $height = null, int $x = null, int $y = null, bool $maintainRatio = false, string $masterDim = 'auto');

Expand All @@ -92,7 +94,7 @@ public function convert(int $imageType);
*
* @param float $angle
*
* @return mixed
* @return $this
*/
public function rotate(float $angle);

Expand All @@ -105,9 +107,10 @@ public function rotate(float $angle);
* @param integer $green
* @param integer $blue
*
* @return mixed
* @return $this
*/
public function flatten(int $red = 255, int $green = 255, int $blue = 255);

//--------------------------------------------------------------------

/**
Expand Down Expand Up @@ -137,7 +140,7 @@ public function getEXIF(string $key = null);
*
* @param string $dir Direction to flip, either 'vertical' or 'horizontal'
*
* @return mixed
* @return $this
*/
public function flip(string $dir = 'vertical');

Expand All @@ -161,7 +164,7 @@ public function flip(string $dir = 'vertical');
* @param integer $height
* @param string $position
*
* @return boolean
* @return $this
*/
public function fit(int $width, int $height, string $position);

Expand Down Expand Up @@ -201,7 +204,7 @@ public function text(string $text, array $options = []);
* @param string $target
* @param integer $quality
*
* @return mixed
* @return boolean
*/
public function save(string $target = null, int $quality = 90);
}