Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in custom code produces seemingly unrelated message #2622

Closed
bobdenotter opened this issue Jun 11, 2021 · 0 comments · Fixed by #2623
Closed

Error in custom code produces seemingly unrelated message #2622

bobdenotter opened this issue Jun 11, 2021 · 0 comments · Fixed by #2623
Labels
🐛 tag: bug This is a bug.

Comments

@bobdenotter
Copy link
Member

bobdenotter commented Jun 11, 2021

If you're building a Bolt project, and you've unnoticedly made an error in your custom code, you'd expect a descriptive error.

For example, notice the trailing comma below (which is only valid in PHP 7.3 and up, not on 7.2)

<?php

namespace App;

use Bolt\Extension\BaseExtension;

class Extension extends BaseExtension
{
    public function getName(): string
    {
        return sprintf(
            '%s %s', 
            "foo", 
            "bar",
        );
    }
}

The error you're getting is this:

$ bin/console bolt:info

In DefinitionErrorExceptionPass.php line 54:

  Cannot autowire service "Bolt\Article\Controller\Upload": argument "$articleConfig" of method "__constr
  uct()" references class "Bolt\Article\ArticleConfig" but no such service exists.

This is terribly confusing, obviously.

PR with a fix is incoming.

Schermafbeelding 2021-06-11 om 13 55 30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 tag: bug This is a bug.
Projects
None yet
1 participant