Bug report
Constants inside a parameter typehint are unable to reference each other. Whereas this would be a nice feature, the bug is that PHPstan locks up and fails to respond.
Code snippet that reproduces the problem
<?php declare(strict_types = 1);
final class HelloWorld
{
/** @var int<0, self::MAX_DEPOSIT> */
public const MIN_DEPOSIT = 1_000;
/** @var int<self::MIN_DEPOSIT, max> */
public const MAX_DEPOSIT = 20_000;
}
Unable to post a demo link due to the website erroring when using this code. Note that changing self::MIN_DEPOSIT to any integer value below self::MAX_DEPOSIT allows it to work without errors as expected.
Expected output
PHPStan should warn about the circular reference, or use it.
Did PHPStan help you today? Did it make you happy in any way?
I'd be interested in attempting a fix to this one too. My time is stretched pretty thin right now, but if you're able to point me in the right direction then I will follow that time permitting.
Bug report
Constants inside a parameter typehint are unable to reference each other. Whereas this would be a nice feature, the bug is that PHPstan locks up and fails to respond.
Code snippet that reproduces the problem
Unable to post a demo link due to the website erroring when using this code. Note that changing
self::MIN_DEPOSITto any integer value belowself::MAX_DEPOSITallows it to work without errors as expected.Expected output
PHPStan should warn about the circular reference, or use it.
Did PHPStan help you today? Did it make you happy in any way?
I'd be interested in attempting a fix to this one too. My time is stretched pretty thin right now, but if you're able to point me in the right direction then I will follow that time permitting.