You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my code, an abstract class uses a constant that refers to itself, forcing the subclass to mandatorily reassign it. This causes a memory leak issue in PHPStan, as the check gets stuck in an infinite loop.
Example:
abstract class AbstractClass
{
const BASE_URL = self::BASE_URL;
}
final class TestClass extends AbstractClass
{
const BASE_URL = 'http://example.com';
}
Bug report
In my code, an abstract class uses a constant that refers to itself, forcing the subclass to mandatorily reassign it. This causes a memory leak issue in PHPStan, as the check gets stuck in an infinite loop.
Example:
PHPStan version: 1.10.41
PHP version: 8.2
Operating System: MacOS 12.6.3
Code snippet that reproduces the problem
https://phpstan.org/r/8196a92c-91c1-475f-b322-4622fec090d2
Expected output
Recognition of self-referencing constants and reporting it as an error.
Cannot declare self-referencing constant self::BASE_URL
Did PHPStan help you today? Did it make you happy in any way?
No response
The text was updated successfully, but these errors were encountered: