8
8
use Phplrt \Contracts \Source \ReadableInterface ;
9
9
use Phplrt \Contracts \Source \SourceExceptionInterface ;
10
10
use Phplrt \Contracts \Source \SourceFactoryInterface ;
11
- use Psr \Http \Message \StreamInterface ;
12
11
13
12
trait SourceFactoryTrait
14
13
{
@@ -37,10 +36,6 @@ public static function getSourceFactory(): SourceFactoryInterface
37
36
*/
38
37
public static function new (mixed $ source ): ReadableInterface
39
38
{
40
- if ($ source instanceof StreamInterface) {
41
- return static ::fromPsrStream ($ source );
42
- }
43
-
44
39
$ factory = self ::getSourceFactory ();
45
40
46
41
return $ factory ->create ($ source );
@@ -51,7 +46,6 @@ public static function new(mixed $source): ReadableInterface
51
46
* @param non-empty-string|null $pathname
52
47
*
53
48
* @return ($pathname is null ? ReadableInterface : FileInterface)
54
- * @throws SourceExceptionInterface
55
49
*/
56
50
public static function empty (?string $ pathname = null ): ReadableInterface
57
51
{
@@ -63,7 +57,6 @@ public static function empty(?string $pathname = null): ReadableInterface
63
57
* @param non-empty-string|null $pathname
64
58
*
65
59
* @return ($pathname is null ? ReadableInterface : FileInterface)
66
- * @throws SourceExceptionInterface
67
60
*/
68
61
public static function fromSources (string $ sources , ?string $ pathname = null ): ReadableInterface
69
62
{
@@ -104,24 +97,6 @@ public static function fromPathname(string $pathname): FileInterface
104
97
return new File ($ pathname );
105
98
}
106
99
107
- /**
108
- * @param non-empty-string|null $pathname
109
- *
110
- * @return ($pathname is null ? ReadableInterface : FileInterface)
111
- * @throws SourceExceptionInterface
112
- *
113
- * @deprecated since phplrt 3.4 and will be removed in 4.0, use {@see fromResource()} instead.
114
- */
115
- public static function fromPsrStream (StreamInterface $ stream , ?string $ pathname = null ): ReadableInterface
116
- {
117
- trigger_deprecation ('phplrt/source ' , '3.4 ' , <<<'MSG'
118
- Using "%s::fromPsrStream($stream)" with %s argument is deprecated,
119
- use "%1$s::fromResource($stream->detach())" instead.
120
- MSG, static ::class, \get_class ($ stream ));
121
-
122
- return static ::fromResource ($ stream ->detach (), $ pathname );
123
- }
124
-
125
100
/**
126
101
* @param resource $resource
127
102
* @param non-empty-string|null $pathname
0 commit comments