-
Notifications
You must be signed in to change notification settings - Fork 685
Support PHP 8.4 interface property hooks #11569
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
Conversation
|
I found these snippets: https://psalm.dev/r/6e926c6c01<?php
declare(strict_types=1);
interface TestInterface {
public string $test { get; }
}
class Test implements TestInterface {
public string $test = 'Hello world.';
}
print_r(new Test()->test); |
|
Hey @danog, is there anything else needed to be able to merge in this PR? Without it, we cannot use Psalm on all PHP 8.4 codebases. Thanks! |
|
I firmly do approve this PR! :) #needed |
|
+1 @danog this is getting really of a blocker now :/ |
|
Thank you, awesome! |
|
@danog did the tests pass without errors? Because now the CI fails due to issues from this PR (e.g. MissingConstructor,...), see also https://psalm.dev/r/25761f9365 (nvm the first 3 that's bc of PHP 8.2 on psalm.dev) |
|
I found these snippets: https://psalm.dev/r/25761f9365<?php
interface I {
public string $name { get; set; }
}
class A implements I {
private string $_name = "hello";
public string $name {
get => $this->_name;
set => $this->_name = $value;
}
}
function test(I $rw): void {
$rw->name = "test";
echo $rw->name;
} |
Just FYI this PR (and the original issue it was addressing) was regarding support for properties on interfaces, not class property hooks. If Psalm is failing on those then that would need a separate issue. |
|
I found these snippets: https://psalm.dev/r/25761f9365<?php
interface I {
public string $name { get; set; }
}
class A implements I {
private string $_name = "hello";
public string $name {
get => $this->_name;
set => $this->_name = $value;
}
}
function test(I $rw): void {
$rw->name = "test";
echo $rw->name;
} |
Fix failing tests from github.com/vimeo/pull/11569
Fix failing tests from github.com/vimeo/pull/11569
|
These tests added by this PR:
both fail with MissingConstructor just like on psalm.dev... (I "fixed" in 31fc5d0) Additionally shepherd/psalm fail with
all of which were added by this PR |
Adds support for PHP 8.4 property hooks, specifically addressing the parser issue being triggered for property hooks on interfaces.
This is the syntax that this PR adds support for: https://psalm.dev/r/6e926c6c01
Closes #11452.