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
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!
Comments
-
can you share your
./src/Pyz/Zed/Cart/CartDependencyProvider.php
?0 -
-
Do you have an interface for that Bridge?
CartToQuoteFacadeBridge
🤔The failing is because
BridgeMethodsRule::getBridgedInterfaceReflection()
is returning anull
, and that’s being used in BridgeMethodsRule:98 when calling thefindNotMatchingMethodsForBridgeInterface
that expects aReflectionClass
and it doesn’t allows null. That’s why you get that TypeError.0 -
yes... i have an interface...
Do u think is that the problem?0 -
The question is: “why is
getBridgedInterfaceReflection
returning null?”0 -
yes, clear... i know.. but why it happend?
0 -
yes, right.. why returning null!?
0 -
Can you share the
CartToQuoteFacadeBridge
? and maybe also the interface?0 -
-
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; }
0 -
ok, but then i have also to call the parent construct or not?
0 -
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 bridging0 -
ok, i will try.. thanks
0 -
i give u a feedback if it works
0 -
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); }
0 -
YES... U are right!!! it works!
Thank u very much..
0 -
Something new that we just learned today 🙂
0 -
Absolut...
"you never stop learning" !
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random