Composer PSR-4自动加载接口弃用声明 [英] Composer PSR-4 Autoload Interface Deprecation Notice
问题描述
我无法理解这个简单界面的问题所在.
I'm having trouble understanding what's wrong with this simple interface.
<?php
namespace App\Interfaces;
use Illuminate\View\View;
interface renderData
{
public function renderAsHtml(): View;
}
当我 composer dump-autoload
时,我收到以下通知
When I composer dump-autoload
i receive the following notice
弃用声明:位于./app/Interfaces/RenderData.php中的App \ Interfaces \ renderData类不符合psr-4自动加载标准.在Composer v2.0中将不再自动加载.
Deprecation Notice: Class App\Interfaces\renderData located in ./app/Interfaces/RenderData.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0.
composer.json自动加载部分:
composer.json autoload part:
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
文件夹结构为:
<root_project>
app
Console
...
我已经尝试将应用重命名为App,然后转储自动加载,但问题仍然存在.
I have already try to rename app to App then dump-autoload but the problem persist.
推荐答案
可能是app/Interfaces/RenderData中"app"文件夹的首字母小写,而在应用\接口".
It could be that first letter of ‘app’ folder is in small case in app/Interfaces/RenderData’, but in the namespace is in upper case in ‘App\Interfaces’.
确保文件夹结构和命名与名称空间匹配.
Make sure the folder structure and naming matches namespace.
这篇关于Composer PSR-4自动加载接口弃用声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!