v1.1.4
This commit is contained in:
parent
d6e6011c3d
commit
1dd5809016
1 changed files with 21760 additions and 3778 deletions
51
vendor/guzzlehttp/psr7/src/FnStream.php
vendored
51
vendor/guzzlehttp/psr7/src/FnStream.php
vendored
|
|
@ -7,7 +7,7 @@ namespace GuzzleHttp\Psr7;
|
|||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
/**
|
||||
* Compose stream implementations based on a hash of functions.
|
||||
* Compose stream implementations based on a hash of callables.
|
||||
*
|
||||
* Allows for easy testing and extension of a provided stream without needing
|
||||
* to create a concrete class for a simple extension point.
|
||||
|
|
@ -31,7 +31,7 @@ final class FnStream implements StreamInterface
|
|||
{
|
||||
$this->methods = $methods;
|
||||
|
||||
// Create the functions on the class
|
||||
// Create the callables on the class
|
||||
foreach ($methods as $name => $fn) {
|
||||
$this->{'_fn_'.$name} = $fn;
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ final class FnStream implements StreamInterface
|
|||
* specific method calls.
|
||||
*
|
||||
* @param StreamInterface $stream Stream to decorate
|
||||
* @param array<string, callable> $methods Hash of method name to a closure
|
||||
* @param array<string, callable> $methods Hash of method name to a callable
|
||||
*
|
||||
* @return FnStream
|
||||
*/
|
||||
|
|
@ -142,6 +142,24 @@ final class FnStream implements StreamInterface
|
|||
|
||||
public function seek($offset, $whence = SEEK_SET): void
|
||||
{
|
||||
if (!\is_int($offset)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $offset.',
|
||||
\get_debug_type($offset)
|
||||
);
|
||||
}
|
||||
|
||||
if (!\is_int($whence)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::seek() is deprecated; guzzlehttp/psr7 3.0 requires int for $whence.',
|
||||
\get_debug_type($whence)
|
||||
);
|
||||
}
|
||||
|
||||
($this->_fn_seek)($offset, $whence);
|
||||
}
|
||||
|
||||
|
|
@ -152,6 +170,15 @@ final class FnStream implements StreamInterface
|
|||
|
||||
public function write($string): int
|
||||
{
|
||||
if (!\is_string($string)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::write() is deprecated; guzzlehttp/psr7 3.0 requires string for $string.',
|
||||
\get_debug_type($string)
|
||||
);
|
||||
}
|
||||
|
||||
return ($this->_fn_write)($string);
|
||||
}
|
||||
|
||||
|
|
@ -162,6 +189,15 @@ final class FnStream implements StreamInterface
|
|||
|
||||
public function read($length): string
|
||||
{
|
||||
if (!\is_int($length)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::read() is deprecated; guzzlehttp/psr7 3.0 requires int for $length.',
|
||||
\get_debug_type($length)
|
||||
);
|
||||
}
|
||||
|
||||
return ($this->_fn_read)($length);
|
||||
}
|
||||
|
||||
|
|
@ -175,6 +211,15 @@ final class FnStream implements StreamInterface
|
|||
*/
|
||||
public function getMetadata($key = null)
|
||||
{
|
||||
if ($key !== null && !\is_string($key)) {
|
||||
\trigger_deprecation(
|
||||
'guzzlehttp/psr7',
|
||||
'2.11',
|
||||
'Passing %s to StreamInterface::getMetadata() is deprecated; guzzlehttp/psr7 3.0 requires string|null for $key.',
|
||||
\get_debug_type($key)
|
||||
);
|
||||
}
|
||||
|
||||
return ($this->_fn_getMetadata)($key);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue