Update on null args
Some checks are pending
CI / PHPUnit (highest, 5.4) (push) Waiting to run
CI / PHPUnit (highest, 5.5) (push) Waiting to run
CI / PHPUnit (highest, 5.6) (push) Waiting to run
CI / PHPUnit (highest, 7.0) (push) Waiting to run
CI / PHPUnit (highest, 7.1) (push) Waiting to run
CI / PHPUnit (highest, 7.2) (push) Waiting to run
CI / PHPUnit (highest, 7.3) (push) Waiting to run
CI / PHPUnit (highest, 7.4) (push) Waiting to run
CI / PHPUnit (lowest, 5.4) (push) Waiting to run
Some checks are pending
CI / PHPUnit (highest, 5.4) (push) Waiting to run
CI / PHPUnit (highest, 5.5) (push) Waiting to run
CI / PHPUnit (highest, 5.6) (push) Waiting to run
CI / PHPUnit (highest, 7.0) (push) Waiting to run
CI / PHPUnit (highest, 7.1) (push) Waiting to run
CI / PHPUnit (highest, 7.2) (push) Waiting to run
CI / PHPUnit (highest, 7.3) (push) Waiting to run
CI / PHPUnit (highest, 7.4) (push) Waiting to run
CI / PHPUnit (lowest, 5.4) (push) Waiting to run
This commit is contained in:
parent
e70d9d7a96
commit
11a39c8e46
@ -63,7 +63,12 @@ class App {
|
|||||||
* @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you.
|
* @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you.
|
||||||
* @param array $context
|
* @param array $context
|
||||||
*/
|
*/
|
||||||
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null, $context = array()) {
|
public function __construct(?string $httpHost = null, ?int $port = null, ?string $address = null, ?LoopInterface $loop = null, ?array $context = null) {
|
||||||
|
if ($httpHost == null) $httpHost = 'localhost';
|
||||||
|
if ($port == null) $port = 80;
|
||||||
|
if ($address == null) $address = '127.0.0.1';
|
||||||
|
if ($context == null) $context = array();
|
||||||
|
|
||||||
if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) {
|
if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) {
|
||||||
trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING);
|
trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,5 @@ interface HttpServerInterface extends MessageComponentInterface {
|
|||||||
* @param \Psr\Http\Message\RequestInterface $request null is default because PHP won't let me overload; don't pass null!!!
|
* @param \Psr\Http\Message\RequestInterface $request null is default because PHP won't let me overload; don't pass null!!!
|
||||||
* @throws \UnexpectedValueException if a RequestInterface is not passed
|
* @throws \UnexpectedValueException if a RequestInterface is not passed
|
||||||
*/
|
*/
|
||||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null);
|
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ use Ratchet\ConnectionInterface;
|
|||||||
use Psr\Http\Message\RequestInterface;
|
use Psr\Http\Message\RequestInterface;
|
||||||
|
|
||||||
class NoOpHttpServerController implements HttpServerInterface {
|
class NoOpHttpServerController implements HttpServerInterface {
|
||||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
|
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function onMessage(ConnectionInterface $from, $msg) {
|
public function onMessage(ConnectionInterface $from, $msg) {
|
||||||
|
@ -31,7 +31,7 @@ class OriginCheck implements HttpServerInterface {
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
|
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) {
|
||||||
$header = (string)$request->getHeader('Origin')[0];
|
$header = (string)$request->getHeader('Origin')[0];
|
||||||
$origin = parse_url($header, PHP_URL_HOST) ?: $header;
|
$origin = parse_url($header, PHP_URL_HOST) ?: $header;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class Router implements HttpServerInterface {
|
|||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
* @throws \UnexpectedValueException If a controller is not \Ratchet\Http\HttpServerInterface
|
* @throws \UnexpectedValueException If a controller is not \Ratchet\Http\HttpServerInterface
|
||||||
*/
|
*/
|
||||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
|
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) {
|
||||||
if (null === $request) {
|
if (null === $request) {
|
||||||
throw new \UnexpectedValueException('$request can not be null');
|
throw new \UnexpectedValueException('$request can not be null');
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,9 @@ class SessionProvider implements HttpServerInterface {
|
|||||||
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer
|
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, array $options = array(), HandlerInterface $serializer = null) {
|
public function __construct(HttpServerInterface $app, \SessionHandlerInterface $handler, ?array $options = null, ?HandlerInterface $serializer = null) {
|
||||||
|
if ($options == null) $options = array();
|
||||||
|
|
||||||
$this->_app = $app;
|
$this->_app = $app;
|
||||||
$this->_handler = $handler;
|
$this->_handler = $handler;
|
||||||
$this->_null = new NullSessionHandler;
|
$this->_null = new NullSessionHandler;
|
||||||
@ -70,7 +72,7 @@ class SessionProvider implements HttpServerInterface {
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
|
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) {
|
||||||
$sessionName = ini_get('session.name');
|
$sessionName = ini_get('session.name');
|
||||||
|
|
||||||
$id = array_reduce($request->getHeader('Cookie'), function($accumulator, $cookie) use ($sessionName) {
|
$id = array_reduce($request->getHeader('Cookie'), function($accumulator, $cookie) use ($sessionName) {
|
||||||
|
@ -104,7 +104,7 @@ class WsServer implements HttpServerInterface {
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function onOpen(ConnectionInterface $conn, RequestInterface $request = null) {
|
public function onOpen(ConnectionInterface $conn, ?RequestInterface $request = null) {
|
||||||
if (null === $request) {
|
if (null === $request) {
|
||||||
throw new \UnexpectedValueException('$request can not be null');
|
throw new \UnexpectedValueException('$request can not be null');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user