Skip to content

Generate legacy arginfo for older PHP versions#1981

Open
alcaeus wants to merge 4 commits intomongodb:v2.xfrom
alcaeus:generate-legacy-arginfo
Open

Generate legacy arginfo for older PHP versions#1981
alcaeus wants to merge 4 commits intomongodb:v2.xfrom
alcaeus:generate-legacy-arginfo

Conversation

@alcaeus
Copy link
Copy Markdown
Member

@alcaeus alcaeus commented Apr 13, 2026

The arginfo generator allows for maintaining backward compatibility through the use of the generate-legacy-arginfo annotation, together with the minimum PHP version being targeted. Using this, we can remove the limitation to only generate arginfo on PHP 8.2 and instead use the latest stable PHP version.

@alcaeus alcaeus requested a review from a team as a code owner April 13, 2026 10:42
@alcaeus alcaeus requested review from a team, Copilot and paulinevos and removed request for a team April 13, 2026 10:42
/**
* @generate-class-entries static
* @generate-function-entries
* @generate-class-entries
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using gen_stub.php from PHP 8.5, I noticed that using static with generate-class-entries for interfaces causes invalid files. Haven't yet had time to investigate, but since we're not generating an PHP_METHOD entries we can omit the static keyword for interfaces.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates stub/arginfo generation to support producing arginfo on newer PHP versions while remaining compatible with the project’s minimum supported PHP (8.1), leveraging @generate-legacy-arginfo.

Changes:

  • Added @generate-legacy-arginfo 80100 across stubs to enable legacy arginfo generation targeting PHP 8.1.
  • Regenerated *_arginfo.h files with version guards (notably for PHP ≥ 8.4 API differences).
  • Updated contributor docs and CI workflow to generate/check arginfo using a newer PHP version.

Reviewed changes

Copilot reviewed 164 out of 164 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/MongoDB/WriteResult.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/WriteResult_arginfo.h Regenerated arginfo with PHP-version guards and updated class/property registration code.
src/MongoDB/WriteError.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/WriteError_arginfo.h Regenerated arginfo; updates property declaration details and class registration guards.
src/MongoDB/WriteConcernError.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/WriteConcernError_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/WriteConcern.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/WriteConcern_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/TopologyDescription.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/TopologyDescription_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/Session.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Session_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/ServerDescription.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/ServerDescription_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/ServerApi.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/ServerApi_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/Server.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Server_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/ReadPreference.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/ReadPreference_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/ReadConcern.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/ReadConcern_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/Query.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Query_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/Monitoring/TopologyOpeningEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/TopologyOpeningEvent_arginfo.h Regenerated arginfo with guarded class registration and property handling changes.
src/MongoDB/Monitoring/TopologyClosedEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/TopologyClosedEvent_arginfo.h Regenerated arginfo with guarded class registration and property handling changes.
src/MongoDB/Monitoring/TopologyChangedEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/TopologyChangedEvent_arginfo.h Regenerated arginfo with guarded class registration and property handling changes.
src/MongoDB/Monitoring/Subscriber.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/MongoDB/Monitoring/Subscriber_arginfo.h Regenerated arginfo simplifying interface method table generation.
src/MongoDB/Monitoring/ServerOpeningEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/ServerOpeningEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/ServerHeartbeatSucceededEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Monitoring/ServerHeartbeatStartedEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/ServerHeartbeatStartedEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Monitoring/ServerHeartbeatFailedEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/ServerHeartbeatFailedEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Monitoring/ServerClosedEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/ServerClosedEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Monitoring/ServerChangedEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/ServerChangedEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Monitoring/SDAMSubscriber.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/MongoDB/Monitoring/SDAMSubscriber_arginfo.h Regenerated arginfo updating interface method table entries for PHP ≥ 8.4 differences.
src/MongoDB/Monitoring/LogSubscriber.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/MongoDB/Monitoring/LogSubscriber_arginfo.h Regenerated arginfo updating interface method table entries for PHP ≥ 8.4 differences.
src/MongoDB/Monitoring/CommandSucceededEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/CommandSucceededEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Monitoring/CommandSubscriber.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/MongoDB/Monitoring/CommandSubscriber_arginfo.h Regenerated arginfo updating interface method table entries for PHP ≥ 8.4 differences.
src/MongoDB/Monitoring/CommandStartedEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/CommandStartedEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Monitoring/CommandFailedEvent.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Monitoring/CommandFailedEvent_arginfo.h Regenerated arginfo with guarded class registration and property name handling updates.
src/MongoDB/Manager.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Manager_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/Exception/UnexpectedValueException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/UnexpectedValueException_arginfo.h Regenerated arginfo simplifying empty method table and adding PHP ≥ 8.4 class registration guard.
src/MongoDB/Exception/ServerException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/ServerException_arginfo.h Regenerated arginfo simplifying empty method table and adding PHP ≥ 8.4 class registration guard.
src/MongoDB/Exception/RuntimeException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/RuntimeException_arginfo.h Regenerated arginfo with guarded class registration and updated property declaration API usage.
src/MongoDB/Exception/LogicException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/LogicException_arginfo.h Regenerated arginfo simplifying empty method table and adding PHP ≥ 8.4 class registration guard.
src/MongoDB/Exception/InvalidArgumentException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/InvalidArgumentException_arginfo.h Regenerated arginfo simplifying empty method table and adding PHP ≥ 8.4 class registration guard.
src/MongoDB/Exception/ExecutionTimeoutException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/ExecutionTimeoutException_arginfo.h Regenerated arginfo with guarded final-flag registration changes.
src/MongoDB/Exception/Exception.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/MongoDB/Exception/Exception_arginfo.h Regenerated arginfo simplifying interface method table generation.
src/MongoDB/Exception/EncryptionException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/EncryptionException_arginfo.h Regenerated arginfo simplifying empty method table and adding PHP ≥ 8.4 class registration guard.
src/MongoDB/Exception/ConnectionTimeoutException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/ConnectionTimeoutException_arginfo.h Regenerated arginfo with guarded final-flag registration changes.
src/MongoDB/Exception/ConnectionException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/ConnectionException_arginfo.h Regenerated arginfo simplifying empty method table and adding PHP ≥ 8.4 class registration guard.
src/MongoDB/Exception/CommandException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/CommandException_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/Exception/BulkWriteException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/BulkWriteException_arginfo.h Regenerated arginfo with guarded class registration and property type handling changes.
src/MongoDB/Exception/BulkWriteCommandException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/BulkWriteCommandException_arginfo.h Regenerated arginfo with guarded final-flag registration changes and property type handling changes.
src/MongoDB/Exception/AuthenticationException.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Exception/AuthenticationException_arginfo.h Regenerated arginfo simplifying empty method table and adding PHP ≥ 8.4 class registration guard.
src/MongoDB/CursorInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/MongoDB/CursorInterface_arginfo.h Regenerated arginfo updating interface method entries for PHP ≥ 8.4 macro/signature differences.
src/MongoDB/Cursor.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Cursor_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/Command.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/Command_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/ClientEncryption.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/ClientEncryption_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/BulkWriteCommandResult.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/BulkWriteCommandResult_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/BulkWriteCommand.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/BulkWriteCommand_arginfo.h Regenerated arginfo with guarded class registration changes.
src/MongoDB/BulkWrite.stub.php Add legacy arginfo generation target (PHP 8.1).
src/MongoDB/BulkWrite_arginfo.h Regenerated arginfo with guarded class registration changes.
src/functions.stub.php Add legacy arginfo generation target (PHP 8.1) for extension functions.
src/functions_arginfo.h Regenerated function entries using version-guarded registration macros.
src/BSON/VectorType.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/VectorType_arginfo.h Regenerated enum registration (simplified empty method table).
src/BSON/UTCDateTimeInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/UTCDateTimeInterface_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/UTCDateTime.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/UTCDateTime_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Unserializable.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/Unserializable_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/Undefined.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Undefined_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Type.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/Type_arginfo.h Regenerated interface registration simplifying empty method table.
src/BSON/TimestampInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/TimestampInterface_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/Timestamp.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Timestamp_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Symbol.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Symbol_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Serializable.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/Serializable_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/RegexInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/RegexInterface_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/Regex.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Regex_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Persistable.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/Persistable_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/PackedArray.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/PackedArray_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/ObjectIdInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/ObjectIdInterface_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/ObjectId.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/ObjectId_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/MinKeyInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/MinKeyInterface_arginfo.h Regenerated interface registration simplifying empty method table.
src/BSON/MinKey.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/MinKey_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/MaxKeyInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/MaxKeyInterface_arginfo.h Regenerated interface registration simplifying empty method table.
src/BSON/MaxKey.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/MaxKey_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/JavascriptInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/JavascriptInterface_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/Javascript.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Javascript_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Iterator.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Iterator_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Int64.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Int64_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Document.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Document_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/Decimal128Interface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/Decimal128Interface_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/Decimal128.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Decimal128_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/DBPointer.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/DBPointer_arginfo.h Regenerated arginfo with guarded class registration changes.
src/BSON/BinaryInterface.stub.php Add legacy arginfo generation target (PHP 8.1) and adjust generation directives for an interface.
src/BSON/BinaryInterface_arginfo.h Regenerated interface method entries with PHP ≥ 8.4 macro/signature guards.
src/BSON/Binary.stub.php Add legacy arginfo generation target (PHP 8.1).
src/BSON/Binary_arginfo.h Regenerated arginfo with guarded class registration changes.
CONTRIBUTING.md Update instructions/documentation for legacy arginfo generation workflow.
.github/workflows/arginfo-files.yml Update arginfo check workflow to run with PHP 8.5.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 13, 2026 10:54
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 164 out of 164 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants