1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-21 05:01:20 +02:00

Refactor __toString interface declarations

This commit is contained in:
Oliver Vogel
2025-08-03 10:35:32 +02:00
parent bee471e68a
commit 8bfadfea5c
6 changed files with 22 additions and 29 deletions

View File

@@ -26,3 +26,4 @@
- Signature of ImageInterface::crop() changed `offset_x` is no `x` and `offset_y` is now `y` - Signature of ImageInterface::crop() changed `offset_x` is no `x` and `offset_y` is now `y`
- Signature of ImageInterface::place() changed `offset_x` is no `x` and `offset_y` is now `y` - Signature of ImageInterface::place() changed `offset_x` is no `x` and `offset_y` is now `y`
- EncodedImageInterface::toDataUri() now returns `DataUriInterface` instead of `string´ - EncodedImageInterface::toDataUri() now returns `DataUriInterface` instead of `string´
- ProfileInterface requires implementation of `::fromPath()`

View File

@@ -5,8 +5,9 @@ declare(strict_types=1);
namespace Intervention\Image\Interfaces; namespace Intervention\Image\Interfaces;
use Intervention\Image\Exceptions\ColorException; use Intervention\Image\Exceptions\ColorException;
use Stringable;
interface ColorChannelInterface interface ColorChannelInterface extends Stringable
{ {
/** /**
* Create new instance by either value or normalized value * Create new instance by either value or normalized value
@@ -46,12 +47,7 @@ interface ColorChannelInterface
public function max(): int; public function max(): int;
/** /**
* Cast color channel's value to string * Transform color channel's value to string
*/ */
public function toString(): string; public function toString(): string;
/**
* Cast color channel's value to string
*/
public function __toString(): string;
} }

View File

@@ -6,8 +6,9 @@ namespace Intervention\Image\Interfaces;
use Intervention\Image\Exceptions\ColorException; use Intervention\Image\Exceptions\ColorException;
use Intervention\Image\Exceptions\RuntimeException; use Intervention\Image\Exceptions\RuntimeException;
use Stringable;
interface ColorInterface interface ColorInterface extends Stringable
{ {
/** /**
* Static color factory method that takes any supported color format * Static color factory method that takes any supported color format
@@ -79,9 +80,4 @@ interface ColorInterface
* Determine whether the current color is completely transparent * Determine whether the current color is completely transparent
*/ */
public function isClear(): bool; public function isClear(): bool;
/**
* Cast color object to string
*/
public function __toString(): string;
} }

View File

@@ -5,8 +5,9 @@ declare(strict_types=1);
namespace Intervention\Image\Interfaces; namespace Intervention\Image\Interfaces;
use Intervention\Image\Exceptions\RuntimeException; use Intervention\Image\Exceptions\RuntimeException;
use Stringable;
interface FileInterface interface FileInterface extends Stringable
{ {
/** /**
* Save data in given path in file system * Save data in given path in file system
@@ -28,12 +29,7 @@ interface FileInterface
public function size(): int; public function size(): int;
/** /**
* Turn encoded data into string * Transform file object into string
*/ */
public function toString(): string; public function toString(): string;
/**
* Cast encoded data into string
*/
public function __toString(): string;
} }

View File

@@ -4,10 +4,17 @@ declare(strict_types=1);
namespace Intervention\Image\Interfaces; namespace Intervention\Image\Interfaces;
interface ProfileInterface use Stringable;
interface ProfileInterface extends Stringable
{ {
/** /**
* Cast color profile object to string * Create profile object from path in file system
*/ */
public function __toString(): string; public static function fromPath(string $path): self;
/**
* Transform object to string
*/
public function toString(): string;
} }

View File

@@ -4,7 +4,9 @@ declare(strict_types=1);
namespace Intervention\Image\Interfaces; namespace Intervention\Image\Interfaces;
interface ResolutionInterface use Stringable;
interface ResolutionInterface extends Stringable
{ {
/** /**
* Return resolution of x-axis * Return resolution of x-axis
@@ -45,9 +47,4 @@ interface ResolutionInterface
* Transform object to string * Transform object to string
*/ */
public function toString(): string; public function toString(): string;
/**
* Cast object to string
*/
public function __toString(): string;
} }