初始化代码

This commit is contained in:
2025-12-22 14:34:25 +08:00
parent c2c5ae2fdd
commit a77dbc743f
1510 changed files with 213008 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace Swoole\IDEHelper\Rules;
use Swoole\IDEHelper\Constant;
use Swoole\IDEHelper\Exception;
/**
* Class NamespaceRule
*
* @package Swoole\IDEHelper\Rules
*/
class NamespaceRule extends AbstractRule
{
/**
* @inheritDoc
*/
protected function validateWith(...$params): void
{
if (strcasecmp(explode('\\', $params[0])[0], $this->getGenerator()->getExtension()) !== 0) {
throw new Exception(
"Class $params[0] should be under namespace \\{$this->getGenerator()->getExtension()} but not."
);
}
}
/**
* @inheritDoc
*/
protected function getEnabledExtensions(): array
{
return [
Constant::EXT_SWOOLE,
];
}
}