Skip to content

Commit

Permalink
Merge pull request #79 from sitegeist/task/addDeprecationLogsForSette…
Browse files Browse the repository at this point in the history
…rInFavorOfWithers

TASK: Add deprecation logs for setters in favor of withers
  • Loading branch information
mficzel authored Sep 27, 2024
2 parents ec1d163 + 88d1227 commit 9c69045
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Classes/Domain/AbstractImageSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public function __construct(?string $title = null, ?string $alt = null)
*/
public function setWidth(int $targetWidth, bool $preserveAspect = false): ImageSourceInterface
{
$this->logger->warning('Deprecated method "ImageSource->setWidth" is used that will be removed with kaleidoscope 8. Use "withWidth" instead!', LogEnvironment::fromMethodName(__METHOD__));
return $this->withWidth($targetWidth, $preserveAspect);
}

Expand All @@ -98,6 +99,7 @@ public function withWidth(int $targetWidth, bool $preserveAspect = false): Image
*/
public function setHeight(int $targetHeight, bool $preserveAspect = false): ImageSourceInterface
{
$this->logger->warning('Deprecated method "ImageSource->setHeight" is used that will be removed with kaleidoscope 8. Use "withHeight" instead!', LogEnvironment::fromMethodName(__METHOD__));
return $this->withHeight($targetHeight, $preserveAspect);
}

Expand All @@ -114,6 +116,7 @@ public function withHeight(int $targetHeight, bool $preserveAspect = false): Ima
*/
public function setQuality(int $quality): ImageSourceInterface
{
$this->logger->warning('Deprecated method "ImageSource->setQuality" is used that will be removed with kaleidoscope 8. Use "withQuality" instead!', LogEnvironment::fromMethodName(__METHOD__));
return $this->withQuality($quality);
}

Expand All @@ -130,6 +133,7 @@ public function withQuality(int $quality): ImageSourceInterface
*/
public function setFormat(string $format): ImageSourceInterface
{
$this->logger->warning('Deprecated method "ImageSource->setFormat" is used that will be removed with kaleidoscope 8. Use "withFormat" instead!', LogEnvironment::fromMethodName(__METHOD__));
return $this->withFormat($format);
}

Expand All @@ -146,6 +150,7 @@ public function withFormat(string $format): ImageSourceInterface
*/
public function setDimensions(int $targetWidth, int $targetHeight): ImageSourceInterface
{
$this->logger->warning('Deprecated method "ImageSource->setDimensions" is used that will be removed with kaleidoscope 8. Use "withDimensions" instead!', LogEnvironment::fromMethodName(__METHOD__));
return $this->withDimensions($targetWidth, $targetHeight);
}

Expand All @@ -163,6 +168,7 @@ public function withDimensions(int $targetWidth, int $targetHeight): ImageSource
*/
public function applyPreset(string $name): ImageSourceInterface
{
$this->logger->warning('Deprecated method "ImageSource->applyPreset" is used that will be removed with kaleidoscope 8. Use "withThumbnailPreset" instead!', LogEnvironment::fromMethodName(__METHOD__));
return $this->withThumbnailPreset($name);
}

Expand All @@ -171,6 +177,7 @@ public function applyPreset(string $name): ImageSourceInterface
*/
public function applyThumbnailPreset(string $name): ImageSourceInterface
{
$this->logger->warning('Deprecated method "ImageSource->applyThumbnailPreset" is used that will be removed with kaleidoscope 8. Use "withThumbnailPreset" instead!', LogEnvironment::fromMethodName(__METHOD__));
return $this->withThumbnailPreset($name);
}

Expand Down Expand Up @@ -201,6 +208,7 @@ public function withThumbnailPreset(string $name): ImageSourceInterface
*/
public function useVariantPreset(string $presetIdentifier, string $presetVariantName): ImageSourceInterface
{
$this->logger->warning('Deprecated method "ImageSource->useVariantPreset" is used that will be removed with kaleidoscope 8. Use "withVariantPreset" instead!', LogEnvironment::fromMethodName(__METHOD__));
return $this->withVariantPreset($presetIdentifier, $presetVariantName);
}

Expand Down Expand Up @@ -233,6 +241,7 @@ public function srcset($mediaDescriptors): string
*/
public function setTitle(?string $title): void
{
$this->logger->warning('Deprecated method "ImageSource->setTitle" is used that will be removed with kaleidoscope 8. Use "withTitle" instead!', LogEnvironment::fromMethodName(__METHOD__));
$this->title = $title;
}

Expand All @@ -249,6 +258,7 @@ public function withTitle(?string $title): ImageSourceInterface
*/
public function setAlt(?string $alt): void
{
$this->logger->warning('Deprecated method "ImageSource->setAlt" is used that will be removed with kaleidoscope 8. Use "withAlt" instead!', LogEnvironment::fromMethodName(__METHOD__));
$this->alt = $alt;
}

Expand Down

0 comments on commit 9c69045

Please sign in to comment.