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

Assertions used as function argument are repeated #9715

Open
danog opened this issue Apr 26, 2023 · 1 comment
Open

Assertions used as function argument are repeated #9715

danog opened this issue Apr 26, 2023 · 1 comment
Labels

Comments

@danog
Copy link
Collaborator

danog commented Apr 26, 2023

Similar to #9708, https://psalm.dev/r/3ad2966caa

@danog danog added the bug label Apr 26, 2023
@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/3ad2966caa
<?php

class a {
    public ?int $_id = null;
	/**
	 * @psalm-mutation-free
	 *
	 * @psalm-assert !null $this->_id
	 *
	 * @return int
	 */
	public function getIdAssert(): int {
		$id = $this->_id;
		assert($id !== null);
		return $id;
	}
    public function t(): void {
        self::test($this->getIdAssert());
    }
    public function test(int $a): void {}
}
Psalm output (using commit c059388):

ERROR: RedundantConditionGivenDocblockType - 18:27 - Docblock-defined type int for $this->_id is never null

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

No branches or pull requests

1 participant