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

#[Test] Not Suppressing PossiblyUnusedMethod #144

Open
Tigerman55 opened this issue Dec 21, 2023 · 4 comments · May be fixed by #145 or #146
Open

#[Test] Not Suppressing PossiblyUnusedMethod #144

Tigerman55 opened this issue Dec 21, 2023 · 4 comments · May be fixed by #145 or #146
Labels
enhancement New feature or request

Comments

@Tigerman55
Copy link

If I use the attribute #[Test] instead of testSomething(), the error PossiblyUnusedMethod is not suppressed.

@Tigerman55 Tigerman55 changed the title Test Attribute Not Suppressing PossiblyUnusedMethod #[Test] Not Suppressing PossiblyUnusedMethod Dec 21, 2023
@lotyp
Copy link

lotyp commented May 2, 2024

I have same issue:

Examples

throws PossiblyUnusedMethod:

    #[Test]
    public function it_gets_orm_from_facade_when_container_has_orm(): void
    {
		...
	}

works:

    /**
     * @test
     */
    #[Test]
    public function it_gets_orm_from_facade_when_container_has_orm(): void
    {

	}

@lotyp
Copy link

lotyp commented May 4, 2024

Duplicate issue: #131

@weirdan
Copy link
Member

weirdan commented May 4, 2024

The fix would be somewhere near these lines:

$specials = self::getSpecials($stmt_method);
$is_test = 0 === strpos($method_name_lc, 'test') || isset($specials['test']);
if (!$is_test) {
continue; // skip non-test methods
}

@weirdan weirdan added the enhancement New feature or request label May 4, 2024
@lotyp lotyp linked a pull request May 4, 2024 that will close this issue
@lotyp
Copy link

lotyp commented May 4, 2024

@weirdan Thanks for this tip! I have created PR: #145

I have tested it manually, on my code.

Please give suggestions, what do I need to change/add to get this merged.

@jack-worman jack-worman linked a pull request Aug 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants