Errors on composer dump-autoload --optimize
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3454109. -->
Reported by: [huhhuh](https://www.drupal.org/user/3545257)
Related to !22
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Hello, I have composer <a href="https://getcomposer.org/doc/articles/autoloader-optimization.md">autoloader optimization enabled</a>. After I updated to composer 2.7.7, I'm getting a lot of warnings from monolog module whenever I run composer install.</p>
<pre>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.<br>...</pre><p>I believe this is caused by composer.json file:</p>
<pre> "autoload": {<br> "psr-0": {<br> "Drupal\\Monolog": "src/"<br> }<br> }</pre><h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>composer self-update<br>
composer create-project drupal/recommended-project my_site_name; cd my_site_name<br>
composer require drupal/monolog<br>
composer dump-autoload --optimize</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>As far as I understand, autoload section in composer.json file is not used. Remove this from composer.json:</p>
<pre> "autoload": {<br> "psr-0": {<br> "Drupal\\Monolog": "src/"<br> }<br> }</pre><h3 id="summary-remaining-tasks">Remaining tasks</h3>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>No ui changes.</p>
<h3 id="summary-api-changes">API changes</h3>
<p>No API changes.</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>No data model changes.</p>
issue