Composer PSR-4 自动加载接口弃用通知

Composer PSR-4 Autoload Interface Deprecation Notice(Composer PSR-4 自动加载接口弃用通知)
本文介绍了Composer PSR-4 自动加载接口弃用通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解这个简单的界面有什么问题.

I'm having trouble understanding what's wrong with this simple interface.

<?php

namespace AppInterfaces;

use IlluminateViewView;

interface renderData
{
        public function renderAsHtml(): View;
}

当我 composer dump-autoload 我收到以下通知

When I composer dump-autoload i receive the following notice

弃用通知:位于 ./app/Interfaces/RenderData.php 中的类 AppInterfaces enderData 不符合 psr-4 自动加载标准.在 Composer v2.0 中将不再自动加载.

Deprecation Notice: Class AppInterfaces enderData 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 重命名为 App 然后 dump-autoload 但问题仍然存在.

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 ‘AppInterfaces’.

确保文件夹结构和命名与命名空间匹配.

Make sure the folder structure and naming matches namespace.

这篇关于Composer PSR-4 自动加载接口弃用通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Convert JSON integers and floats to strings(将JSON整数和浮点数转换为字符串)
in php how do I use preg replace to turn a url into a tinyurl(在php中,如何使用preg替换将URL转换为TinyURL)
all day appointment for ics calendar file wont work(ICS日历文件的全天约会不起作用)
trim function is giving unexpected values php(Trim函数提供了意外的值php)
Basic PDO connection to MySQL(到MySQL的基本PDO连接)
PHP number_format returns 1.00(Php number_Format返回1.00)