gen_stub: drop support for @refcount 0
with scalar return
#16505
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.
Currenty, if
@refcount
is omitted, it is assumed to be 0 for scalar return types and "N" otherwise. On the other hand, if@refcount
is provided, for a scalar return type it must be 0, and for a non-scalar return type it must not be 0. In other words, the ref count will be 0 if and only if the return type is scalar, regardless of whether the@refcount
tag is used.In that case, adding
@refcount 0
does nothing, and since its presence suggests it does something (why would a developer add code that does nothing?) it is confusing and should be removed. As it happens, there are currently no uses of@refcount 0
in php-src, but why should we allow future uses?Removing this support also allows simplifying the code a bit.
In the process, I also renamed some of the constants for clarity.