php-coupling-detector
php-coupling-detector copied to clipboard
[Experimental] Detect all the coupling issues of your project with respect to the coupling rules you have defined.
``` $builder->only([ 'Smallable\Produit\ProduitBundle\Entity', 'Smallable\Produit\AkeneoBundle', 'Symfony', 'Doctrine', ])->in('Smallable\Produit\AkeneoBundle\Migration'), ``` result in the error ``` Node Smallable\Produit\AkeneoBundle\Migration\ProductTermes\ProductTermsBuilder does not respect the rule Smallable\Produit\AkeneoBundle because of the tokens: * Smallable\Produit\ProduitBundle\Entity\Lang * Smallable\Produit\ProduitBundle\Entity\Product ```
Example : ```php $rules = [ $builder->only([ 'Akeneo\Pim\ApiClient', 'Akeneo\PimEnterprise\ApiClient', 'Symfony', 'Doctrine', 'PHPUnit', 'OldSound\RabbitMqBundle', 'PhpAmqpLib', 'Psr', 'Prophecy', 'JMS\Serializer', 'Http\Discovery', 'GuzzleHttp\Psr7', ])->in('Smallable\Produit\AkeneoBundle'), $builder->only([ 'Smallable\Produit\ProduitBundle\Entity' // this should be possible, and then it...
the config ``` $builder->only([''])->in('Foo'), ``` the error ``` jjanvier:lambdas$ vendor/bin/php-coupling-detector detect --config-file=.phpcd ≠ ? {master} Parsing 11 nodes... Checking 3 rules... PHP Warning: strpos(): Empty needle in /home/jjanvier/workspaces/phpstorm/perso/c2p/lambdas/vendor/akeneo/php-coupling-detector/src/RuleChecker.php on line...
the conf ``` $builder->only([])->in('Jjanvier\C2P\Common'), ``` the error ``` jjanvier:lambdas$ vendor/bin/php-coupling-detector detect --config-file=.phpcd In RuleBuilder.php line 56: Can not create a rule without any requirement defined previously. detect [-c|--config-file CONFIG-FILE] [-f|--format...
``` jjanvier:lambdas$ vendor/bin/php-coupling-detector detect . In DetectCommand.php line 146: The configuration file "/home/jjanvier/workspaces/phpstorm/perso/c2p/lambdas/./.php_cd" does not exit detect [-c|--config-file CONFIG-FILE] [-f|--format FORMAT] [--] [] ```
Default dir should be `.` ``` jjanvier:lambdas$ vendor/bin/php-coupling-detector detect PHP Fatal error: Uncaught TypeError: is_file() expects parameter 1 to be a valid path, null given in /home/jjanvier/workspaces/phpstorm/perso/c2p/lambdas/vendor/akeneo/php-coupling-detector/src/Console/Command/DetectCommand.php:92 Stack trace: #0...
Currently the same Rule class is used for every rule type. As we move more logic to the domain it would be clearer to have a dedicated class by type.
Currently, most of the application logic is located in service-like classes (`CouplingDetector` and `RuleChecker`) while the domain is dumb. It would make sense to let the domain be responsible for...
We already have a Domain namespace. Could be interesting to also have Application (especially if we use a message bus at some point) and Infrastructure (Commands, Formatters, Parsers...)