coding-standard icon indicating copy to clipboard operation
coding-standard copied to clipboard

Cannot handle nested nested arrays

Open jim-parry opened this issue 5 years ago • 1 comments

It seems to me that phpcs/cbf are getting confused with the braced nesting of arrays in some test classes, and giving up. Two examples: I have found a single method in each of the "offending" classes that can be commented out to force a "pass"... RouterTest:testMatchedRouteOptions() and RouteColelctionTest::testRoutesOptions(). I am holding my nose at the thought of doing this, but it won't block progress. This issue remains an issue for now, and will need to be revisited.

Workaround for RouterTest is to declare the options before adding a new rule to the route collection. It results in the following ugliness (reformatted by PHPCBF):

	$options = [
		'as'  => 'login',
		'foo' => 'baz',
	];
	$this->collection->add('foo', function () {
	}, $options);
	$options = [
		'as'  => 'admin',
		'foo' => 'bar',
	];
	$this->collection->add(
			'baz', function () {
			}, $options
	);

This is a workaround, not a solution, and smells bad :(

jim-parry avatar Jan 04 '19 03:01 jim-parry

I'll take a look at this and issue #26 as soon as I get a chance.

louisl avatar Jan 04 '19 08:01 louisl