@@ -51,7 +51,7 @@ public function __construct(callable $source, array $options = [])
5151 $ this ->buffer = new BufferStream ();
5252 }
5353
54- public function __toString ()
54+ public function __toString (): string
5555 {
5656 try {
5757 return copy_to_string ($ this );
@@ -60,7 +60,7 @@ public function __toString()
6060 }
6161 }
6262
63- public function close ()
63+ public function close (): void
6464 {
6565 $ this ->detach ();
6666 }
@@ -71,52 +71,52 @@ public function detach()
7171 $ this ->source = null ;
7272 }
7373
74- public function getSize ()
74+ public function getSize (): ? int
7575 {
7676 return $ this ->size ;
7777 }
7878
79- public function tell ()
79+ public function tell (): int
8080 {
8181 return $ this ->tellPos ;
8282 }
8383
84- public function eof ()
84+ public function eof (): bool
8585 {
8686 return !$ this ->source ;
8787 }
8888
89- public function isSeekable ()
89+ public function isSeekable (): bool
9090 {
9191 return false ;
9292 }
9393
94- public function rewind ()
94+ public function rewind (): void
9595 {
9696 $ this ->seek (0 );
9797 }
9898
99- public function seek ($ offset , $ whence = SEEK_SET )
99+ public function seek (int $ offset , int $ whence = SEEK_SET ): void
100100 {
101101 throw new \RuntimeException ('Cannot seek a PumpStream ' );
102102 }
103103
104- public function isWritable ()
104+ public function isWritable (): bool
105105 {
106106 return false ;
107107 }
108108
109- public function write ($ string )
109+ public function write (string $ string ): int
110110 {
111111 throw new \RuntimeException ('Cannot write to a PumpStream ' );
112112 }
113113
114- public function isReadable ()
114+ public function isReadable (): bool
115115 {
116116 return true ;
117117 }
118118
119- public function read ($ length )
119+ public function read (int $ length ): string
120120 {
121121 $ data = $ this ->buffer ->read ($ length );
122122 $ readLen = strlen ($ data );
@@ -132,7 +132,7 @@ public function read($length)
132132 return $ data ;
133133 }
134134
135- public function getContents ()
135+ public function getContents (): string
136136 {
137137 $ result = '' ;
138138 while (!$ this ->eof ()) {
@@ -142,13 +142,13 @@ public function getContents()
142142 return $ result ;
143143 }
144144
145- public function getMetadata ($ key = null )
145+ public function getMetadata (? string $ key = null )
146146 {
147147 if (!$ key ) {
148148 return $ this ->metadata ;
149149 }
150150
151- return isset ( $ this ->metadata [$ key ]) ? $ this -> metadata [ $ key ] : null ;
151+ return $ this ->metadata [$ key ] ?? null ;
152152 }
153153
154154 private function pump ($ length )
0 commit comments