yireo / Yireo_ExtensionChecker

Magento 2 module to check upon the code of Magento 2 modules from the CLI
90 stars 16 forks source link

Wrong check result #44

Open iranimij opened 12 months ago

iranimij commented 12 months ago

I have two modules, one in app/code and another one in my custom route src that is defined correctly in the main composer. I have created a module in src folder and then required a constant from the src folder into the module that is in app/code folder.

so theoretically the module that is in app/code should have a dependency

but in practice Yireo extension checker does not find it and I think it's a bug.

jissereitsma commented 12 months ago

I think it is a bug too. Could you share the PHP code with which you have linked module A to module B? If you are worried about namespaces uncovering specific details, just rewrite them to dummy namespaces.

iranimij commented 11 months ago

Below code is from a module inside app/code and it uses Mainwebsite\Configuration\Model\GeneralConfig that is in src folder.

<?php

namespace Mainwebsite\AsyncTasks\Model;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Sales\Api\OrderRepositoryInterface;
use Mainwebsite\Configuration\Model\GeneralConfig;

echo GeneralConfig::SECOND_SLACK_URL;

May I work on this issue and send my PR ?

jissereitsma commented 11 months ago

Thanks. Yes, this looks pretty much like a bug. It should be picking up on that constant without an issue. Feel free to work on it! :) I'm these weeks pretty much locked up in work, so can't work on it myself quickly.

akosglue commented 4 months ago

It might be solved in the meantime. I have set up the same module configuration as in your issue @iranimij One module in the app/code folder, like a traditional module. The other one is in the src folder, loaded by psr-4 via the magento composer.json (the modules, of course, have their own composer.json as well) Then I added a static constant reference in the module in the app/code folder. It is working obviously because I tested it. Then I ran the dependency checker and it listed the module that sits in the src folder. Bottom line: I cannot reproduce the issue, it works as intended.