Skip to content

Commit

Permalink
OXDEV-7644 Add deptrac to static analyzer
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaIvanovski committed Dec 19, 2023
1 parent 2ccd852 commit d8c2ecd
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 38 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"static": [
"@phpcs",
"@phpstan",
"@phpmd"
"@phpmd",
"@deptrac"
],

"phpunit": "vendor/bin/phpunit --bootstrap=/var/www/source/bootstrap.php --config=tests/",
Expand Down
2 changes: 0 additions & 2 deletions deptrac.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
deptrac:
paths:
- ./src/
# - ./vendor/oxid-esales/oxideshop-ce/source/
# - ./vendor/oxid-esales/oxideshop-unified-namespace-generator/
layers:
- name: Controller
collectors:
Expand Down
11 changes: 1 addition & 10 deletions src/Module/Controller/ModuleSettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@

namespace OxidEsales\GraphQL\ConfigurationAccess\Module\Controller;

use OxidEsales\Eshop\Application\Model\Basket;
use OxidEsales\EshopCommunity\Internal\Transition\Utility\BasicContextInterface;
use OxidEsales\GraphQL\ConfigurationAccess\Module\Service\ModuleSettingServiceInterface;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\DataType\BooleanSetting;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\DataType\FloatSetting;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\DataType\IntegerSetting;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\DataType\SettingType;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\DataType\StringSetting;
use OxidEsales\GraphQL\ConfigurationAccess\Shop\Infrastructure\ShopSettingRepository;
use TheCodingMachine\GraphQLite\Annotations\HideIfUnauthorized;
use TheCodingMachine\GraphQLite\Annotations\Logged;
use TheCodingMachine\GraphQLite\Annotations\Mutation;
Expand All @@ -27,13 +24,7 @@
final class ModuleSettingController
{
public function __construct(
private ModuleSettingServiceInterface $moduleSettingService, //must be ok
// @phpstan-ignore-next-line
private ShopSettingRepository $settingRepository, //must fail
// @phpstan-ignore-next-line
private Basket $basket, //must fail
// @phpstan-ignore-next-line
private BasicContextInterface $basicContext //must fail
private ModuleSettingServiceInterface $moduleSettingService
) {
}

Expand Down
17 changes: 4 additions & 13 deletions src/Module/Service/ModuleSettingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@

namespace OxidEsales\GraphQL\ConfigurationAccess\Module\Service;

use OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController;
use OxidEsales\Eshop\Application\Model\Basket;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Dao\ModuleConfigurationDaoInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Facade\{
ModuleSettingServiceInterface as ShopModuleSettingServiceInterface};
use OxidEsales\EshopCommunity\Internal\Framework\Module\Setting\Setting;
use OxidEsales\EshopCommunity\Internal\Transition\Utility\BasicContextInterface;
use OxidEsales\GraphQL\ConfigurationAccess\Module\Controller\ModuleSettingController;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\DataType\BooleanSetting;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\DataType\FloatSetting;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\DataType\IntegerSetting;
Expand All @@ -27,16 +24,10 @@
final class ModuleSettingService implements ModuleSettingServiceInterface
{
public function __construct(
private CollectionEncodingServiceInterface $jsonService, //must be ok
private ShopModuleSettingServiceInterface $moduleSettingService, //must be ok
private ModuleConfigurationDaoInterface $moduleConfigurationDao, //must be ok
private BasicContextInterface $basicContext, //must be ok
// @phpstan-ignore-next-line
private Basket $basket, //must fail
// @phpstan-ignore-next-line
private AdminDetailsController $adminDetailsController, //must fail
// @phpstan-ignore-next-line
private ModuleSettingController $moduleSettingController //must fail
private CollectionEncodingServiceInterface $jsonService,
private ShopModuleSettingServiceInterface $moduleSettingService,
private ModuleConfigurationDaoInterface $moduleConfigurationDao,
private BasicContextInterface $basicContext
) {
}

Expand Down
15 changes: 3 additions & 12 deletions src/Shop/Infrastructure/ShopSettingRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@
namespace OxidEsales\GraphQL\ConfigurationAccess\Shop\Infrastructure;

use Doctrine\DBAL\Result;
use OxidEsales\Eshop\Application\Model\Basket;
use OxidEsales\EshopCommunity\Internal\Framework\Config\Dao\ShopConfigurationSettingDaoInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Config\DataObject\ShopConfigurationSetting;
use OxidEsales\EshopCommunity\Internal\Framework\Database\QueryBuilderFactoryInterface;
use OxidEsales\EshopCommunity\Internal\Transition\Utility\BasicContextInterface;
use OxidEsales\GraphQL\ConfigurationAccess\Module\Controller\ModuleSettingController;
use OxidEsales\GraphQL\ConfigurationAccess\Module\Service\ModuleSettingService;
use OxidEsales\GraphQL\ConfigurationAccess\Shared\Enum\FieldType;
use OxidEsales\GraphQL\ConfigurationAccess\Shop\Exception\NoSettingsFoundForShopException;
use OxidEsales\GraphQL\ConfigurationAccess\Shop\Exception\WrongSettingTypeException;
Expand All @@ -25,15 +22,9 @@
final class ShopSettingRepository implements ShopSettingRepositoryInterface
{
public function __construct(
private BasicContextInterface $basicContext, //must be ok
private QueryBuilderFactoryInterface $queryBuilderFactory, //must be ok
private ShopConfigurationSettingDaoInterface $configurationSettingDao, //must be ok
// @phpstan-ignore-next-line
private Basket $basket, //must be ok
// @phpstan-ignore-next-line
private ModuleSettingController $moduleSettingController, //must fail
// @phpstan-ignore-next-line
private ModuleSettingService $moduleSettingService, //must fail
private BasicContextInterface $basicContext,
private QueryBuilderFactoryInterface $queryBuilderFactory,
private ShopConfigurationSettingDaoInterface $configurationSettingDao
) {
}

Expand Down

0 comments on commit d8c2ecd

Please sign in to comment.