WIP - Removing unneccessary closing tags to prevent potential issues. #223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removing closing tags when no further output is expected or done.
Reason why, for those unaware;
The PHP closing tag (?>) is optional at the end of PHP files, and there are a few reasons why it's often recommended to omit it:
Avoiding accidental whitespace or characters: Including the closing tag can potentially introduce unintended whitespace or characters after the closing tag. If any whitespace or characters are outputted after the closing tag, it can cause issues, such as headers being sent to the browser prematurely, which may lead to "headers already sent" errors.
Improved code readability: Omitting the closing tag can help prevent accidental whitespace or new lines being added after the closing tag, which could cause problems when PHP interacts with other content types like HTML, CSS, or JavaScript. It also helps maintain a consistent coding style throughout the project.
Mitigating potential security risks: Omitting the closing tag eliminates the possibility of having trailing white spaces or new lines that could cause issues, such as inadvertently exposing sensitive information like user credentials or generating unwanted output in certain scenarios