Skip to content

Commit 9c69045

Browse files
authored
Merge pull request #79 from sitegeist/task/addDeprecationLogsForSetterInFavorOfWithers
TASK: Add deprecation logs for setters in favor of withers
2 parents ec1d163 + 88d1227 commit 9c69045

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Classes/Domain/AbstractImageSource.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function __construct(?string $title = null, ?string $alt = null)
8282
*/
8383
public function setWidth(int $targetWidth, bool $preserveAspect = false): ImageSourceInterface
8484
{
85+
$this->logger->warning('Deprecated method "ImageSource->setWidth" is used that will be removed with kaleidoscope 8. Use "withWidth" instead!', LogEnvironment::fromMethodName(__METHOD__));
8586
return $this->withWidth($targetWidth, $preserveAspect);
8687
}
8788

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)