Skip to content

Commit a3fc3f2

Browse files
authored
explicitly declare \Stringable interface (#47697)
according to the [PHP docs](https://www.php.net/manual/en/class.stringable.php): > Stringable is implicitly present on any class that has the magic __toString() method defined, although it can and should be declared explicitly. The return types of the `__toString()` methods are inconsistent, but I skipped addressing that now, because I'm not exactly clear on how we're handling that in the framework.
1 parent 745d813 commit a3fc3f2

30 files changed

+63
-30
lines changed

src/Illuminate/Auth/Access/Response.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
namespace Illuminate\Auth\Access;
44

55
use Illuminate\Contracts\Support\Arrayable;
6+
use Stringable;
67

7-
class Response implements Arrayable
8+
class Response implements Arrayable, Stringable
89
{
910
/**
1011
* Indicates whether the response was allowed.

src/Illuminate/Broadcasting/Channel.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
namespace Illuminate\Broadcasting;
44

55
use Illuminate\Contracts\Broadcasting\HasBroadcastChannel;
6+
use Stringable;
67

7-
class Channel
8+
class Channel implements Stringable
89
{
910
/**
1011
* The channel's name.

src/Illuminate/Database/Eloquent/Model.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
use Illuminate\Support\Traits\ForwardsCalls;
2323
use JsonSerializable;
2424
use LogicException;
25+
use Stringable;
2526

26-
abstract class Model implements Arrayable, ArrayAccess, CanBeEscapedWhenCastToString, HasBroadcastChannel, Jsonable, JsonSerializable, QueueableEntity, UrlRoutable
27+
abstract class Model implements Arrayable, ArrayAccess, CanBeEscapedWhenCastToString, HasBroadcastChannel, Jsonable, JsonSerializable, QueueableEntity, Stringable, UrlRoutable
2728
{
2829
use Concerns\HasAttributes,
2930
Concerns\HasEvents,

src/Illuminate/Http/Client/Response.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
use Illuminate\Support\Collection;
77
use Illuminate\Support\Traits\Macroable;
88
use LogicException;
9+
use Stringable;
910

10-
class Response implements ArrayAccess
11+
class Response implements ArrayAccess, Stringable
1112
{
1213
use Concerns\DeterminesStatusCode, Macroable {
1314
__call as macroCall;

src/Illuminate/Mail/Transport/ArrayTransport.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
namespace Illuminate\Mail\Transport;
44

55
use Illuminate\Support\Collection;
6+
use Stringable;
67
use Symfony\Component\Mailer\Envelope;
78
use Symfony\Component\Mailer\SentMessage;
89
use Symfony\Component\Mailer\Transport\TransportInterface;
910
use Symfony\Component\Mime\RawMessage;
1011

11-
class ArrayTransport implements TransportInterface
12+
class ArrayTransport implements Stringable, TransportInterface
1213
{
1314
/**
1415
* The collection of Symfony Messages.

src/Illuminate/Mail/Transport/LogTransport.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
namespace Illuminate\Mail\Transport;
44

55
use Psr\Log\LoggerInterface;
6+
use Stringable;
67
use Symfony\Component\Mailer\Envelope;
78
use Symfony\Component\Mailer\SentMessage;
89
use Symfony\Component\Mailer\Transport\TransportInterface;
910
use Symfony\Component\Mime\RawMessage;
1011

11-
class LogTransport implements TransportInterface
12+
class LogTransport implements Stringable, TransportInterface
1213
{
1314
/**
1415
* The Logger instance.

src/Illuminate/Mail/Transport/SesTransport.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
use Aws\Exception\AwsException;
66
use Aws\Ses\SesClient;
77
use Exception;
8+
use Stringable;
89
use Symfony\Component\Mailer\Header\MetadataHeader;
910
use Symfony\Component\Mailer\SentMessage;
1011
use Symfony\Component\Mailer\Transport\AbstractTransport;
1112
use Symfony\Component\Mime\Message;
1213

13-
class SesTransport extends AbstractTransport
14+
class SesTransport extends AbstractTransport implements Stringable
1415
{
1516
/**
1617
* The Amazon SES instance.

src/Illuminate/Mail/Transport/SesV2Transport.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
use Aws\Exception\AwsException;
66
use Aws\SesV2\SesV2Client;
77
use Exception;
8+
use Stringable;
89
use Symfony\Component\Mailer\Header\MetadataHeader;
910
use Symfony\Component\Mailer\SentMessage;
1011
use Symfony\Component\Mailer\Transport\AbstractTransport;
1112
use Symfony\Component\Mime\Message;
1213

13-
class SesV2Transport extends AbstractTransport
14+
class SesV2Transport extends AbstractTransport implements Stringable
1415
{
1516
/**
1617
* The Amazon SES V2 instance.

src/Illuminate/Pagination/AbstractCursorPaginator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
use Illuminate\Support\Str;
1515
use Illuminate\Support\Traits\ForwardsCalls;
1616
use Illuminate\Support\Traits\Tappable;
17+
use Stringable;
1718
use Traversable;
1819

1920
/**
2021
* @mixin \Illuminate\Support\Collection
2122
*/
22-
abstract class AbstractCursorPaginator implements Htmlable
23+
abstract class AbstractCursorPaginator implements Htmlable, Stringable
2324
{
2425
use ForwardsCalls, Tappable;
2526

src/Illuminate/Pagination/AbstractPaginator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
use Illuminate\Support\Collection;
99
use Illuminate\Support\Traits\ForwardsCalls;
1010
use Illuminate\Support\Traits\Tappable;
11+
use Stringable;
1112
use Traversable;
1213

1314
/**
1415
* @mixin \Illuminate\Support\Collection
1516
*/
16-
abstract class AbstractPaginator implements Htmlable
17+
abstract class AbstractPaginator implements Htmlable, Stringable
1718
{
1819
use ForwardsCalls, Tappable;
1920

0 commit comments

Comments
 (0)