PHPDoc
This commit is contained in:
parent
074f1805eb
commit
2489b52da2
@ -15,7 +15,8 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^9.0",
|
"phpunit/phpunit": "^9.0",
|
||||||
"mockery/mockery": "^1.4"
|
"mockery/mockery": "^1.4",
|
||||||
|
"phpstan/phpstan": "^0.12.68"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
@ -27,4 +28,4 @@
|
|||||||
"JerryYan\\DSL\\Test\\": "tests"
|
"JerryYan\\DSL\\Test\\": "tests"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,11 @@ use JerryYan\DSL\Token\TokenUndefined;
|
|||||||
|
|
||||||
abstract class FactoryInterface
|
abstract class FactoryInterface
|
||||||
{
|
{
|
||||||
/** @var array<string, \JerryYan\DSL\Token\TokenInterface> Token类型及映射类 */
|
/** @var array<string, class-string<TokenInterface>> Token类型及映射类 */
|
||||||
protected $tokenMap = [];
|
protected $tokenMap = [];
|
||||||
/** @var array<string, string> Token别名映射 */
|
/** @var array<string, string> Token别名映射 */
|
||||||
protected $tokenNameMap = [];
|
protected $tokenNameMap = [];
|
||||||
/** @var \JerryYan\DSL\Token\TokenInterface 默认Token类 */
|
/** @var class-string<TokenInterface> 默认Token类 */
|
||||||
protected $undefinedTokenClass = TokenUndefined::class;
|
protected $undefinedTokenClass = TokenUndefined::class;
|
||||||
|
|
||||||
public function getTokenByName(string $name): TokenInterface
|
public function getTokenByName(string $name): TokenInterface
|
||||||
|
@ -17,7 +17,7 @@ use PHPUnit\Framework\TestCase;
|
|||||||
|
|
||||||
class TokenInterfaceTest extends TestCase
|
class TokenInterfaceTest extends TestCase
|
||||||
{
|
{
|
||||||
/** @var TokenInterface[] TokenClass */
|
/** @var class-string<TokenInterface>[] TokenClass */
|
||||||
private $tokenTypes = [
|
private $tokenTypes = [
|
||||||
TokenAnd::class,
|
TokenAnd::class,
|
||||||
TokenDefine::class,
|
TokenDefine::class,
|
||||||
@ -29,7 +29,7 @@ class TokenInterfaceTest extends TestCase
|
|||||||
protected $chainLast;
|
protected $chainLast;
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
/** @var ?TokenInterface $next */
|
/** @var ?TokenInterface $last */
|
||||||
$last = NULL;
|
$last = NULL;
|
||||||
foreach ($this->tokenTypes as $cls) {
|
foreach ($this->tokenTypes as $cls) {
|
||||||
/** @var TokenInterface $current */
|
/** @var TokenInterface $current */
|
||||||
|
@ -21,6 +21,7 @@ class TokenizerTest extends TestCase
|
|||||||
protected $tokenizer;
|
protected $tokenizer;
|
||||||
protected $reader;
|
protected $reader;
|
||||||
private $text = "这个 和 那个 或者 那个 和 这个";
|
private $text = "这个 和 那个 或者 那个 和 这个";
|
||||||
|
/** @var class-string<TokenInterface>[] 预期的类型 */
|
||||||
private $textTokenType = [
|
private $textTokenType = [
|
||||||
TokenVar::class,
|
TokenVar::class,
|
||||||
TokenAnd::class,
|
TokenAnd::class,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user