Skip to content

(PHP) Syntax parsing breaks inside parameters of some function calls #3655

@Roy-Orbison

Description

@Roy-Orbison

Describe the issue
When a lambda function is used as a parameter, it breaks down if it has a use section after its parameters.

Comments break inside object method calls (but apparently not regular function calls).

Which language seems to have the issue?
PHP

Are you using highlight or highlightAuto?
I noticed it on Stack Overflow, and confirmed with highlightElement in your demo pages.

Sample Code to Reproduce
As highlighted on your demo page

Expected behavior

funky(
	'string',
	function(array $x) use ($y) {
		# $y above fails to parse as a var, and this comment is broken
		$x[] = $y
		return $x;
	}
);

$o->m([
	'foo',
	# this comment highlights keywords like include and 'string' literals
	'bar',
]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions