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

Compare class-names case insensitive #42

Closed
wants to merge 4 commits into from

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Apr 26, 2024

No description provided.

@TomasVotruba
Copy link
Owner

Thanks! 😊

Could you add simple test so we don't remove it in the future?

@staabm
Copy link
Contributor Author

staabm commented Apr 26, 2024

here we go :)

@staabm
Copy link
Contributor Author

staabm commented Apr 29, 2024

@TomasVotruba should be good to go

use TomasVotruba\ClassLeak\Tests\AbstractTestCase;
use TomasVotruba\ClassLeak\ValueObject\FileWithClass;

final class PossiblyUnusedClassesFilterTest extends AbstractTestCase
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to include this test as a single test fixture in the rule itselft, instead of adding a new unit test.
It would be easier to read for me later.

Copy link
Contributor Author

@staabm staabm Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the class is used at the top level CheckCommand which means I would need to test at the command level.. with all its dependencies?
are you sure we want that ? :)

$possiblyUnusedFilesWithClasses = $this->possiblyUnusedClassesFilter->filter(
$existingFilesWithClasses,
$usedNames,
$typesToSkip,
$suffixesToSkip,
$attributesToSkip
);

Copy link
Owner

@TomasVotruba TomasVotruba Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. What I really want is the test to be simpler, as reading is quite complex now :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On other hand, we should not encourage using wrong class casing. This should be spotted and trigger the class name fix instead.

Copy link
Contributor Author

@staabm staabm Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpstan itself does already error about class-name-case-mismatches. I think its not the job of class-leak to report it as a problem

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, this tool builds on top of PHPStan best quality code. Let PHPStan handle these 👍

@TomasVotruba
Copy link
Owner

TomasVotruba commented May 2, 2024

Closing as outsourcing responsibility to PHPStan 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants