Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change class namespace rises coupling between objects violation #953

Open
6 tasks done
astronom opened this issue Apr 26, 2022 · 0 comments
Open
6 tasks done

Change class namespace rises coupling between objects violation #953

astronom opened this issue Apr 26, 2022 · 0 comments

Comments

@astronom
Copy link

  • 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".
@ravage84 ravage84 added this to the 2.x (unspecific) milestone May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants