mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-01 19:27:39 +08:00
Added ide-helper component (#3714)
This commit is contained in:
parent
4a89d40f3b
commit
a280656acf
@ -46,6 +46,7 @@
|
||||
- [#3679](https://github.com/hyperf/hyperf/pull/3679) Added Nacos SDK component.
|
||||
- [#3712](https://github.com/hyperf/hyperf/pull/3712) The input parameters of `InstanceProvider::update()` are modified to make it more friendly.
|
||||
- [#3698](https://github.com/hyperf/hyperf/pull/3698) Support PHP8 Attribute which can replace doctrine annotations.
|
||||
- [#3714](https://github.com/hyperf/hyperf/pull/3714) Added ide-helper component.
|
||||
|
||||
## Optimized
|
||||
|
||||
|
19
bin/generate-ide-helper
Executable file
19
bin/generate-ide-helper
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
use Hyperf\IDEHelper\AnnotationGenerator;
|
||||
|
||||
require_once 'vendor/autoload.php';
|
||||
|
||||
$generate = new AnnotationGenerator();
|
||||
|
||||
$generate->generate();
|
@ -316,6 +316,7 @@
|
||||
"HyperfTest\\Watcher\\": "src/watcher/tests/",
|
||||
"HyperfTest\\WebSocketClient\\": "src/websocket-client/tests/",
|
||||
"HyperfTest\\WebSocketServer\\": "src/websocket-server/tests/",
|
||||
"Hyperf\\IDEHelper\\": "src/ide-helper/src/",
|
||||
"Routeguide\\": "src/grpc-client/tests/Routeguide/"
|
||||
}
|
||||
},
|
||||
|
@ -119,7 +119,7 @@ class IndexController
|
||||
}
|
||||
}
|
||||
```
|
||||
> 注意: 使用`PHP8`的`Attributes`语法时, 应简化为`#[Middlewares(FooMiddleware::class, BarMiddleware::class)]`这种格式, 下同。
|
||||
> 注意: 使用 `PHP8` 的`Attributes`语法时, 应简化为`#[Middlewares(FooMiddleware::class, BarMiddleware::class)]`这种格式, 下同。
|
||||
|
||||
#### 定义方法级别的中间件
|
||||
|
||||
|
@ -19,6 +19,7 @@ parameters:
|
||||
- %currentWorkingDirectory%/src/graphql/*
|
||||
- %currentWorkingDirectory%/src/grpc/*
|
||||
- %currentWorkingDirectory%/src/grpc-server/*
|
||||
- %currentWorkingDirectory%/src/ide-helper/*
|
||||
- %currentWorkingDirectory%/src/swagger/*
|
||||
- %currentWorkingDirectory%/src/tracer/*
|
||||
- %currentWorkingDirectory%/src/validation/*
|
||||
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace HyperfTest\Amqp\Stub;
|
||||
|
||||
use Hyperf\Amqp\Connection\Socket;
|
||||
use Hyperf\Utils\Context;
|
||||
use Hyperf\Utils\Str;
|
||||
use Mockery;
|
||||
use Swoole\Coroutine\Channel;
|
||||
use Swoole\Coroutine\Client;
|
||||
|
||||
class SocketStub extends Socket
|
||||
{
|
||||
public function connect()
|
||||
{
|
||||
$sock = Mockery::mock(Client::class);
|
||||
$sock->connected = true;
|
||||
$sock->shouldReceive('send')->andReturnUsing(function ($data) {
|
||||
Context::set('test.amqp.send.data', $data);
|
||||
});
|
||||
$sock->shouldReceive('recv')->andReturnUsing(function ($timeout) {
|
||||
return Str::random(1);
|
||||
});
|
||||
|
||||
$this->channel = new Channel(1);
|
||||
$this->channel->push($sock);
|
||||
$this->connected = true;
|
||||
|
||||
$this->addHeartbeat();
|
||||
|
||||
$this->heartbeat();
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace HyperfTest\Amqp\Stub;
|
||||
|
||||
use Hyperf\Amqp\Connection\Socket;
|
||||
use Swoole\Coroutine\Channel;
|
||||
|
||||
class SocketWithoutIOStub extends Socket
|
||||
{
|
||||
public $connectCount = 0;
|
||||
|
||||
public function __construct(bool $connected, string $host, int $port, float $timeout, int $heartbeat)
|
||||
{
|
||||
parent::__construct($host, $port, $timeout, $heartbeat);
|
||||
$this->connected = $connected;
|
||||
}
|
||||
|
||||
public function connect()
|
||||
{
|
||||
$this->channel = new Channel(1);
|
||||
$this->waitTimeout = 0.1;
|
||||
++$this->connectCount;
|
||||
|
||||
$this->addHeartbeat();
|
||||
}
|
||||
|
||||
public function getConnectCount(): int
|
||||
{
|
||||
return $this->connectCount;
|
||||
}
|
||||
}
|
2
src/ide-helper/.gitattributes
vendored
Normal file
2
src/ide-helper/.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/src export-ignore
|
||||
/.github export-ignore
|
25
src/ide-helper/.github/workflows/release.yml
vendored
Normal file
25
src/ide-helper/.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
on:
|
||||
push:
|
||||
# Sequence of patterns matched against refs/tags
|
||||
tags:
|
||||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
name: Release
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
21
src/ide-helper/LICENSE
Normal file
21
src/ide-helper/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Hyperf
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
31
src/ide-helper/composer.json
Normal file
31
src/ide-helper/composer.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "hyperf/ide-helper",
|
||||
"description": "IDE help files for Hyperf.",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"php",
|
||||
"swoole",
|
||||
"hyperf",
|
||||
"ide-helper"
|
||||
],
|
||||
"homepage": "https://hyperf.io",
|
||||
"support": {
|
||||
"docs": "https://hyperf.wiki",
|
||||
"issues": "https://github.com/hyperf/hyperf/issues",
|
||||
"pull-request": "https://github.com/hyperf/hyperf/pulls",
|
||||
"source": "https://github.com/hyperf/hyperf"
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Hyperf\\IDEHelper\\": "src/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.1-dev"
|
||||
}
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Amqp/Annotation/Consumer.php
Normal file
27
src/ide-helper/output/Hyperf/Amqp/Annotation/Consumer.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Amqp\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Consumer extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($exchange, $routingKey, $queue, $name, $nums, $enable, $maxConsumption)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Amqp/Annotation/Producer.php
Normal file
27
src/ide-helper/output/Hyperf/Amqp/Annotation/Producer.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Amqp\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Producer extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($exchange, $routingKey)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\AsyncQueue\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class AsyncQueueMessage extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($pool, $delay, $maxAttempts)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Cache/Annotation/CacheEvict.php
Normal file
27
src/ide-helper/output/Hyperf/Cache/Annotation/CacheEvict.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Cache\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class CacheEvict extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($prefix, $value, $all, $group, $collect)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Cache/Annotation/CachePut.php
Normal file
27
src/ide-helper/output/Hyperf/Cache/Annotation/CachePut.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Cache\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class CachePut extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($prefix, $value, $ttl, $offset, $group)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Cache/Annotation/Cacheable.php
Normal file
27
src/ide-helper/output/Hyperf/Cache/Annotation/Cacheable.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Cache\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class Cacheable extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($prefix, $value, $ttl, $listener, $offset, $group, $collect)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Cache/Annotation/FailCache.php
Normal file
27
src/ide-helper/output/Hyperf/Cache/Annotation/FailCache.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Cache\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class FailCache extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($prefix, $value, $ttl, $listener, $group)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\CircuitBreaker\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
* @property float $timeout
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class CircuitBreaker extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($handler, $fallback, $duration, $successCounter, $failCounter, $value)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Command/Annotation/Command.php
Normal file
27
src/ide-helper/output/Hyperf/Command/Annotation/Command.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Command\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Command extends AbstractAnnotation
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Config/Annotation/Value.php
Normal file
27
src/ide-helper/output/Hyperf/Config/Annotation/Value.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Config\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"PROPERTY"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Value extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($key)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Constants\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Constants extends AbstractAnnotation
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Crontab/Annotation/Crontab.php
Normal file
27
src/ide-helper/output/Hyperf/Crontab/Annotation/Crontab.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Crontab\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class Crontab extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($name, $type, $rule, $singleton, $mutexPool, $mutexExpires, $onOneServer, $callback, $memo, $enable)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\DbConnection\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class Transactional extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($connection, $attempts)
|
||||
{
|
||||
}
|
||||
}
|
26
src/ide-helper/output/Hyperf/Di/Annotation/Aspect.php
Normal file
26
src/ide-helper/output/Hyperf/Di/Annotation/Aspect.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Di\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Aspect extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($classes, $annotations, $priority)
|
||||
{
|
||||
}
|
||||
}
|
26
src/ide-helper/output/Hyperf/Di/Annotation/Debug.php
Normal file
26
src/ide-helper/output/Hyperf/Di/Annotation/Debug.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Di\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"ALL"})
|
||||
*/
|
||||
#[Attribute]
|
||||
class Debug extends AbstractAnnotation
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
26
src/ide-helper/output/Hyperf/Di/Annotation/Inject.php
Normal file
26
src/ide-helper/output/Hyperf/Di/Annotation/Inject.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Di\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"PROPERTY"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_PROPERTY)]
|
||||
class Inject extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($value, $required, $lazy)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Event/Annotation/Listener.php
Normal file
27
src/ide-helper/output/Hyperf/Event/Annotation/Listener.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Event\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Listener extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($priority)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\ExceptionHandler\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class ExceptionHandler extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($server, $priority)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class AutoController extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($prefix, $server, $options)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Controller extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($prefix, $server, $options)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class DeleteMapping extends Mapping
|
||||
{
|
||||
public function __construct($methods, $path, $options)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class GetMapping extends Mapping
|
||||
{
|
||||
public function __construct($methods, $path, $options)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"ALL"})
|
||||
*/
|
||||
#[Attribute]
|
||||
class Middleware extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($middleware)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"ALL"})
|
||||
*/
|
||||
#[Attribute]
|
||||
class Middlewares extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($middlewares)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PatchMapping extends Mapping
|
||||
{
|
||||
public function __construct($methods, $path, $options)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PostMapping extends Mapping
|
||||
{
|
||||
public function __construct($methods, $path, $options)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class PutMapping extends Mapping
|
||||
{
|
||||
public function __construct($methods, $path, $options)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\HttpServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class RequestMapping extends Mapping
|
||||
{
|
||||
public function __construct($methods, $path, $options)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Kafka/Annotation/Consumer.php
Normal file
27
src/ide-helper/output/Hyperf/Kafka/Annotation/Consumer.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Kafka\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Consumer extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($pool, $topic, $groupId, $memberId, $autoCommit, $nums, $enable)
|
||||
{
|
||||
}
|
||||
}
|
28
src/ide-helper/output/Hyperf/Metric/Annotation/Counter.php
Normal file
28
src/ide-helper/output/Hyperf/Metric/Annotation/Counter.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Metric\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class Counter extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($name)
|
||||
{
|
||||
}
|
||||
}
|
28
src/ide-helper/output/Hyperf/Metric/Annotation/Histogram.php
Normal file
28
src/ide-helper/output/Hyperf/Metric/Annotation/Histogram.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Metric\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class Histogram extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($name)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\ModelListener\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class ModelListener extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($models)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Nats/Annotation/Consumer.php
Normal file
27
src/ide-helper/output/Hyperf/Nats/Annotation/Consumer.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Nats\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Consumer extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($subject, $queue, $name, $nums, $pool)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Nsq/Annotation/Consumer.php
Normal file
27
src/ide-helper/output/Hyperf/Nsq/Annotation/Consumer.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Nsq\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Consumer extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($topic, $channel, $name, $nums, $pool)
|
||||
{
|
||||
}
|
||||
}
|
28
src/ide-helper/output/Hyperf/Process/Annotation/Process.php
Normal file
28
src/ide-helper/output/Hyperf/Process/Annotation/Process.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Process\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target("CLASS")
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Process extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($nums, $name, $redirectStdinStdout, $pipeType, $enableCoroutine)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\RateLimit\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class RateLimit extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($create, $consume, $capacity, $limitCallback, $key, $waitTimeout)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Retry\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class BackoffRetryFalsy extends RetryFalsy
|
||||
{
|
||||
public function __construct($base, $sleepStrategyClass, $retryThrowables, $retryOnResultPredicate, $policies, $maxAttempts, $retryBudget, $retryOnThrowablePredicate, $ignoreThrowables, $fallback)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Retry\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class BackoffRetryThrowable extends RetryThrowable
|
||||
{
|
||||
public function __construct($base, $sleepStrategyClass, $retryThrowables, $policies, $maxAttempts, $retryBudget, $retryOnThrowablePredicate, $retryOnResultPredicate, $ignoreThrowables, $fallback)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Retry\Annotation;
|
||||
|
||||
use Attribute;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class CircuitBreaker extends AbstractRetry
|
||||
{
|
||||
public function __construct($policies, $sleepStrategyClass, $maxAttempts, $circuitBreakerState, $base, $retryOnThrowablePredicate, $retryOnResultPredicate, $retryThrowables, $ignoreThrowables, $fallback)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Retry/Annotation/Retry.php
Normal file
27
src/ide-helper/output/Hyperf/Retry/Annotation/Retry.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Retry\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class Retry extends AbstractRetry
|
||||
{
|
||||
public function __construct($policies, $sleepStrategyClass, $maxAttempts, $retryBudget, $base, $retryOnThrowablePredicate, $retryOnResultPredicate, $retryThrowables, $ignoreThrowables, $fallback)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Retry/Annotation/RetryFalsy.php
Normal file
27
src/ide-helper/output/Hyperf/Retry/Annotation/RetryFalsy.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Retry\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class RetryFalsy extends Retry
|
||||
{
|
||||
public function __construct($retryThrowables, $retryOnResultPredicate, $policies, $sleepStrategyClass, $maxAttempts, $retryBudget, $base, $retryOnThrowablePredicate, $ignoreThrowables, $fallback)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Retry\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_METHOD)]
|
||||
class RetryThrowable extends Retry
|
||||
{
|
||||
public function __construct($retryThrowables, $policies, $sleepStrategyClass, $maxAttempts, $retryBudget, $base, $retryOnThrowablePredicate, $retryOnResultPredicate, $ignoreThrowables, $fallback)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\RpcServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class RpcService extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($name, $server, $protocol, $publishTo)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Signal/Annotation/Signal.php
Normal file
27
src/ide-helper/output/Hyperf/Signal/Annotation/Signal.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Signal\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class Signal extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($priority)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\SocketIOServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class Event extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($event)
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\SocketIOServer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS)]
|
||||
class SocketIONamespace extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($namespace)
|
||||
{
|
||||
}
|
||||
}
|
27
src/ide-helper/output/Hyperf/Task/Annotation/Task.php
Normal file
27
src/ide-helper/output/Hyperf/Task/Annotation/Task.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Task\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class Task extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($workerId, $timeout)
|
||||
{
|
||||
}
|
||||
}
|
28
src/ide-helper/output/Hyperf/Tracer/Annotation/Trace.php
Normal file
28
src/ide-helper/output/Hyperf/Tracer/Annotation/Trace.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\Tracer\Annotation;
|
||||
|
||||
use Attribute;
|
||||
use Doctrine\Common\Annotations\Annotation\Target;
|
||||
use Hyperf\Di\Annotation\AbstractAnnotation;
|
||||
|
||||
/**
|
||||
* @Annotation
|
||||
* @Target({"CLASS", "METHOD"})
|
||||
*/
|
||||
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD)]
|
||||
class Trace extends AbstractAnnotation
|
||||
{
|
||||
public function __construct($name, $tag)
|
||||
{
|
||||
}
|
||||
}
|
63
src/ide-helper/src/AnnotationGenerator.php
Normal file
63
src/ide-helper/src/AnnotationGenerator.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\IDEHelper;
|
||||
|
||||
use Hyperf\IDEHelper\Visitor\AnnotationIDEVisitor;
|
||||
use Hyperf\Utils\Composer;
|
||||
use ReflectionClass;
|
||||
|
||||
class AnnotationGenerator
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var Ast
|
||||
*/
|
||||
protected $ast;
|
||||
|
||||
public function __construct(?string $output = null)
|
||||
{
|
||||
$this->output = $output ?: __DIR__ . '/../output';
|
||||
$this->ast = new Ast();
|
||||
}
|
||||
|
||||
public function generate(): void
|
||||
{
|
||||
$classMap = Composer::getLoader()->getClassMap();
|
||||
foreach ($classMap as $value => $path) {
|
||||
if (str_starts_with($value, 'Hyperf\\')) {
|
||||
try {
|
||||
$reflection = new ReflectionClass($value);
|
||||
$attributes = $reflection->getAttributes();
|
||||
foreach ($attributes as $attribute) {
|
||||
if ($attribute->getName() === 'Attribute') {
|
||||
$code = $this->ast->generate($reflection, file_get_contents($path), [
|
||||
AnnotationIDEVisitor::class,
|
||||
]);
|
||||
|
||||
$target = $this->output . '/' . str_replace('\\', '/', $reflection->getName());
|
||||
if (! is_dir(dirname($target))) {
|
||||
mkdir(dirname($target), 0777, true);
|
||||
}
|
||||
|
||||
file_put_contents($target . '.php', $code);
|
||||
}
|
||||
}
|
||||
} catch (\Throwable) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
src/ide-helper/src/Ast.php
Normal file
52
src/ide-helper/src/Ast.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\IDEHelper;
|
||||
|
||||
use Doctrine\Common\Annotations\AnnotationReader;
|
||||
use Doctrine\Common\Annotations\Reader;
|
||||
use PhpParser\NodeTraverser;
|
||||
use PhpParser\Parser;
|
||||
use PhpParser\ParserFactory;
|
||||
use PhpParser\PrettyPrinter\Standard;
|
||||
use PhpParser\PrettyPrinterAbstract;
|
||||
use ReflectionClass;
|
||||
|
||||
class Ast
|
||||
{
|
||||
private Parser $parser;
|
||||
|
||||
private PrettyPrinterAbstract $printer;
|
||||
|
||||
private Reader $reader;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$parserFactory = new ParserFactory();
|
||||
$this->parser = $parserFactory->create(ParserFactory::ONLY_PHP7);
|
||||
$this->printer = new Standard();
|
||||
$this->reader = new AnnotationReader();
|
||||
}
|
||||
|
||||
public function generate(ReflectionClass $reflection, string $code, array $visitors = []): string
|
||||
{
|
||||
$stmts = $this->parser->parse($code);
|
||||
|
||||
$traverser = new NodeTraverser();
|
||||
$metadata = new Metadata($this->reader, $reflection);
|
||||
foreach ($visitors as $string) {
|
||||
$visitor = new $string($metadata);
|
||||
$traverser->addVisitor($visitor);
|
||||
}
|
||||
$modifiedStmts = $traverser->traverse($stmts);
|
||||
return $this->printer->prettyPrintFile($modifiedStmts);
|
||||
}
|
||||
}
|
24
src/ide-helper/src/Metadata.php
Normal file
24
src/ide-helper/src/Metadata.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\IDEHelper;
|
||||
|
||||
use Doctrine\Common\Annotations\Reader;
|
||||
use ReflectionClass;
|
||||
|
||||
class Metadata
|
||||
{
|
||||
public function __construct(
|
||||
public Reader $reader,
|
||||
public ReflectionClass $reflection
|
||||
) {
|
||||
}
|
||||
}
|
54
src/ide-helper/src/Visitor/AnnotationIDEVisitor.php
Normal file
54
src/ide-helper/src/Visitor/AnnotationIDEVisitor.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* This file is part of Hyperf.
|
||||
*
|
||||
* @link https://www.hyperf.io
|
||||
* @document https://hyperf.wiki
|
||||
* @contact group@hyperf.io
|
||||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
|
||||
*/
|
||||
namespace Hyperf\IDEHelper\Visitor;
|
||||
|
||||
use Hyperf\IDEHelper\Metadata;
|
||||
use PhpParser\Node;
|
||||
use PhpParser\NodeVisitorAbstract;
|
||||
use ReflectionClass;
|
||||
|
||||
class AnnotationIDEVisitor extends NodeVisitorAbstract
|
||||
{
|
||||
protected ReflectionClass $reflection;
|
||||
|
||||
public function __construct(public Metadata $metadata)
|
||||
{
|
||||
$this->reflection = $this->metadata->reflection;
|
||||
}
|
||||
|
||||
public function afterTraverse(array $nodes)
|
||||
{
|
||||
foreach ($nodes as $node) {
|
||||
if ($node instanceof Node\Stmt\Declare_) {
|
||||
continue;
|
||||
}
|
||||
if ($node instanceof Node\Stmt\Namespace_) {
|
||||
foreach ($node->stmts as $class) {
|
||||
if (! $class instanceof Node\Stmt\Class_) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$properties = [];
|
||||
foreach ($this->reflection->getProperties() as $property) {
|
||||
$properties[] = new Node\Param(new Node\Expr\Variable($property->getName()));
|
||||
}
|
||||
$class->stmts = [
|
||||
new Node\Stmt\ClassMethod('__construct', [
|
||||
'flags' => Node\Stmt\Class_::MODIFIER_PUBLIC,
|
||||
'params' => $properties,
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -306,7 +306,7 @@ EOD;
|
||||
$cache = file_get_contents($cacheFile);
|
||||
$scanCache = unserialize($cache);
|
||||
$proxies = [];
|
||||
foreach ($scanCache[1] as $class => $path){
|
||||
foreach ($scanCache[1] as $class => $path) {
|
||||
$proxies[$class] = $this->getPathLocalToBase($path);
|
||||
}
|
||||
$scanCache[1] = $proxies;
|
||||
|
Loading…
Reference in New Issue
Block a user