What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Good Morning everyone, i have a strange error from Architecture check that run as git pre-commit ho

Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

Good Morning everyone,

i have a strange error from Architecture check that run as git pre-commit hook.. Here the error:

[Command "Architecture check" (file: ./src/Pyz/Zed/Cart/CartDependencyProvider.php) fails] PHP Fatal error:  Uncaught TypeError: Argument 2 passed to ArchitectureSniffer\Common\Bridge\BridgeMethodsRule::findNotMatchingMethodsForBridgeInterface() must be an instance of ReflectionClass, null given, called in /Users/gpiemontese/Projects/projekt.local/project/vendor/spryker/architecture-sniffer/src/Common/Bridge/BridgeMethodsRule.php on line 98 and defined in /Users/gpiemontese/Projects/projekt.local/project/vendor/spryker/architecture-sniffer/src/Common/Bridge/BridgeMethodsRule.php:177
Stack trace:
#0 /Users/gpiemontese/Projects/projekt.local/project/vendor/spryker/architecture-sniffer/src/Common/Bridge/BridgeMethodsRule.php(98): ArchitectureSniffer\Common\Bridge\BridgeMethodsRule->findNotMatchingMethodsForBridgeInterface(Object(PHPMD\Node\InterfaceNode), NULL)
#1 /Users/gpiemontese/Projects/projekt.local/project/vendor/spryker/architecture-sniffer/src/Common/Bridge/BridgeMethodsRule.php(61): ArchitectureSniffer\Common\Bridge\BridgeMethodsRule->verifyInterface in /Users/gpiemontese/Projects/projekt.local/project/vendor/spryker/architecture-sniffer/src/Common/Bridge/BridgeMethodsRule.php on line 177

I don't understand where is the problem... Has anyone any idea how to fix it?

Thank u all in advance!

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Tech Lead Spryker Solution Partner Posts: 213 🧑🏻‍🚀 - Cadet

    can you share your ./src/Pyz/Zed/Cart/CartDependencyProvider.php ?

  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    Gerne 🙂

  • Tech Lead Spryker Solution Partner Posts: 213 🧑🏻‍🚀 - Cadet
    edited September 2021

    Do you have an interface for that Bridge? CartToQuoteFacadeBridge 🤔

    The failing is because BridgeMethodsRule::getBridgedInterfaceReflection() is returning a null , and that’s being used in BridgeMethodsRule:98 when calling the findNotMatchingMethodsForBridgeInterface that expects a ReflectionClass and it doesn’t allows null. That’s why you get that TypeError.

  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    yes... i have an interface...
    Do u think is that the problem?

  • Tech Lead Spryker Solution Partner Posts: 213 🧑🏻‍🚀 - Cadet

    The question is: “why is getBridgedInterfaceReflection returning null?”

  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    yes, clear... i know.. but why it happend?

  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    yes, right.. why returning null!?

  • Tech Lead Spryker Solution Partner Posts: 213 🧑🏻‍🚀 - Cadet

    Can you share the CartToQuoteFacadeBridge ? and maybe also the interface?

  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet
  • Tech Lead Spryker Solution Partner Posts: 213 🧑🏻‍🚀 - Cadet
    edited September 2021

    I know it will sound stupid, but try adding the constructor to your child class (I know, it’s not necessary from code perspective, but maybe the sniffer is not that clever after all…)

    /**
     * @param \Spryker\Zed\Quote\Business\QuoteFacadeInterface $quoteFacade
     */
    public function __construct($quoteFacade)
    {
        $this->quoteFacade = $quoteFacade;
    }
    
  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    ok, but then i have also to call the parent construct or not?

  • Tech Lead Spryker Solution Partner Posts: 213 🧑🏻‍🚀 - Cadet

    becase, according with that method to avoid getting null you need:
    1. a constructor
    2. a PHPDoc on the constructor
    3. one argument on the constructor
    4. that argument must be the interface of the class that you are bridging

  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    ok, i will try.. thanks

  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    i give u a feedback if it works

  • Tech Lead Spryker Solution Partner Posts: 213 🧑🏻‍🚀 - Cadet

    yes, yes, that’s correct, using the parent constructor would better 🙂

    /**
     * @param \Spryker\Zed\Quote\Business\QuoteFacadeInterface $quoteFacade
     */
    public function __construct($quoteFacade)
    {
        parent::__construct($quoteFacade);
    }
    
  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet
    edited September 2021

    YES... U are right!!! it works!

    Thank u very much..

  • Tech Lead Spryker Solution Partner Posts: 213 🧑🏻‍🚀 - Cadet

    Something new that we just learned today 🙂

  • Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    Absolut...

    "you never stop learning" !

Welcome!

It looks like you're new here. Sign in or register to get started.