Skip to content

Commit 0bfa3f3

Browse files
authored
[TASK] Deprecate __toString() (#1006)
Part of #998
1 parent 215c199 commit 0bfa3f3

25 files changed

+88
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Please also have a look at our
3232

3333
### Deprecated
3434

35+
- Deprecate `__toString()` (#1006)
3536
- `OutputFormat` properties for space around list separators as an array (#880)
3637

3738
### Removed

src/CSSList/AtRuleBlockList.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public function atRuleArgs(): string
4242
return $this->arguments;
4343
}
4444

45+
/**
46+
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
47+
*/
4548
public function __toString(): string
4649
{
4750
return $this->render(new OutputFormat());

src/CSSList/CSSList.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,9 @@ public function removeDeclarationBlockBySelector($selectors, $removeAll = false)
402402
}
403403
}
404404

405+
/**
406+
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
407+
*/
405408
public function __toString(): string
406409
{
407410
return $this->render(new OutputFormat());

src/CSSList/KeyFrame.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public function getAnimationName()
5151
return $this->animationName;
5252
}
5353

54+
/**
55+
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
56+
*/
5457
public function __toString(): string
5558
{
5659
return $this->render(new OutputFormat());

src/Comment/Comment.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public function setComment(string $commentText): void
5050
$this->commentText = $commentText;
5151
}
5252

53+
/**
54+
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
55+
*/
5356
public function __toString(): string
5457
{
5558
return $this->render(new OutputFormat());

src/OutputFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function safely(callable $callable): ?string
159159
}
160160

161161
/**
162-
* Clone of the `implode` function, but calls `render` with the current output format instead of `__toString()`.
162+
* Clone of the `implode` function, but calls `render` with the current output format.
163163
*
164164
* @param array<array-key, Renderable|string> $values
165165
*/

src/Property/CSSNamespace.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ public function getLineNo(): int
5454
return $this->lineNumber;
5555
}
5656

57+
/**
58+
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
59+
*/
5760
public function __toString(): string
5861
{
5962
return $this->render(new OutputFormat());

src/Property/Charset.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public function getCharset()
7171
return $this->charset->getString();
7272
}
7373

74+
/**
75+
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
76+
*/
7477
public function __toString(): string
7578
{
7679
return $this->render(new OutputFormat());

src/Property/Import.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ public function getLocation()
7272
return $this->location;
7373
}
7474

75+
/**
76+
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
77+
*/
7578
public function __toString(): string
7679
{
7780
return $this->render(new OutputFormat());

src/Property/Selector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ public function setSelector($selector): void
113113
$this->specificity = null;
114114
}
115115

116+
/**
117+
* @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
118+
*/
116119
public function __toString(): string
117120
{
118121
return $this->getSelector();

0 commit comments

Comments
 (0)