mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 11:48:08 +08:00
Format code (#4916)
This commit is contained in:
parent
9e131caaea
commit
98d47cc10c
@ -25,7 +25,7 @@ class MessageTest extends TestCase
|
||||
{
|
||||
public function testMessageSerialize()
|
||||
{
|
||||
system(__DIR__ . '/async_queue2.2.php');
|
||||
system(__DIR__ . '/async_queue2.2');
|
||||
|
||||
$message = unserialize(file_get_contents(__DIR__ . '/message2.2.cache'));
|
||||
|
||||
|
@ -28,7 +28,7 @@ class QueryExecuted
|
||||
* @param string $sql the SQL query that was executed
|
||||
* @param array $bindings the array of query bindings
|
||||
* @param null|float $time the number of milliseconds it took to execute the query
|
||||
* @param ConnectionInterface&Connection $connection the database connection instance
|
||||
* @param Connection&ConnectionInterface $connection the database connection instance
|
||||
* @param null|array|int|Throwable $result the result of query
|
||||
*/
|
||||
public function __construct(
|
||||
|
@ -213,7 +213,7 @@ class FieldsBuilder
|
||||
public function getInputFields(ReflectionMethod $refMethod): array
|
||||
{
|
||||
$docBlockObj = $this->cachedDocBlockFactory->getDocBlock($refMethod);
|
||||
//$docBlockComment = $docBlockObj->getSummary()."\n".$docBlockObj->getDescription()->render();
|
||||
// $docBlockComment = $docBlockObj->getSummary()."\n".$docBlockObj->getDescription()->render();
|
||||
|
||||
$parameters = $refMethod->getParameters();
|
||||
|
||||
|
@ -367,7 +367,7 @@ class TypeMapper implements TypeMapperInterface
|
||||
|
||||
$map = $this->getMapNameToExtendType($recursiveTypeMapper);
|
||||
|
||||
return isset($map[$typeName])/* || isset($this->mapInputNameToFactory[$typeName])*/;
|
||||
return isset($map[$typeName])/* || isset($this->mapInputNameToFactory[$typeName]) */;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -387,7 +387,7 @@ class TypeMapper implements TypeMapperInterface
|
||||
}
|
||||
$extendTypeClassNames = $map[$typeName];
|
||||
|
||||
//}
|
||||
// }
|
||||
}
|
||||
|
||||
foreach ($extendTypeClassNames as $extendedTypeClass) {
|
||||
|
@ -29,7 +29,7 @@ class MetricMiddleware implements MiddlewareInterface
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
$labels = [
|
||||
'request_status' => '500', //default to 500 in case uncaught exception occur
|
||||
'request_status' => '500', // default to 500 in case uncaught exception occur
|
||||
'request_path' => $this->getPath($request),
|
||||
'request_method' => $request->getMethod(),
|
||||
];
|
||||
|
@ -16,7 +16,7 @@ use Hyperf\Contract\LengthAwarePaginatorInterface;
|
||||
class UrlWindow
|
||||
{
|
||||
/**
|
||||
* @param LengthAwarePaginatorInterface&AbstractPaginator $paginator
|
||||
* @param AbstractPaginator&LengthAwarePaginatorInterface $paginator
|
||||
*/
|
||||
public function __construct(protected LengthAwarePaginatorInterface $paginator)
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ class BatchSaveRoute implements ListenerInterface
|
||||
->bufferWithCount(10)
|
||||
->subscribe(
|
||||
function (array $bodies) {
|
||||
echo count($bodies); //10
|
||||
echo count($bodies); // 10
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -25,4 +25,4 @@ $o->take(1)->subscribe(
|
||||
$result->push($x);
|
||||
}
|
||||
);
|
||||
echo $result->pop(); //2;
|
||||
echo $result->pop(); // 2;
|
||||
|
@ -27,7 +27,7 @@ class CircuitBreakerStateTest extends TestCase
|
||||
);
|
||||
$this->assertFalse($state->isOpen());
|
||||
$state->open();
|
||||
$this->assertTrue($state->isOpen()); //open
|
||||
$this->assertTrue($state->isOpen()); // open
|
||||
usleep(1000);
|
||||
$this->assertFalse($state->isOpen());
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class Client extends AbstractServiceClient
|
||||
protected string $serviceInterface;
|
||||
|
||||
/**
|
||||
* @var DataFetcherInterface & DataFormatterInterface
|
||||
* @var DataFetcherInterface&DataFormatterInterface
|
||||
*/
|
||||
protected DataFormatterInterface $dataFormatter;
|
||||
|
||||
|
@ -66,7 +66,7 @@ class CalculatorTest extends AbstractTestCase
|
||||
{
|
||||
$this->expectException(InvalidOperatorException::class);
|
||||
|
||||
new Calculator([new \StdClass()]);
|
||||
new Calculator([new \stdClass()]);
|
||||
}
|
||||
|
||||
public function testToRPNExpression()
|
||||
|
@ -47,7 +47,7 @@ class ElasticsearchEngine extends Engine
|
||||
* Update the given model in the index.
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @param Collection<int, \Hyperf\Scout\Searchable&\Hyperf\Database\Model\Model> $models
|
||||
* @param Collection<int, \Hyperf\Database\Model\Model&\Hyperf\Scout\Searchable> $models
|
||||
*/
|
||||
public function update($models): void
|
||||
{
|
||||
@ -78,7 +78,7 @@ class ElasticsearchEngine extends Engine
|
||||
* Remove the given model from the index.
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @param Collection<int, \Hyperf\Scout\Searchable&\Hyperf\Database\Model\Model> $models
|
||||
* @param Collection<int, \Hyperf\Database\Model\Model&\Hyperf\Scout\Searchable> $models
|
||||
*/
|
||||
public function delete($models): void
|
||||
{
|
||||
|
@ -18,7 +18,7 @@ use Hyperf\Scout\Searchable;
|
||||
class ModelsFlushed
|
||||
{
|
||||
/**
|
||||
* @param Collection<int, Searchable&Model>
|
||||
* @param Collection<int, Model&Searchable>
|
||||
*/
|
||||
public $models;
|
||||
|
||||
|
@ -18,7 +18,7 @@ use Hyperf\Scout\Searchable;
|
||||
class ModelsImported
|
||||
{
|
||||
/**
|
||||
* @param Collection<int, Searchable&Model>
|
||||
* @param Collection<int, Model&Searchable>
|
||||
*/
|
||||
public $models;
|
||||
|
||||
|
@ -22,7 +22,7 @@ class Decoder
|
||||
$query = [];
|
||||
++$i;
|
||||
|
||||
//TODO: Support attachment
|
||||
// TODO: Support attachment
|
||||
|
||||
// namespace
|
||||
if (isset($payload[$i]) && $payload[$i] === '/') {
|
||||
|
@ -75,7 +75,7 @@ class Socket
|
||||
'type' => Packet::CLOSE,
|
||||
'nsp' => $this->nsp,
|
||||
]);
|
||||
//notice client is about to disconnect
|
||||
// notice client is about to disconnect
|
||||
$this->sender->push($this->fd, Engine::MESSAGE . $this->encoder->encode($closePacket));
|
||||
/** @var \Swoole\WebSocket\Server $server */
|
||||
$server = ApplicationContext::getContainer()->get(Server::class);
|
||||
|
@ -118,9 +118,9 @@ class SocketIO implements OnMessageInterface, OnOpenInterface, OnCloseInterface
|
||||
if ($frame->data[0] === Engine::PING) {
|
||||
$this->renewInAllNamespaces($frame->fd);
|
||||
if ($server instanceof Response) {
|
||||
$server->push(Engine::PONG); //sever pong
|
||||
$server->push(Engine::PONG); // sever pong
|
||||
} else {
|
||||
$server->push($frame->fd, Engine::PONG); //sever pong
|
||||
$server->push($frame->fd, Engine::PONG); // sever pong
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -138,18 +138,18 @@ class SocketIO implements OnMessageInterface, OnOpenInterface, OnCloseInterface
|
||||
}
|
||||
$packet = $this->decoder->decode(substr($frame->data, 1));
|
||||
switch ($packet->type) {
|
||||
case Packet::OPEN: //client open
|
||||
case Packet::OPEN: // client open
|
||||
$responsePacket = Packet::create([
|
||||
'type' => Packet::OPEN,
|
||||
'nsp' => $packet->nsp,
|
||||
]);
|
||||
if ($server instanceof Response) {
|
||||
$server->push(Engine::MESSAGE . $this->encoder->encode($responsePacket)); //sever open
|
||||
$server->push(Engine::MESSAGE . $this->encoder->encode($responsePacket)); // sever open
|
||||
} else {
|
||||
$server->push($frame->fd, Engine::MESSAGE . $this->encoder->encode($responsePacket)); //sever open
|
||||
$server->push($frame->fd, Engine::MESSAGE . $this->encoder->encode($responsePacket)); // sever open
|
||||
}
|
||||
break;
|
||||
case Packet::CLOSE: //client disconnect
|
||||
case Packet::CLOSE: // client disconnect
|
||||
if ($server instanceof Response) {
|
||||
$server->close();
|
||||
} else {
|
||||
@ -202,11 +202,11 @@ class SocketIO implements OnMessageInterface, OnOpenInterface, OnCloseInterface
|
||||
'pingTimeout' => $this->config->getPingTimeout(),
|
||||
];
|
||||
if ($server instanceof Response) {
|
||||
$server->push(Engine::OPEN . json_encode($data)); //socket is open
|
||||
$server->push(Engine::MESSAGE . Packet::OPEN); //server open
|
||||
$server->push(Engine::OPEN . json_encode($data)); // socket is open
|
||||
$server->push(Engine::MESSAGE . Packet::OPEN); // server open
|
||||
} else {
|
||||
$server->push($request->fd, Engine::OPEN . json_encode($data)); //socket is open
|
||||
$server->push($request->fd, Engine::MESSAGE . Packet::OPEN); //server open
|
||||
$server->push($request->fd, Engine::OPEN . json_encode($data)); // socket is open
|
||||
$server->push($request->fd, Engine::MESSAGE . Packet::OPEN); // server open
|
||||
}
|
||||
|
||||
$this->dispatchEventInAllNamespaces($request->fd, 'connect');
|
||||
|
@ -505,7 +505,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
|
||||
/**
|
||||
* Run a filter over each of the items.
|
||||
*
|
||||
* @param callable(TValue, TKey): bool|null $callback
|
||||
* @param (callable(TValue, TKey): bool)|null $callback
|
||||
* @return static<TKey, TValue>
|
||||
*/
|
||||
public function filter(callable $callback = null): self
|
||||
@ -538,7 +538,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
|
||||
* Apply the callback if the value is falsy.
|
||||
*
|
||||
* @param callable($this): $this $callback
|
||||
* @param callable($this): $this|null $default
|
||||
* @param callable($this): null|$this $default
|
||||
* @return $this
|
||||
*/
|
||||
public function unless(bool $value, callable $callback, callable $default = null): self
|
||||
@ -637,8 +637,8 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate
|
||||
*
|
||||
* @template TFirstDefault
|
||||
*
|
||||
* @param callable(TValue, TKey): bool|null $callback
|
||||
* @param TFirstDefault|callable(): TFirstDefault $default
|
||||
* @param (callable(TValue, TKey): bool)|null $callback
|
||||
* @param TFirstDefault|(\Closure(): TFirstDefault) $default
|
||||
* @return TFirstDefault|TValue
|
||||
*/
|
||||
public function first(callable $callback = null, $default = null)
|
||||
|
@ -318,7 +318,7 @@ class ValidationValidatorTest extends TestCase
|
||||
$v->messages()->setFormat(':message');
|
||||
$this->assertEquals('Name is required!', $v->messages()->first('name'));
|
||||
|
||||
//set customAttributes by setter
|
||||
// set customAttributes by setter
|
||||
$trans = $this->getIlluminateArrayTranslator();
|
||||
$trans->addLines(['validation.required' => ':attribute is required!'], 'en');
|
||||
$customAttributes = ['name' => 'Name'];
|
||||
@ -425,7 +425,7 @@ class ValidationValidatorTest extends TestCase
|
||||
|
||||
public function testDisplayableValuesAreReplaced()
|
||||
{
|
||||
//required_if:foo,bar
|
||||
// required_if:foo,bar
|
||||
$trans = $this->getIlluminateArrayTranslator();
|
||||
$trans->addLines(['validation.required_if' => 'The :attribute field is required when :other is :value.'], 'en');
|
||||
$trans->addLines(['validation.values.color.1' => 'red'], 'en');
|
||||
@ -434,7 +434,7 @@ class ValidationValidatorTest extends TestCase
|
||||
$v->messages()->setFormat(':message');
|
||||
$this->assertEquals('The bar field is required when color is red.', $v->messages()->first('bar'));
|
||||
|
||||
//required_unless:foo,bar
|
||||
// required_unless:foo,bar
|
||||
$trans = $this->getIlluminateArrayTranslator();
|
||||
$trans->addLines(['validation.required_unless' => 'The :attribute field is required unless :other is in :values.'], 'en');
|
||||
$trans->addLines(['validation.values.color.1' => 'red'], 'en');
|
||||
@ -443,7 +443,7 @@ class ValidationValidatorTest extends TestCase
|
||||
$v->messages()->setFormat(':message');
|
||||
$this->assertEquals('The bar field is required unless color is in red.', $v->messages()->first('bar'));
|
||||
|
||||
//in:foo,bar,...
|
||||
// in:foo,bar,...
|
||||
$trans = $this->getIlluminateArrayTranslator();
|
||||
$trans->addLines(['validation.in' => ':attribute must be included in :values.'], 'en');
|
||||
$trans->addLines(['validation.values.type.5' => 'Short'], 'en');
|
||||
@ -453,7 +453,7 @@ class ValidationValidatorTest extends TestCase
|
||||
$v->messages()->setFormat(':message');
|
||||
$this->assertEquals('type must be included in Short, Long.', $v->messages()->first('type'));
|
||||
|
||||
//date_equals:tomorrow
|
||||
// date_equals:tomorrow
|
||||
$trans = $this->getIlluminateArrayTranslator();
|
||||
$trans->addLines(['validation.date_equals' => 'The :attribute must be a date equal to :date.'], 'en');
|
||||
$trans->addLines(['validation.values.date.tomorrow' => 'the day after today'], 'en');
|
||||
|
Loading…
Reference in New Issue
Block a user