Skip to content

Commit 43a7704

Browse files
VincentLangletfabpot
authored andcommitted
Use Stringable interface as much as possible
1 parent 4c1d953 commit 43a7704

File tree

13 files changed

+13
-21
lines changed

13 files changed

+13
-21
lines changed

src/Symfony/Component/Config/Resource/ResourceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Fabien Potencier <[email protected]>
1818
*/
19-
interface ResourceInterface
19+
interface ResourceInterface extends \Stringable
2020
{
2121
/**
2222
* Returns a string representation of the Resource.

src/Symfony/Component/CssSelector/Node/NodeInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@
2121
*
2222
* @internal
2323
*/
24-
interface NodeInterface
24+
interface NodeInterface extends \Stringable
2525
{
2626
public function getNodeName(): string;
2727

2828
public function getSpecificity(): Specificity;
29-
30-
public function __toString(): string;
3129
}

src/Symfony/Component/Form/FormErrorIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* @implements \RecursiveIterator<int, T>
3636
* @implements \SeekableIterator<int, T>
3737
*/
38-
class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \ArrayAccess, \Countable
38+
class FormErrorIterator implements \RecursiveIterator, \SeekableIterator, \ArrayAccess, \Countable, \Stringable
3939
{
4040
/**
4141
* The prefix used for indenting nested error messages.

src/Symfony/Component/HttpFoundation/HeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @implements \IteratorAggregate<string, list<string|null>>
2020
*/
21-
class HeaderBag implements \IteratorAggregate, \Countable
21+
class HeaderBag implements \IteratorAggregate, \Countable, \Stringable
2222
{
2323
protected const UPPER = '_ABCDEFGHIJKLMNOPQRSTUVWXYZ';
2424
protected const LOWER = '-abcdefghijklmnopqrstuvwxyz';

src/Symfony/Component/Mailer/Transport/TransportInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424
*
2525
* @author Fabien Potencier <[email protected]>
2626
*/
27-
interface TransportInterface
27+
interface TransportInterface extends \Stringable
2828
{
2929
/**
3030
* @throws TransportExceptionInterface
3131
*/
3232
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage;
33-
34-
public function __toString(): string;
3533
}

src/Symfony/Component/Notifier/Transport/TransportInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
/**
1919
* @author Fabien Potencier <[email protected]>
2020
*/
21-
interface TransportInterface
21+
interface TransportInterface extends \Stringable
2222
{
2323
/**
2424
* @throws TransportExceptionInterface
2525
*/
2626
public function send(MessageInterface $message): ?SentMessage;
2727

2828
public function supports(MessageInterface $message): bool;
29-
30-
public function __toString(): string;
3129
}

src/Symfony/Component/PropertyAccess/PropertyPathInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @extends \Traversable<int, string>
2222
*/
23-
interface PropertyPathInterface extends \Traversable
23+
interface PropertyPathInterface extends \Traversable, \Stringable
2424
{
2525
/**
2626
* Returns the string representation of the property path.

src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @author Fabien Potencier <[email protected]>
2020
* @author Johannes M. Schmitt <[email protected]>
2121
*/
22-
interface TokenInterface
22+
interface TokenInterface extends \Stringable
2323
{
2424
/**
2525
* Returns a string representation of the Token.

src/Symfony/Component/Security/Core/User/InMemoryUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
* @author Robin Chalas <[email protected]>
2020
* @author Fabien Potencier <[email protected]>
2121
*/
22-
final class InMemoryUser implements UserInterface, PasswordAuthenticatedUserInterface, EquatableInterface
22+
final class InMemoryUser implements UserInterface, PasswordAuthenticatedUserInterface, EquatableInterface, \Stringable
2323
{
2424
private string $username;
2525
private ?string $password;

src/Symfony/Component/Templating/TemplateReferenceInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Victor Berchet <[email protected]>
1818
*/
19-
interface TemplateReferenceInterface
19+
interface TemplateReferenceInterface extends \Stringable
2020
{
2121
/**
2222
* Gets the template parameters.

src/Symfony/Component/Translation/Provider/ProviderInterface.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@
1414
use Symfony\Component\Translation\TranslatorBag;
1515
use Symfony\Component\Translation\TranslatorBagInterface;
1616

17-
interface ProviderInterface
17+
interface ProviderInterface extends \Stringable
1818
{
19-
public function __toString(): string;
20-
2119
/**
2220
* Translations available in the TranslatorBag only must be created.
2321
* Translations available in both the TranslatorBag and on the provider

src/Symfony/Component/Uid/AbstractUid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* @author Nicolas Grekas <[email protected]>
1616
*/
17-
abstract class AbstractUid implements \JsonSerializable
17+
abstract class AbstractUid implements \JsonSerializable, \Stringable
1818
{
1919
/**
2020
* The identifier in its canonic representation.

src/Symfony/Component/VarDumper/Cloner/Data.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* @author Nicolas Grekas <[email protected]>
1919
*/
20-
class Data implements \ArrayAccess, \Countable, \IteratorAggregate
20+
class Data implements \ArrayAccess, \Countable, \IteratorAggregate, \Stringable
2121
{
2222
private array $data;
2323
private int $position = 0;

0 commit comments

Comments
 (0)