You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
find the sub-section titled "Closing identifier must not be indented further than any lines of the body"
find the output of the code from that example - "Parse error: Invalid body indentation level (expecting an indentation level of at least 3) in example.php on line 4"
issue: the error message says that the indentation level must be AT LEAST 3, i.e. "indentation level >= 3".
this contradicts and is completely opposite to the PHP rule (mentioned in the code example title) "Closing identifier must NOT be indented further than any lines of the body"; in this example - "indentation level <= 3".
the code example title contains the correct PHP rule - that the indentation of the closing identifier must NOT be greater than the maximum indentation of the string body.
the error messages from the exception contains wrong and opposite wording.
this error message needs to be fixed both in PHP source-code and in the documentation on that page.
To me, both the example's title and the PHP error are correct here.
Example 3 Closing identifier must not be indented further than any lines of the body
This is correct. If the closing identifier is not "indented further than any lines of the body", than means that the indentation level of one or more lines is lower than the indentation level of the closing identifier.
OK ✅
KO ❌
<?phpecho<<<END a // at column 2 b // at column 3 c // at column 4END; // at column 1, *not* indented further than any lines of the body
<?phpecho<<<END a // at column 2 b // at column 7 c // at column 4 END; // at column 4, *is* indented further than the first line
Parse error: Invalid body indentation level (expecting an indentation level of at least x)
This is correct. x is the column where the closing identifier starts.
Closing identifier starts at column 2
Closing identifier starts at column 3
Closing identifier starts at column 3
<?phpecho<<<ENDtest END; // column 2 = one indentation level
<?phpecho<<<ENDtest END; // column 3 = two indentation level
<?phpecho<<<ENDtest END; // column 4 = three indentation level
Parse error: Invalid body indentation level
(expecting an indentation level of at least 1)
Parse error: Invalid body indentation level
(expecting an indentation level of at least 2)
Parse error: Invalid body indentation level
(expecting an indentation level of at least 3)
I agree that the example's title could be improved, though. As a non-native English speaker, it was not very clear to me either when I first read it.
Perhaps, we could replace it with one of the followings?
The closing identifier must not be indented more than any lines of the body
The closing identifier must be at the same or lower indentation level as any lines of the body
@MaximePinot thank you for the detailed commend and suggestions.
I agree with you that an example title like the one you have suggested "The closing identifier must not be indented more than any lines of the body" is very clear and simple to understand for any non native-english speakers. That would be a nice improvement!
however my main concern with this bug report was the php error message "Parse error: Invalid body indentation level (expecting an indentation level of at least 3)".
the issue is that the expression "at least 3" means "minimum 3", which implies that any indentation level higher or equal to 3 is acceptable, for example an indentation level of 100 or 1000 would be acceptable according to this formulation, but that would be wrong in practice.
so the correct wording needs to be the opposite - "at most 3" - not "at least 3", because "at most" means "maximum" (i.e. equal or lower), which in that error message would mean "expecting indentation level 0 or 1 or 2 or 3", all of which would be valid for that documentation example.
to put it in mathematical terms, the error message says "expecting >=", but it should be the opposite "expecting <=".
let me know if that makes sense, and let's see who can fix this the error message in the php source-code, not just in the documentation.
I still think that the PHP error message is correct. 😇
The PHP error message is about the “body” ("Invalid body indentation level" -- therefore the lines between the delimiters). It is correct to say that all lines of the body must have an "indentation level of at least 3" (>=) if the closing identifier starts at column 3.
In other words: all lines of the body must have a higher or equal indentation level than the closing identifier.
Activity
MaximePinot commentedon Apr 20, 2026
To me, both the example's title and the PHP error are correct here.
This is correct. If the closing identifier is not "indented further than any lines of the body", than means that the indentation level of one or more lines is lower than the indentation level of the closing identifier.
This is correct. x is the column where the closing identifier starts.
I agree that the example's title could be improved, though. As a non-native English speaker, it was not very clear to me either when I first read it.
Perhaps, we could replace it with one of the followings?
WDYT?
dan-software-engineer commentedon Apr 22, 2026
@MaximePinot thank you for the detailed commend and suggestions.
I agree with you that an example title like the one you have suggested "The closing identifier must not be indented more than any lines of the body" is very clear and simple to understand for any non native-english speakers. That would be a nice improvement!
however my main concern with this bug report was the php error message "Parse error: Invalid body indentation level (expecting an indentation level of at least 3)".
the issue is that the expression "at least 3" means "minimum 3", which implies that any indentation level higher or equal to 3 is acceptable, for example an indentation level of 100 or 1000 would be acceptable according to this formulation, but that would be wrong in practice.
so the correct wording needs to be the opposite - "at most 3" - not "at least 3", because "at most" means "maximum" (i.e. equal or lower), which in that error message would mean "expecting indentation level 0 or 1 or 2 or 3", all of which would be valid for that documentation example.
to put it in mathematical terms, the error message says "expecting >=", but it should be the opposite "expecting <=".
let me know if that makes sense, and let's see who can fix this the error message in the php source-code, not just in the documentation.
thank you.
MaximePinot commentedon Apr 22, 2026
I still think that the PHP error message is correct. 😇
The PHP error message is about the “body” ("Invalid body indentation level" -- therefore the lines between the delimiters). It is correct to say that all lines of the body must have an "indentation level of at least 3" (
>=) if the closing identifier starts at column 3.In other words: all lines of the body must have a higher or equal indentation level than the closing identifier.