PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 9, 2022

[FIXED] Composer PSR-4 Autoload Interface Deprecation Notice

 February 09, 2022     composer-php, laravel, phar, php     No comments   

Issue

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;
}

When I composer dump-autoload i receive the following notice

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 autoload part:

    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
     },

Folder structure is:

<root_project>
 app
 Console
 ...

I have already try to rename app to App then dump-autoload but the problem persist.


Solution

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.



Answered By - Svetlozar Stoyanov
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing