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

Property hooks does not work with default value #11355

Open
jasverix opened this issue Mar 10, 2025 · 2 comments
Open

Property hooks does not work with default value #11355

jasverix opened this issue Mar 10, 2025 · 2 comments
Milestone

Comments

@jasverix
Copy link

Ref this snippet https://psalm.dev/r/7134d59ab0

That is a very well working PHP code. I just want to define a default to prevent uninitialized error message.

Copy link

I found these snippets:

https://psalm.dev/r/7134d59ab0
<?php

class Test {
	public array $Ids = [] {
    	set(array|int|string $value) {
        	if(is_array($value)) $this->Ids = $value;
            else $this->Ids = [$value];
        }
    }
}
Psalm encountered an internal error:

/vendor/vimeo/psalm/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php: Unrecognized functionlike of type PhpParser\Node\PropertyHook

@orklah orklah added this to the PHP 8.4 milestone Mar 10, 2025
@jasverix
Copy link
Author

I just registered it, and thought it was because of the default value. And it may be. But I think this issue is the same as #11208

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

No branches or pull requests

2 participants