Errors on composer dump-autoload --optimize

Created on 12 June 2024, 6 months ago
Updated 5 July 2024, 6 months ago

Problem/Motivation

Hello, I have composer autoloader optimization enabled. After I updated to composer 2.7.7, I'm getting a lot of warnings from monolog module whenever I run composer install.

Class Drupal\monolog\Logger\Handler\DrupalMailHandler located in ./public/modules/contrib/monolog/src/Logger/Handler/DrupalMailHandler.php does not comply with psr-0 autoloading standard (rule: Drupal\Monolog => ./public/modules/contrib/monolog/src). Skipping.
...

I believe this is caused by composer.json file:

    "autoload": {
        "psr-0": {
            "Drupal\\Monolog": "src/"
        }
    }

Steps to reproduce

composer self-update
composer create-project drupal/recommended-project my_site_name; cd my_site_name
composer require drupal/monolog
composer dump-autoload --optimize

Proposed resolution

As far as I understand, autoload section in composer.json file is not used. Remove this from composer.json:

    "autoload": {
        "psr-0": {
            "Drupal\\Monolog": "src/"
        }
    }

Remaining tasks

User interface changes

No ui changes.

API changes

No API changes.

Data model changes

No data model changes.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024