pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/php-http/socket-client/pull/70/files

"all" rel="stylesheet" href="https://github.githubassets.com/assets/code-0eb15370f045c7e0.css" /> fix: Typehint the Stream class and fix deprecated interface HttpClient by tarekdj · Pull Request #70 · php-http/socket-client · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 2.1.2

* Fixed the type hinting of Stream class in order to make it compatible with StreamInterface
* Replaced the deprecated interface HttpClient

## 2.1.1

* Fixed constructor to work nicely with version 1 style arguments (e.g. HttplugBundle)
Expand Down
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Http\Client\Socket;

use Http\Client\HttpClient;
use Http\Client\Socket\Exception\ConnectionException;
use Http\Client\Socket\Exception\InvalidRequestException;
use Http\Client\Socket\Exception\SSLConnectionException;
use Http\Client\Socket\Exception\TimeoutException;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\ResponseInterface;
Expand All @@ -20,7 +20,7 @@
*
* @author Joel Wurtz <joel.wurtz@gmail.com>
*/
class Client implements HttpClient
class Client implements ClientInterface
{
use RequestWriter;
use ResponseReader;
Expand Down
26 changes: 13 additions & 13 deletions src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function __construct(RequestInterface $request, $socket, ?int $size = nul
/**
* {@inheritdoc}
*/
public function __toString()
public function __toString(): string
{
try {
return $this->getContents();
Expand All @@ -76,7 +76,7 @@ public function __toString()
/**
* {@inheritdoc}
*/
public function close()
public function close(): void
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');
Expand Down Expand Up @@ -104,15 +104,15 @@ public function detach()
*
* @return int<0, max>|null
*/
public function getSize()
public function getSize(): ?int
{
return $this->size;
}

/**
* {@inheritdoc}
*/
public function tell()
public function tell(): int
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');
Expand All @@ -128,7 +128,7 @@ public function tell()
/**
* {@inheritdoc}
*/
public function eof()
public function eof(): bool
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');
Expand All @@ -140,7 +140,7 @@ public function eof()
/**
* {@inheritdoc}
*/
public function isSeekable()
public function isSeekable(): bool
{
return false;
}
Expand All @@ -150,7 +150,7 @@ public function isSeekable()
*
* @return void
*/
public function seek($offset, $whence = SEEK_SET)
public function seek($offset, $whence = SEEK_SET): void
{
throw new StreamException('This stream is not seekable');
}
Expand All @@ -160,31 +160,31 @@ public function seek($offset, $whence = SEEK_SET)
*
* @return void
*/
public function rewind()
public function rewind(): void
{
throw new StreamException('This stream is not seekable');
}

/**
* {@inheritdoc}
*/
public function isWritable()
public function isWritable(): bool
{
return false;
}

/**
* {@inheritdoc}
*/
public function write($string)
public function write($string): int
{
throw new StreamException('This stream is not writable');
}

/**
* {@inheritdoc}
*/
public function isReadable()
public function isReadable(): bool
{
return true;
}
Expand All @@ -194,7 +194,7 @@ public function isReadable()
*
* @param int<0, max> $length
*/
public function read($length)
public function read($length): string
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');
Expand Down Expand Up @@ -235,7 +235,7 @@ public function read($length)
/**
* {@inheritdoc}
*/
public function getContents()
public function getContents(): string
{
if ($this->isDetached || null === $this->socket) {
throw new StreamException('Stream is detached');
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy