php-language-server icon indicating copy to clipboard operation
php-language-server copied to clipboard

"Integer" looks like a reserved keyword

Open Zekfad opened this issue 2 years ago • 2 comments

Following code produces errors while it shouldn't:

class Integer {
	public function a(): Integer // 'ReturnType' expected // '{' expected
	{ // '}' expected
		return $this;
	}
}

Zekfad avatar Jul 13 '22 19:07 Zekfad

I am currently traveling and can't check this yet. But do try public function a(): self instead of Integer.

Does the problem also happen if the class name is something else, not Integer?

Best!

zobo avatar Jul 22 '22 17:07 zobo

self produces no error, but that's still an issue, because it's a false error report for a valid PHP code.

I haven't tested other names like that yet.

Zekfad avatar Jul 22 '22 18:07 Zekfad

Same as https://github.com/zobo/php-language-server/issues/81 and https://github.com/microsoft/tolerant-php-parser/issues/413

zobo avatar Sep 28 '24 21:09 zobo