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

@psalm-assert-if-true doesn’t work for $this properties #1994

Closed
Erwyn opened this issue Aug 9, 2019 · 1 comment
Closed

@psalm-assert-if-true doesn’t work for $this properties #1994

Erwyn opened this issue Aug 9, 2019 · 1 comment
Labels

Comments

@Erwyn
Copy link

Erwyn commented Aug 9, 2019

Hello there,

In the documentation about assertions it is mentioned that "Psalm has three docblock annotations that allow you to specify that a function verifies facts about variables and properties:"(https://psalm.dev/docs/annotating_code/adding_assertions/)

I tried to make it work and look for it in psalm's codebase but couldn't find how to do so with properties. Here is an example: https://psalm.dev/r/3c3a6cedfe

Am I doing something wrong ?

@muglug muglug changed the title Assertions on properties @psalm-assert-if-true doesn’t work for $this properties Aug 9, 2019
@muglug muglug added the bug label Aug 9, 2019
@muglug
Copy link
Collaborator

muglug commented Aug 9, 2019

It's a bug (it works with @psalm-assert)

@muglug muglug closed this as completed in 460120e Aug 10, 2019
LeSuisse pushed a commit to Enalean/tuleap that referenced this issue Aug 12, 2019
This change is part of story #12537

Due to an issue with Psalm we introduced redundant null checks
(vimeo/psalm#1994). Now that we know it
actually is a bug and are waiting for the release of the patch, a
@psalm-suppress comment has been added referencing said issue. Once
Psalm is updated, the suppress can be removed and it should still work.

Change-Id: I0384b17f7b3d064042cd2c44d2445910547eb8b8
2e3s pushed a commit to 2e3s/psalm that referenced this issue Sep 29, 2019
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

2 participants