Skip to content

Commit fb575fd

Browse files
alcaeusCopilot
andauthored
Generate legacy arginfo for older PHP versions (#1981)
* Add legacy arginfo directive for stub generator * Update arginfo guidance in contributing docs * Use latest PHP version to generate arginfo * Update CONTRIBUTING.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update gen_stub instructions for coding agents --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent fc6e9b3 commit fb575fd

165 files changed

Lines changed: 711 additions & 564 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ PHP method signatures are defined in `*.stub.php` files alongside each class's `
6060
./build/gen_stub.php
6161
```
6262

63-
This requires `phpize` to have been run with **PHP 8.2** to use all features. Commit both the stub and the generated arginfo file.
63+
This requires `phpize` to have been run with the latest stable PHP version to use all features. Commit both the stub and the generated arginfo file.
6464

6565
## Architecture
6666

.github/workflows/arginfo-files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- "feature/*"
1212

1313
env:
14-
PHP_VERSION: "8.2"
14+
PHP_VERSION: "8.5"
1515

1616
jobs:
1717
check-arginfo:

CONTRIBUTING.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ $ php --ri mongodb
3131
## Generating arginfo from stub files
3232

3333
Arginfo structures are generated from stub files using the `gen_stub.php`
34-
file. Note that this requires `phpize` to be run for **PHP 8.2** to make use
35-
of all features. After changing a stub file, run `./build/gen_stub.php`
36-
to regenerate the corresponding arginfo files and commit the results.
34+
file. After changing a stub file, run `./build/gen_stub.php` to regenerate the
35+
corresponding arginfo files and commit the results.
36+
37+
The `gen_stub.php` file is added to the `build` directory when calling `phpize`.
38+
Arginfo structures are generated with the latest version of PHP. The
39+
`@generate-legacy-arginfo` directive ensures that the generated files are
40+
compatible with the indicated version of PHP. When bumping the minimum PHP
41+
requirement, this directive needs to be updated accordingly.
3742

3843
## Generating function maps for static analysis tools
3944

src/BSON/Binary.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* @generate-class-entries static
5-
* @generate-function-entries static
5+
* @generate-legacy-arginfo 80100
66
*/
77

88
namespace MongoDB\BSON;

src/BSON/BinaryInterface.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22

33
/**
4-
* @generate-class-entries static
5-
* @generate-function-entries
4+
* @generate-class-entries
5+
* @generate-legacy-arginfo 80100
66
*/
77

88
namespace MongoDB\BSON;

src/BSON/BinaryInterface_arginfo.h

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BSON/Binary_arginfo.h

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BSON/DBPointer.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* @generate-class-entries static
5-
* @generate-function-entries static
5+
* @generate-legacy-arginfo 80100
66
*/
77

88
namespace MongoDB\BSON;

src/BSON/DBPointer_arginfo.h

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BSON/Decimal128.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* @generate-class-entries static
5-
* @generate-function-entries static
5+
* @generate-legacy-arginfo 80100
66
*/
77

88
namespace MongoDB\BSON;

0 commit comments

Comments
 (0)