think-annotation
think-annotation copied to clipboard
ThinkPHP6注解
 
https://github.com/top-think/think-annotation/blob/293dae6f2d7bdb6fed1a89babe176f6059738ccf/src/InteractsWithInject.php#L51 需要注意的是,如果两个数组中存在相同的键名,那么“+”符号运算符会忽略掉第二个数组中的元素 在config中新增的配置是无法生效的
tp8 注解不对
#[Inject] protected Cache $cache; public function index() { //... } 这一块在tp8使用会报错  
 InteractsWithRoute.php文件第91行在路径中只替换了/,在windows系统中文件分隔符是\,因而导致无法在windows上使用注解路由 解决方案: `str_replace('/', '.', $filename)` 替换为 `str_replace(DIRECTORY_SEPARATOR, '.', $filename)`
如题,如果项目全部用注解,其中一个地方注解出错就会影响整个项目,排错工作量大,可否完善错误提示或者忽略错误
Typed property app\internal\controller\HomeController::$homeService must not be accessed before initialization
  路由映射为 /core/System/userInfo时 可以使用  这个位置可能需要兼容下windows场景
//控制器 $filename = Str::substr($filename, strlen($this->controllerDir) + 1); $prefix = str_replace($this->controllerSuffix . '.php', '', str_replace(DIRECTORY_SEPARATOR, '.', $filename));
return [ 'inject' => [ 'enable' => true, 'namespaces' => [], ], 'route' => [ 'enable' => true, 'cache' => !extension_loaded('swoole'), // Swoole环境下禁用缓存 'controllers' => [ app_path('controller/api') => [ 'name'...