Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhanImpossibleCondition: testing for initialized static variable #4839

Open
mokraemer opened this issue Feb 28, 2024 · 0 comments
Open

PhanImpossibleCondition: testing for initialized static variable #4839

mokraemer opened this issue Feb 28, 2024 · 0 comments

Comments

@mokraemer
Copy link

This class produces an impossible condition, which may lead to remove the empty statement.

PhanImpossibleCondition Impossible attempt to cast self::$inst of type \util\A to empty

class A{

	private static self $inst;

	public function __construct(){
		self::$inst = $this;
	}

	public static function test(): bool{
		return !empty(self::$inst);
	}
}

var_dump(A::test());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant