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.
Right now, the APCu code has a mix of tabs/spaces and other style inconsistencies. The best tool for rigorous maintenance of code style seems to be ClangFormat, which is also used by the Datastax's Apache Cassandra extension for PHP.
I started with their style and made a few tweaks:
SortIncludes: false
is necessary to maintain#include "php.h"
before lines like#include "main/php_streams.h"
. Otherwise, the build breaks. It's also possible to solve this with/* clang-format off */
blocks or not grouping the includes that must have explicit ordering, but that can always happen later.UseTab: never
andTabWidth: 4
to harmonize the ClangFormat configuration with the VIM one included in files.I don't have strong opinions on any parts of the style (not even spaces vs. tabs!). I'm more interested in having a rigid format than which decisions actually get made. So, I'm happy to reroll with different options.
ClangFormat, unfortunately, has limited options around
#if
block indentation and macro-heavy code. I don't have strong opinions around this, either.Some options are:
/* clang-format off */
to regions of code heavily dependent on such formatting. I did this for theapcu_functions
block, which had rather strange formatting from ClangFormat.apc_arginfo.h
.