Skip to content

Commit

Permalink
修复几处 $uri 类型判断的兼容问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurunsoft committed Feb 8, 2021
1 parent b1e1d70 commit 8d2f02b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/YurunHttp/ConnectionPool.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace Yurun\Util\YurunHttp;

use Psr\Http\Message\UriInterface;
use Yurun\Util\YurunHttp\Http\Psr7\Uri;
use Yurun\Util\YurunHttp\Pool\Config\PoolConfig;
use Yurun\Util\YurunHttp\Handler\Contract\IConnectionManager;
Expand Down Expand Up @@ -126,12 +127,12 @@ public static function getConfig($url)
/**
* 获取键
*
* @param string|Uri $url
* @param string|UriInterface $url
* @return void
*/
public static function getKey($url)
{
if($url instanceof Uri)
if($url instanceof UriInterface)
{
return $url->getScheme() . '://' . Uri::getDomain($url);
}
Expand Down
4 changes: 2 additions & 2 deletions src/YurunHttp/Http/Psr7/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Request extends AbstractMessage implements RequestInterface

/**
* 构造方法
* @param string|\Yurun\Util\YurunHttp\Http\Psr7\Uri $url
* @param string|UriInterface $url
* @param array $headers
* @param string $body
* @param string $method
Expand All @@ -37,7 +37,7 @@ class Request extends AbstractMessage implements RequestInterface
public function __construct($uri = null, array $headers = [], $body = '', $method = RequestMethod::GET, $version = '1.1')
{
parent::__construct($body);
if(! $uri instanceof Uri)
if(! $uri instanceof UriInterface)
{
$this->uri = new Uri($uri);
}
Expand Down
5 changes: 3 additions & 2 deletions src/YurunHttp/Stream/FileStream.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<?php
namespace Yurun\Util\YurunHttp\Stream;

use Psr\Http\Message\UriInterface;
use Psr\Http\Message\StreamInterface;
use Yurun\Util\YurunHttp\Http\Psr7\Uri;

class FileStream implements StreamInterface
{
/**
* 文件Uri
* @var \Yurun\Util\YurunHttp\Http\Psr7\Uri
* @var UriInterface
*/
protected $uri;

Expand All @@ -30,7 +31,7 @@ public function __construct($uri, $mode = StreamMode::READ_WRITE)
{
$this->uri = $uri = new Uri($uri);
}
else if($uri instanceof Uri)
else if($uri instanceof UriInterface)
{
$this->uri = $uri;
}
Expand Down

0 comments on commit 8d2f02b

Please sign in to comment.