title: Fatal error: Method class@anonymous::__toString() must not throw an exception after composer install
body: <p>hello I have an error when I do a composer install and which does cache: clear.</p>
  <ul>
  <li>I use <strong>Symfony 4.1</strong></li>
  <li>I already delete <em>/var</em> &amp; <em>/vendor</em></li>
  <li>I am on Docker (php)</li>
  </ul>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>composer install
  Loading composer repositories with package information
  Installing dependencies (including require-dev) from lock file
  Nothing to install or update
  Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
  Package fzaninotto/faker is abandoned, you should avoid using it. No replacement was suggested.
  Package symfony/lts is abandoned, you should avoid using it. Use symfony/flex instead.
  Package symfony/webpack-encore-pack is abandoned, you should avoid using it. Use symfony/webpack-encore-bundle instead.
  Package zendframework/zend-code is abandoned, you should avoid using it. Use laminas/laminas-code instead.
  Package zendframework/zend-eventmanager is abandoned, you should avoid using it. Use laminas/laminas-eventmanager instead.
  Generating autoload files
  composer/package-versions-deprecated: Generating version class...
  composer/package-versions-deprecated: ...done generating version class
  102 packages you are using are looking for funding.
  Use the `composer fund` command to find out more!
  
  Run composer recipes at any time to see the status of your Symfony recipes.
  
  Executing script cache:clear [KO]
   [KO]
  Script cache:clear returned with error code 255
  !!  Xdebug: [Config] Invalid mode '1' set for 'xdebug.mode' configuration setting (See: https://xdebug.org/docs/errors#CFG-C-MODE)
  !!  
  !!  Fatal error: Method class@anonymous::__toString() must not throw an exception, caught Symfony\Component\DependencyInjection\Exception\AutowiringFailedException:  in /var/www/symfony/vendor/symfony/dependency-injection/Compiler/AutowirePass.php on line 236
  !!  
  !!  Call Stack:
  !!      0.0004     403344   1. {main}() /var/www/symfony/bin/console:0
  !!      0.1875    2144496   2. Symfony\Bundle\FrameworkBundle\Console\Application-&gt;run($input = class Symfony\Component\Console\Input\ArgvInput 
  !!      5.8396   32162400  18. Symfony\Component\DependencyInjection\Compiler\AutowirePass-&gt;Symfony\Component\DependencyInjection\Compiler\{closure:/var/www/symfony/vendor/symfony/dependency-injection/Compiler/AutowirePass.php:229-241}() /var/www/symfony/vendor/symfony/dependency-injection/Compiler/AutowirePass.php:261
  !!  
  !!  
  !!  In AutowirePass.php line 236:
  !!                                                                                 
  !!    Error: Method class@anonymous::__toString() must not throw an exception, ca  
  !!    ught Symfony\Component\DependencyInjection\Exception\AutowiringFailedExcept  
  !!    ion:                                                                         
  !!                                                                                 
  !!  
  !!  
  Script @auto-scripts was called via post-install-cmd</code></pre>
  </div>
  </div>
  </p>
  <p>I tried to follow this <a href="https://github.com/symfony/symfony/issues/33984" rel="noreferrer">issue</a> but nothing works (not work in develop for me)</p>
  <p>My composer.json</p>
  <pre><code>{
      &quot;type&quot;: &quot;project&quot;,
      &quot;license&quot;: &quot;proprietary&quot;,
      &quot;require&quot;: {
          &quot;php&quot;: &quot;^7.1.3&quot;,
          &quot;ext-iconv&quot;: &quot;*&quot;,
          &quot;accord/mandrill-swiftmailer-bundle&quot;: &quot;^1.3&quot;,
          &quot;api-platform/api-pack&quot;: &quot;^1.1&quot;,
          &quot;composer/package-versions-deprecated&quot;: &quot;1.11.99.1&quot;,
          &quot;doctrine/doctrine-bundle&quot;: &quot;^1.0&quot;,
          &quot;doctrine/doctrine-migrations-bundle&quot;: &quot;^2.2&quot;,
          &quot;doctrine/orm&quot;: &quot;^2.7&quot;,
          &quot;friendsofsymfony/ckeditor-bundle&quot;: &quot;^2.1&quot;,
          &quot;friendsofsymfony/user-bundle&quot;: &quot;~2.0&quot;,
          &quot;knplabs/knp-paginator-bundle&quot;: &quot;^4.0&quot;,
          &quot;paragonie/random_compat&quot;: &quot;^2.0&quot;,
          &quot;ramsey/uuid-doctrine&quot;: &quot;^1.4&quot;,
          &quot;sensio/framework-extra-bundle&quot;: &quot;^5.1&quot;,
          &quot;sentry/sentry-symfony&quot;: &quot;^3.1&quot;,
          &quot;stof/doctrine-extensions-bundle&quot;: &quot;^1.3&quot;,
          &quot;symfony/asset&quot;: &quot;^4.1&quot;,
          &quot;symfony/console&quot;: &quot;^4.1&quot;,
          &quot;symfony/dotenv&quot;: &quot;^4.1&quot;,
          &quot;symfony/expression-language&quot;: &quot;^4.1&quot;,
          &quot;symfony/flex&quot;: &quot;^1.0&quot;,
          &quot;symfony/form&quot;: &quot;^4.1&quot;,
          &quot;symfony/framework-bundle&quot;: &quot;^4.1&quot;,
          &quot;symfony/lts&quot;: &quot;^4@dev&quot;,
          &quot;symfony/monolog-bundle&quot;: &quot;^3.1&quot;,
          &quot;symfony/process&quot;: &quot;^4.1&quot;,
          &quot;symfony/security-bundle&quot;: &quot;^4.1&quot;,
          &quot;symfony/serializer-pack&quot;: &quot;*&quot;,
          &quot;symfony/swiftmailer-bundle&quot;: &quot;^3.1&quot;,
          &quot;symfony/translation&quot;: &quot;^4.1&quot;,
          &quot;symfony/twig-bundle&quot;: &quot;^4.1&quot;,
          &quot;symfony/validator&quot;: &quot;^4.1&quot;,
          &quot;symfony/web-link&quot;: &quot;^4.1&quot;,
          &quot;symfony/webpack-encore-pack&quot;: &quot;*&quot;,
          &quot;symfony/yaml&quot;: &quot;^4.1&quot;,
          &quot;vich/uploader-bundle&quot;: &quot;^1.9&quot;
      },
      &quot;require-dev&quot;: {
          &quot;hautelook/alice-bundle&quot;: &quot;^2.0&quot;,
          &quot;doctrine/data-fixtures&quot;: &quot;^1.3&quot;,
          &quot;behat/behat&quot;: &quot;^3.4&quot;,
          &quot;symfony/debug-pack&quot;: &quot;*&quot;,
          &quot;symfony/maker-bundle&quot;: &quot;^1.0&quot;,
          &quot;symfony/phpunit-bridge&quot;: &quot;^4.1&quot;,
          &quot;symfony/profiler-pack&quot;: &quot;*&quot;,
          &quot;symfony/test-pack&quot;: &quot;^1.0&quot;,
          &quot;symfony/web-server-bundle&quot;: &quot;^4.1&quot;
      },
      &quot;config&quot;: {
          &quot;preferred-install&quot;: {
              &quot;*&quot;: &quot;dist&quot;
          },
          &quot;sort-packages&quot;: true
      },
      &quot;autoload&quot;: {
          &quot;psr-4&quot;: {
              &quot;App\\&quot;: &quot;src/&quot;
          }
      },
      &quot;autoload-dev&quot;: {
          &quot;psr-4&quot;: {
              &quot;App\\Tests\\&quot;: &quot;tests/&quot;
          }
      },
      &quot;replace&quot;: {
          &quot;symfony/polyfill-iconv&quot;: &quot;*&quot;,
          &quot;symfony/polyfill-php71&quot;: &quot;*&quot;,
          &quot;symfony/polyfill-php70&quot;: &quot;*&quot;,
          &quot;symfony/polyfill-php56&quot;: &quot;*&quot;
      },
      &quot;scripts&quot;: {
          &quot;auto-scripts&quot;: {
              &quot;cache:clear&quot;: &quot;symfony-cmd&quot;,
              &quot;assets:install %PUBLIC_DIR%&quot;: &quot;symfony-cmd&quot;
          },
          &quot;post-install-cmd&quot;: [
              &quot;@auto-scripts&quot;
          ],
          &quot;post-update-cmd&quot;: [
              &quot;@auto-scripts&quot;
          ]
      },
      &quot;conflict&quot;: {
          &quot;symfony/symfony&quot;: &quot;*&quot;
      },
      &quot;extra&quot;: {
          &quot;symfony&quot;: {
              &quot;allow-contrib&quot;: false
          }
      }
  }
  </code></pre>
  <p>If anyone has even a stupid idea, I'll take it. I've been stuck on it for a long time ...</p>