mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Updated Rector to commit 7d6b6ed95f9c6c4731a0915f9624ec342548de65
7d6b6ed95f
[AutoImport] Add new line for add use statement if next first stmt is not Use_ or GroupUse (#6194)
This commit is contained in:
parent
ea7301739d
commit
608879e768
@ -7,6 +7,7 @@ use RectorPrefix202407\Nette\Utils\Strings;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Stmt;
|
||||
use PhpParser\Node\Stmt\Declare_;
|
||||
use PhpParser\Node\Stmt\GroupUse;
|
||||
use PhpParser\Node\Stmt\Namespace_;
|
||||
use PhpParser\Node\Stmt\Nop;
|
||||
use PhpParser\Node\Stmt\Use_;
|
||||
@ -56,23 +57,28 @@ final class UseImportsAdder
|
||||
}
|
||||
// place after declare strict_types
|
||||
foreach ($stmts as $key => $stmt) {
|
||||
if ($stmt instanceof Declare_) {
|
||||
if (isset($stmts[$key + 1]) && $stmts[$key + 1] instanceof Use_) {
|
||||
$nodesToAdd = $newUses;
|
||||
} else {
|
||||
// add extra space, if there are no new use imports to be added
|
||||
$nodesToAdd = \array_merge([new Nop()], $newUses);
|
||||
}
|
||||
$this->mirrorUseComments($stmts, $newUses, $key + 1);
|
||||
\array_splice($stmts, $key + 1, 0, $nodesToAdd);
|
||||
$fileWithoutNamespace->stmts = $stmts;
|
||||
$fileWithoutNamespace->stmts = \array_values($fileWithoutNamespace->stmts);
|
||||
return [$fileWithoutNamespace];
|
||||
// maybe just added a space
|
||||
if ($stmt instanceof Nop) {
|
||||
continue;
|
||||
}
|
||||
// when we found a non-declare, directly stop
|
||||
if (!$stmt instanceof Declare_) {
|
||||
break;
|
||||
}
|
||||
$nodesToAdd = \array_merge([new Nop()], $newUses);
|
||||
$this->mirrorUseComments($stmts, $newUses, $key + 1);
|
||||
// remove space before next use tweak
|
||||
if (isset($stmts[$key + 1]) && ($stmts[$key + 1] instanceof Use_ || $stmts[$key + 1] instanceof GroupUse)) {
|
||||
$stmts[$key + 1]->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
}
|
||||
\array_splice($stmts, $key + 1, 0, $nodesToAdd);
|
||||
$fileWithoutNamespace->stmts = $stmts;
|
||||
$fileWithoutNamespace->stmts = \array_values($fileWithoutNamespace->stmts);
|
||||
return [$fileWithoutNamespace];
|
||||
}
|
||||
$this->mirrorUseComments($stmts, $newUses);
|
||||
// make use stmts first
|
||||
$fileWithoutNamespace->stmts = \array_merge($newUses, $stmts);
|
||||
$fileWithoutNamespace->stmts = \array_merge($newUses, $this->resolveInsertNop($fileWithoutNamespace), $stmts);
|
||||
$fileWithoutNamespace->stmts = \array_values($fileWithoutNamespace->stmts);
|
||||
return [$fileWithoutNamespace];
|
||||
}
|
||||
@ -97,9 +103,21 @@ final class UseImportsAdder
|
||||
return;
|
||||
}
|
||||
$this->mirrorUseComments($namespace->stmts, $newUses);
|
||||
$namespace->stmts = \array_merge($newUses, $namespace->stmts);
|
||||
$namespace->stmts = \array_merge($newUses, $this->resolveInsertNop($namespace), $namespace->stmts);
|
||||
$namespace->stmts = \array_values($namespace->stmts);
|
||||
}
|
||||
/**
|
||||
* @return Nop[]
|
||||
* @param \Rector\PhpParser\Node\CustomNode\FileWithoutNamespace|\PhpParser\Node\Stmt\Namespace_ $namespace
|
||||
*/
|
||||
private function resolveInsertNop($namespace) : array
|
||||
{
|
||||
$currentStmt = $namespace->stmts[0] ?? null;
|
||||
if (!$currentStmt instanceof Stmt || $currentStmt instanceof Use_ || $currentStmt instanceof GroupUse) {
|
||||
return [];
|
||||
}
|
||||
return [new Nop()];
|
||||
}
|
||||
/**
|
||||
* @param Stmt[] $stmts
|
||||
* @param Use_[] $newUses
|
||||
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'ac3d2f6bb311bfaddc484f2839119469a571b1a9';
|
||||
public const PACKAGE_VERSION = '7d6b6ed95f9c6c4731a0915f9624ec342548de65';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-07-26 10:32:17';
|
||||
public const RELEASE_DATE = '2024-07-27 09:36:17';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
68
vendor/composer/installed.json
vendored
68
vendor/composer/installed.json
vendored
@ -512,17 +512,17 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate\/container",
|
||||
"version": "v11.18.0",
|
||||
"version_normalized": "11.18.0.0",
|
||||
"version": "v11.18.1",
|
||||
"version_normalized": "11.18.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/illuminate\/container.git",
|
||||
"reference": "c3c2713c66d120bf42865e831cfcef6ed9e10db2"
|
||||
"reference": "122c62229b209678013c0833793d7cf94d14bbbd"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/illuminate\/container\/zipball\/c3c2713c66d120bf42865e831cfcef6ed9e10db2",
|
||||
"reference": "c3c2713c66d120bf42865e831cfcef6ed9e10db2",
|
||||
"url": "https:\/\/api.github.com\/repos\/illuminate\/container\/zipball\/122c62229b209678013c0833793d7cf94d14bbbd",
|
||||
"reference": "122c62229b209678013c0833793d7cf94d14bbbd",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -533,7 +533,7 @@
|
||||
"provide": {
|
||||
"psr\/container-implementation": "1.1|2.0"
|
||||
},
|
||||
"time": "2024-07-18T15:50:24+00:00",
|
||||
"time": "2024-07-26T06:12:27+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
@ -569,8 +569,8 @@
|
||||
},
|
||||
{
|
||||
"name": "illuminate\/contracts",
|
||||
"version": "v11.18.0",
|
||||
"version_normalized": "11.18.0.0",
|
||||
"version": "v11.18.1",
|
||||
"version_normalized": "11.18.1.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/illuminate\/contracts.git",
|
||||
@ -1466,34 +1466,34 @@
|
||||
},
|
||||
{
|
||||
"name": "react\/socket",
|
||||
"version": "v1.15.0",
|
||||
"version_normalized": "1.15.0.0",
|
||||
"version": "v1.16.0",
|
||||
"version_normalized": "1.16.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/reactphp\/socket.git",
|
||||
"reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038"
|
||||
"reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/reactphp\/socket\/zipball\/216d3aec0b87f04a40ca04f481e6af01bdd1d038",
|
||||
"reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038",
|
||||
"url": "https:\/\/api.github.com\/repos\/reactphp\/socket\/zipball\/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1",
|
||||
"reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"evenement\/evenement": "^3.0 || ^2.0 || ^1.0",
|
||||
"php": ">=5.3.0",
|
||||
"react\/dns": "^1.11",
|
||||
"react\/dns": "^1.13",
|
||||
"react\/event-loop": "^1.2",
|
||||
"react\/promise": "^3 || ^2.6 || ^1.2.1",
|
||||
"react\/stream": "^1.2"
|
||||
"react\/promise": "^3.2 || ^2.6 || ^1.2.1",
|
||||
"react\/stream": "^1.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.6 || ^5.7 || ^4.8.36",
|
||||
"react\/async": "^4 || ^3 || ^2",
|
||||
"react\/async": "^4.3 || ^3.3 || ^2",
|
||||
"react\/promise-stream": "^1.4",
|
||||
"react\/promise-timer": "^1.10"
|
||||
"react\/promise-timer": "^1.11"
|
||||
},
|
||||
"time": "2023-12-15T11:02:10+00:00",
|
||||
"time": "2024-07-26T10:38:09+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -1537,7 +1537,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https:\/\/github.com\/reactphp\/socket\/issues",
|
||||
"source": "https:\/\/github.com\/reactphp\/socket\/tree\/v1.15.0"
|
||||
"source": "https:\/\/github.com\/reactphp\/socket\/tree\/v1.16.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2007,17 +2007,17 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/console",
|
||||
"version": "v6.4.9",
|
||||
"version_normalized": "6.4.9.0",
|
||||
"version": "v6.4.10",
|
||||
"version_normalized": "6.4.10.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/console.git",
|
||||
"reference": "6edb5363ec0c78ad4d48c5128ebf4d083d89d3a9"
|
||||
"reference": "504974cbe43d05f83b201d6498c206f16fc0cdbc"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/6edb5363ec0c78ad4d48c5128ebf4d083d89d3a9",
|
||||
"reference": "6edb5363ec0c78ad4d48c5128ebf4d083d89d3a9",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/console\/zipball\/504974cbe43d05f83b201d6498c206f16fc0cdbc",
|
||||
"reference": "504974cbe43d05f83b201d6498c206f16fc0cdbc",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2050,7 +2050,7 @@
|
||||
"symfony\/stopwatch": "^5.4|^6.0|^7.0",
|
||||
"symfony\/var-dumper": "^5.4|^6.0|^7.0"
|
||||
},
|
||||
"time": "2024-06-28T09:49:33+00:00",
|
||||
"time": "2024-07-26T12:30:32+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"patches_applied": [
|
||||
@ -2089,7 +2089,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.4.9"
|
||||
"source": "https:\/\/github.com\/symfony\/console\/tree\/v6.4.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -2248,17 +2248,17 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony\/finder",
|
||||
"version": "v6.4.8",
|
||||
"version_normalized": "6.4.8.0",
|
||||
"version": "v6.4.10",
|
||||
"version_normalized": "6.4.10.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https:\/\/github.com\/symfony\/finder.git",
|
||||
"reference": "3ef977a43883215d560a2cecb82ec8e62131471c"
|
||||
"reference": "af29198d87112bebdd397bd7735fbd115997824c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/3ef977a43883215d560a2cecb82ec8e62131471c",
|
||||
"reference": "3ef977a43883215d560a2cecb82ec8e62131471c",
|
||||
"url": "https:\/\/api.github.com\/repos\/symfony\/finder\/zipball\/af29198d87112bebdd397bd7735fbd115997824c",
|
||||
"reference": "af29198d87112bebdd397bd7735fbd115997824c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2267,7 +2267,7 @@
|
||||
"require-dev": {
|
||||
"symfony\/filesystem": "^6.0|^7.0"
|
||||
},
|
||||
"time": "2024-05-31T14:49:08+00:00",
|
||||
"time": "2024-07-24T07:06:38+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
@ -2295,7 +2295,7 @@
|
||||
"description": "Finds files and directories via an intuitive fluent interface",
|
||||
"homepage": "https:\/\/symfony.com",
|
||||
"support": {
|
||||
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.4.8"
|
||||
"source": "https:\/\/github.com\/symfony\/finder\/tree\/v6.4.10"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
2
vendor/composer/installed.php
vendored
2
vendor/composer/installed.php
vendored
File diff suppressed because one or more lines are too long
7
vendor/illuminate/container/Container.php
vendored
7
vendor/illuminate/container/Container.php
vendored
@ -1159,8 +1159,11 @@ class Container implements ArrayAccess, ContainerContract
|
||||
protected function fireAfterResolvingAttributeCallbacks(array $attributes, $object)
|
||||
{
|
||||
foreach ($attributes as $attribute) {
|
||||
if (\method_exists($instance = $attribute->newInstance(), 'after')) {
|
||||
$instance->after($instance, $object, $this);
|
||||
if (\is_a($attribute->getName(), ContextualAttribute::class, \true)) {
|
||||
$instance = $attribute->newInstance();
|
||||
if (\method_exists($instance, 'after')) {
|
||||
$instance->after($instance, $object, $this);
|
||||
}
|
||||
}
|
||||
$callbacks = $this->getCallbacksForType($attribute->getName(), $object, $this->afterResolvingAttributeCallbacks);
|
||||
foreach ($callbacks as $callback) {
|
||||
|
5
vendor/react/socket/CHANGELOG.md
vendored
5
vendor/react/socket/CHANGELOG.md
vendored
@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## 1.16.0 (2024-07-26)
|
||||
|
||||
* Feature: Improve PHP 8.4+ support by avoiding implicitly nullable type declarations.
|
||||
(#318 by @clue)
|
||||
|
||||
## 1.15.0 (2023-12-15)
|
||||
|
||||
* Feature: Full PHP 8.3 compatibility.
|
||||
|
2
vendor/react/socket/README.md
vendored
2
vendor/react/socket/README.md
vendored
@ -1494,7 +1494,7 @@ This project follows [SemVer](https://semver.org/).
|
||||
This will install the latest supported version:
|
||||
|
||||
```bash
|
||||
composer require react/socket:^1.15
|
||||
composer require react/socket:^1.16
|
||||
```
|
||||
|
||||
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
|
||||
|
10
vendor/react/socket/composer.json
vendored
10
vendor/react/socket/composer.json
vendored
@ -34,16 +34,16 @@
|
||||
"require": {
|
||||
"php": ">=5.3.0",
|
||||
"evenement\/evenement": "^3.0 || ^2.0 || ^1.0",
|
||||
"react\/dns": "^1.11",
|
||||
"react\/dns": "^1.13",
|
||||
"react\/event-loop": "^1.2",
|
||||
"react\/promise": "^3 || ^2.6 || ^1.2.1",
|
||||
"react\/stream": "^1.2"
|
||||
"react\/promise": "^3.2 || ^2.6 || ^1.2.1",
|
||||
"react\/stream": "^1.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit\/phpunit": "^9.6 || ^5.7 || ^4.8.36",
|
||||
"react\/async": "^4 || ^3 || ^2",
|
||||
"react\/async": "^4.3 || ^3.3 || ^2",
|
||||
"react\/promise-stream": "^1.4",
|
||||
"react\/promise-timer": "^1.10"
|
||||
"react\/promise-timer": "^1.11"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
6
vendor/react/socket/src/FdServer.php
vendored
6
vendor/react/socket/src/FdServer.php
vendored
@ -73,7 +73,7 @@ final class FdServer extends EventEmitter implements ServerInterface
|
||||
* @throws \InvalidArgumentException if the listening address is invalid
|
||||
* @throws \RuntimeException if listening on this address fails (already in use etc.)
|
||||
*/
|
||||
public function __construct($fd, LoopInterface $loop = null)
|
||||
public function __construct($fd, $loop = null)
|
||||
{
|
||||
if (\preg_match('#^php://fd/(\\d+)$#', $fd, $m)) {
|
||||
$fd = (int) $m[1];
|
||||
@ -81,6 +81,10 @@ final class FdServer extends EventEmitter implements ServerInterface
|
||||
if (!\is_int($fd) || $fd < 0 || $fd >= \PHP_INT_MAX) {
|
||||
throw new \InvalidArgumentException('Invalid FD number given (EINVAL)', \defined('SOCKET_EINVAL') ? \SOCKET_EINVAL : (\defined('PCNTL_EINVAL') ? \PCNTL_EINVAL : 22));
|
||||
}
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #2 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
$this->loop = $loop ?: Loop::get();
|
||||
$errno = 0;
|
||||
$errstr = '';
|
||||
|
@ -11,15 +11,29 @@ final class HappyEyeBallsConnector implements ConnectorInterface
|
||||
private $loop;
|
||||
private $connector;
|
||||
private $resolver;
|
||||
public function __construct(LoopInterface $loop = null, ConnectorInterface $connector = null, ResolverInterface $resolver = null)
|
||||
/**
|
||||
* @param ?LoopInterface $loop
|
||||
* @param ConnectorInterface $connector
|
||||
* @param ResolverInterface $resolver
|
||||
*/
|
||||
public function __construct($loop = null, $connector = null, $resolver = null)
|
||||
{
|
||||
// $connector and $resolver arguments are actually required, marked
|
||||
// optional for technical reasons only. Nullable $loop without default
|
||||
// requires PHP 7.1, null default is also supported in legacy PHP
|
||||
// versions, but required parameters are not allowed after arguments
|
||||
// with null default. Mark all parameters optional and check accordingly.
|
||||
if ($connector === null || $resolver === null) {
|
||||
throw new \InvalidArgumentException('Missing required $connector or $resolver argument');
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #1 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
if (!$connector instanceof ConnectorInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #2 ($connector) expected React\\Socket\\ConnectorInterface');
|
||||
}
|
||||
if (!$resolver instanceof ResolverInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #3 ($resolver) expected React\\Dns\\Resolver\\ResolverInterface');
|
||||
}
|
||||
$this->loop = $loop ?: Loop::get();
|
||||
$this->connector = $connector;
|
||||
|
11
vendor/react/socket/src/SecureConnector.php
vendored
11
vendor/react/socket/src/SecureConnector.php
vendored
@ -13,8 +13,17 @@ final class SecureConnector implements ConnectorInterface
|
||||
private $connector;
|
||||
private $streamEncryption;
|
||||
private $context;
|
||||
public function __construct(ConnectorInterface $connector, LoopInterface $loop = null, array $context = array())
|
||||
/**
|
||||
* @param ConnectorInterface $connector
|
||||
* @param ?LoopInterface $loop
|
||||
* @param array $context
|
||||
*/
|
||||
public function __construct(ConnectorInterface $connector, $loop = null, array $context = array())
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #2 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
$this->connector = $connector;
|
||||
$this->streamEncryption = new StreamEncryption($loop ?: Loop::get(), \false);
|
||||
$this->context = $context;
|
||||
|
6
vendor/react/socket/src/SecureServer.php
vendored
6
vendor/react/socket/src/SecureServer.php
vendored
@ -120,8 +120,12 @@ final class SecureServer extends EventEmitter implements ServerInterface
|
||||
* @see TcpServer
|
||||
* @link https://www.php.net/manual/en/context.ssl.php for TLS context options
|
||||
*/
|
||||
public function __construct(ServerInterface $tcp, LoopInterface $loop = null, array $context = array())
|
||||
public function __construct(ServerInterface $tcp, $loop = null, array $context = array())
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #2 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
if (!\function_exists('stream_socket_enable_crypto')) {
|
||||
throw new \BadMethodCallException('Encryption not supported on your platform (HHVM < 3.8?)');
|
||||
// @codeCoverageIgnore
|
||||
|
12
vendor/react/socket/src/Server.php
vendored
12
vendor/react/socket/src/Server.php
vendored
@ -41,14 +41,18 @@ final class Server extends EventEmitter implements ServerInterface
|
||||
* For BC reasons, you can also pass the TCP socket context options as a simple
|
||||
* array without wrapping this in another array under the `tcp` key.
|
||||
*
|
||||
* @param string|int $uri
|
||||
* @param LoopInterface $loop
|
||||
* @param array $context
|
||||
* @param string|int $uri
|
||||
* @param ?LoopInterface $loop
|
||||
* @param array $context
|
||||
* @deprecated 1.9.0 See `SocketServer` instead
|
||||
* @see SocketServer
|
||||
*/
|
||||
public function __construct($uri, LoopInterface $loop = null, array $context = array())
|
||||
public function __construct($uri, $loop = null, array $context = array())
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #2 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
$loop = $loop ?: Loop::get();
|
||||
// sanitize TCP context options if not properly wrapped
|
||||
if ($context && (!isset($context['tcp']) && !isset($context['tls']) && !isset($context['unix']))) {
|
||||
|
6
vendor/react/socket/src/SocketServer.php
vendored
6
vendor/react/socket/src/SocketServer.php
vendored
@ -29,8 +29,12 @@ final class SocketServer extends EventEmitter implements ServerInterface
|
||||
* @throws \InvalidArgumentException if the listening address is invalid
|
||||
* @throws \RuntimeException if listening on this address fails (already in use etc.)
|
||||
*/
|
||||
public function __construct($uri, array $context = array(), LoopInterface $loop = null)
|
||||
public function __construct($uri, array $context = array(), $loop = null)
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #3 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
// apply default options if not explicitly given
|
||||
$context += array('tcp' => array(), 'tls' => array(), 'unix' => array());
|
||||
$scheme = 'tcp';
|
||||
|
10
vendor/react/socket/src/TcpConnector.php
vendored
10
vendor/react/socket/src/TcpConnector.php
vendored
@ -11,8 +11,16 @@ final class TcpConnector implements ConnectorInterface
|
||||
{
|
||||
private $loop;
|
||||
private $context;
|
||||
public function __construct(LoopInterface $loop = null, array $context = array())
|
||||
/**
|
||||
* @param ?LoopInterface $loop
|
||||
* @param array $context
|
||||
*/
|
||||
public function __construct($loop = null, array $context = array())
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #1 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
$this->loop = $loop ?: Loop::get();
|
||||
$this->context = $context;
|
||||
}
|
||||
|
6
vendor/react/socket/src/TcpServer.php
vendored
6
vendor/react/socket/src/TcpServer.php
vendored
@ -126,8 +126,12 @@ final class TcpServer extends EventEmitter implements ServerInterface
|
||||
* @throws InvalidArgumentException if the listening address is invalid
|
||||
* @throws RuntimeException if listening on this address fails (already in use etc.)
|
||||
*/
|
||||
public function __construct($uri, LoopInterface $loop = null, array $context = array())
|
||||
public function __construct($uri, $loop = null, array $context = array())
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #2 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
$this->loop = $loop ?: Loop::get();
|
||||
// a single port has been given => assume localhost
|
||||
if ((string) (int) $uri === (string) $uri) {
|
||||
|
11
vendor/react/socket/src/TimeoutConnector.php
vendored
11
vendor/react/socket/src/TimeoutConnector.php
vendored
@ -10,8 +10,17 @@ final class TimeoutConnector implements ConnectorInterface
|
||||
private $connector;
|
||||
private $timeout;
|
||||
private $loop;
|
||||
public function __construct(ConnectorInterface $connector, $timeout, LoopInterface $loop = null)
|
||||
/**
|
||||
* @param ConnectorInterface $connector
|
||||
* @param float $timeout
|
||||
* @param ?LoopInterface $loop
|
||||
*/
|
||||
public function __construct(ConnectorInterface $connector, $timeout, $loop = null)
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #3 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
$this->connector = $connector;
|
||||
$this->timeout = $timeout;
|
||||
$this->loop = $loop ?: Loop::get();
|
||||
|
9
vendor/react/socket/src/UnixConnector.php
vendored
9
vendor/react/socket/src/UnixConnector.php
vendored
@ -16,8 +16,15 @@ use RuntimeException;
|
||||
final class UnixConnector implements ConnectorInterface
|
||||
{
|
||||
private $loop;
|
||||
public function __construct(LoopInterface $loop = null)
|
||||
/**
|
||||
* @param ?LoopInterface $loop
|
||||
*/
|
||||
public function __construct($loop = null)
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #1 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
$this->loop = $loop ?: Loop::get();
|
||||
}
|
||||
public function connect($path)
|
||||
|
6
vendor/react/socket/src/UnixServer.php
vendored
6
vendor/react/socket/src/UnixServer.php
vendored
@ -48,8 +48,12 @@ final class UnixServer extends EventEmitter implements ServerInterface
|
||||
* @throws InvalidArgumentException if the listening address is invalid
|
||||
* @throws RuntimeException if listening on this address fails (already in use etc.)
|
||||
*/
|
||||
public function __construct($path, LoopInterface $loop = null, array $context = array())
|
||||
public function __construct($path, $loop = null, array $context = array())
|
||||
{
|
||||
if ($loop !== null && !$loop instanceof LoopInterface) {
|
||||
// manual type check to support legacy PHP < 7.1
|
||||
throw new \InvalidArgumentException('Argument #2 ($loop) expected null|React\\EventLoop\\LoopInterface');
|
||||
}
|
||||
$this->loop = $loop ?: Loop::get();
|
||||
if (\strpos($path, '://') === \false) {
|
||||
$path = 'unix://' . $path;
|
||||
|
@ -82,7 +82,7 @@ class StreamOutput extends Output
|
||||
protected function hasColorSupport() : bool
|
||||
{
|
||||
// Follow https://no-color.org/
|
||||
if (isset($_SERVER['NO_COLOR']) || \false !== \getenv('NO_COLOR')) {
|
||||
if ('' !== ($_SERVER['NO_COLOR'] ?? \getenv('NO_COLOR') ?: '')) {
|
||||
return \false;
|
||||
}
|
||||
// Detect msysgit/mingw and assume this is a tty because detection
|
||||
|
Loading…
x
Reference in New Issue
Block a user