-
Notifications
You must be signed in to change notification settings - Fork 114
Open
Description
| Subject | Details |
|---|---|
| Plugin | Php Inspections (EA Extended) 5.3.0 |
| Language level | PHP 8.4 |
Current behaviour
Inside a trait I have an argument typed like this ?self $self = null.
I have the following code that can fill $self if it's null
if ($self === null) {
try {
$self = new self();
} catch (ArgumentCountError) {
// If the constructor requires arguments, try to create it without calling the constructor
$reflection = new \ReflectionClass(self::class);
$self = $reflection->newInstanceWithoutConstructor();
}
}The new self() and $reflection->newInstanceWithoutConstructor(); are underlined with type not matching and possible false-positive warning.
Though, even in a Trait, self always equal self.
Expected behaviour
No warning
Environment details
Build #PS-252.23892.419
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels