Bug report
When an extension implements getAllowedSubTypes to define that the only allowed subtypes of an interface are a given class and an enum, I would except that handling each case of the enum would leave us with a type refined to the other class, just like it does for union types.
Code snippet that reproduces the problem
https://phpstan.org/r/deeced13-4be2-4ce2-86d8-ee547748f18a (with the extension)
https://phpstan.org/r/22934d26-cb7c-48d7-b084-f0254926624f (with @phpstan-sealed)
Expected output
When running that with the jiripudil/phpstan-sealed-classes extension installed, I would expect no error.
This extension defines an AllowedSubTypesClassReflectionExtension reading the Sealed attribute to provide the allowed subtypes.
Replacing the sealed interface (for which the extension defines the 2 allowed subtypes) with a union type of the 2 allowed subtypes does not report the error: https://phpstan.org/r/0c528e9b-ab4d-4811-ba45-dbe16b42ffac
Did PHPStan help you today? Did it make you happy in any way?
No response