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

InnerFunctionsSniff should flag functions defined inside closures #3806

Closed
Daimona opened this issue Apr 19, 2023 · 1 comment · Fixed by #3807
Closed

InnerFunctionsSniff should flag functions defined inside closures #3806

Daimona opened this issue Apr 19, 2023 · 1 comment · Fixed by #3807

Comments

@Daimona
Copy link
Contributor

Daimona commented Apr 19, 2023

InnerFunctionsSniff detects functions defined inside other functions, but not inside closures, meaning it won't report any violations for the following snippet:

$myFunc = function () {
	function test(): int {
		return 54;
	}
};

For consistency, this should be treated the same as:

function myFunc() {
	function test(): int {
		return 54;
	}
}
@jrfnl
Copy link
Contributor

jrfnl commented Dec 8, 2023

FYI: the fix for this issue is included in today's PHP_CodeSniffer 3.8.0 release.

As per #3932, development on PHP_CodeSniffer will continue in the PHPCSStandards/PHP_CodeSniffer repository. If you want to stay informed, you may want to start "watching" that repo (or watching releases from that repo).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants