Add option to define shop root#73
Conversation
- fix: headings not looking good with module icon - fix: module images being too long - fix: remove unnecessary html containers - fix: remove inline css - fix: change loading text to german equivelant - style: change the text cursor of badges to default cursor - style: cleaned up some unnecessary code
|
Psalm is saying ERROR: PossiblyNullArgument - src/Classes/App.php:45:27 - Argument 1 of rtrim cannot be null, possibly null value provided (see https://psalm.dev/078)
: rtrim(Config::getOption('shopRoot'), '/\\');but
So I believe Psalm has triggered a false positive and this static function is fine. |
But Config::getOption() dose: return !empty($configuration[$option]) ? $configuration[$option] : null; // Null ist possibleand not return !empty($configuration[$option]); |
|
That's no problem since public static function getShopRoot(): string
{
$shopRoot = empty(null)
? realpath(__DIR__ . '/../../../')
: rtrim(Config::getOption('shopRoot'), '/\\');
return $shopRoot;
}
|
|
I have seen you commit Automatically determine the shop root, but I thing I prefer Refactor, because there are situations where the mmlc is invoked by a script and global |
|
Some things I've noticed:
|
Due to my file structure
App::getShopRootreturns the wrong directory.[...]/grandeljay/modified-shop(contains a symbolic link to MMLC directory)[...]/RobinTheHood/ModifiedModuleLoaderClientIn this setup
App:getShopRootreturnsrealpath(__DIR__ . '/../../../')which in my case is[...]/RobinTheHoodinstead of[...]/grandeljay/modified-shop.I think it would be best to allow an override to this behaviour.