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

Allow ignoring JumpStatementsSpacing after T_OPEN_TAG #1675

Open
MatzeKitt opened this issue May 7, 2024 · 0 comments
Open

Allow ignoring JumpStatementsSpacing after T_OPEN_TAG #1675

MatzeKitt opened this issue May 7, 2024 · 0 comments

Comments

@MatzeKitt
Copy link

I use the following configuration:

<rule ref="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing">
	<properties>
		<property name="linesCountAfter" value="0"/>
		<property name="linesCountAfterLast" value="0"/>
		<property name="linesCountAfterWhenLastInCaseOrDefault" value="0"/>
		<property name="linesCountAfterWhenLastInLastCaseOrDefault" value="0"/>
		<property name="linesCountBefore" value="1"/>
		<property name="linesCountBeforeFirst" value="0"/>
		<property name="linesCountBeforeWhenFirstInCaseOrDefault" value="0"/>
		<property name="jumpStatements" type="array">
			<element value="continue"/>
			<element value="return"/>
		</property>
	</properties>
</rule>

So it means that after each return there must be an empty space. That’s good for the most part, but unfortunately I sometimes have code like this:

function foo() {
	ob_start();
	?>
	<div>Some HTML</div>
	<?php
	return ob_get_clean();
}

Now the settings above require an empty line before the return, which would make no sense to me here. Thus it would be great to add such a functionality to allow T_OPEN_TAG to be excluded from such a check and allow it preceeding without an empty line.

Or is this already possible and I couldn’t find it?

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