Change class namespace rises coupling between objects violation
astronom opened this issue · comments
Aleksandr Manichev commented
- PHPMD version: 2.12.0
- PHP Version: 8.0.18
- Installation type: composer
- Operating System: Docker container php:8.0.17-fpm-alpine3.15
Current Behavior
Before changes. SomeHandlerTest has coupling between objects - 12 (13 is the max default value)
namespace App\Tests\functional\Action\Handler\SomeHandler;
use ....;
use App\Tests\functional\ApiTestCase;
final class SomeHandlerTest extends ApiTestCase
{
.... some code here
}
PHPMD reports that there is no violations
Then we want to replace namespace App\Tests\functional
to App\Tests\Functional
After changes. No other code changed
namespace App\Tests\Functional\Action\Handler\SomeHandler;
use ....;
use App\Tests\Functional\ApiTestCase;
final class SomeHandlerTest extends ApiTestCase
{
.... some code here
}
PHPMD reports:
FILE: /var/www/html/tests/functional/Action/Handler/Player/PersonalBonus/SomeHandlerTest.php
----------------------------------------------------------------------------------------------------------
24 | VIOLATION | The class CheckPersonalBonusHandlerTest has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
24 | VIOLATION | The class CheckPersonalBonusHandlerTest has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13.
vendor/bin/phpmd /var/www/html/tests/functional/Action/Handler/SomeHandlerTest.php ansi design
On the next run there is no violations
Expected Behavior
Expect no vioalations
Checks before submitting
- Be sure that there isn't already an issue about this. See: Issues list
- Be sure that there isn't already a pull request about this. See: Pull requests
- I have added every step to reproduce the bug.
- If possible I added relevant code examples.
- This issue is about 1 bug and nothing more.
- The issue has a descriptive title. For example: "JSON rendering failed on Windows for filenames with space".