Skip to content

match expression type resolution regression (2.3) #15433

Closed
phpstan/phpstan-src
#6708

Description

@LastDragon-ru

Bug report

Since 2.3 the $a is mixed, but it should be array<mixed> (if/else works as expected).

interface A {
	public mixed $a {get;}
}

function bug(A $v): void
{
	$a = match (true) {
		is_array($v->a) => $v->a,
		default         => [$v->a],
	};

	assertType('array<mixed>', $a); // Expected type array<mixed>, actual: mixed
}

Code snippet that reproduces the problem

https://phpstan.org/r/c736dd2b-ab61-4553-bad1-83ccffc591fe

Expected output

No error.

Did PHPStan help you today? Did it make you happy in any way?

🥳

Activity

  1. drewmt commented on Oct 8, 2026

    @drewmt

    Fixed in phpstan/phpstan-src#6708. The regression covers ordinary properties and PHP 8.4 property hooks, including native types, while preserving void-call behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions