Handling whitespace after function-like language constructs name #6965
julienfalque
started this conversation in
RFC
Replies: 1 comment
-
Thank you for tackling this issue. I generally agree but here are some facts & thoughts (tl;dr at the end):
Therefore (IMO):
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The discussion at #4837 (comment) threw light at the fact that we don't always agree how to handle language constructs that more or less behave like functions.
There are various possible situations:
isset()
,eval()
;echo('foo')
vs.echo 'foo'
,require('foo.php')
vs.require 'foo.php'
;declare()
, which can also be writtendeclare() { ... }
;if () { ... }
.The discussion was about how to handle whitespace after the name of such language construct (i.e.
echo('foo')
vs.echo ('foo')
. We currently have one rule that covers that (no_spaces_after_function_name
) and a new rule proposed in #4435 (single_space_after_construct
). This is problematic as some language constructs can be covered by both rules depending on whether they are considered a function or not.IMO there are two possible ways to move forward:
no_spaces_after_function_name
in favor of a new rule that covers all cases, with configuration option(s) (changes in SingleSpaceAfterConstructFixer - Introduction #4435 would be merged in this new rule);no_spaces_after_function_name
with a new configuration option.Also, to avoid long discussions in future PR(s), we should define the exhaustive list of language constructs that are ambiguous and define in which category they are, e.g.:
require
→ 2. language constructs that can be used like functions, but not onlyBeta Was this translation helpful? Give feedback.
All reactions