sveneld opened a new pull request, #3438: URL: https://github.com/apache/thrift/pull/3438
<!-- Explain the changes in the pull request below: --> > **Note:** This PR is **stacked** on #3435 ([THRIFT-5956](https://github.com/apache/thrift/pull/3435)) and #3436 ([THRIFT-5957](https://github.com/apache/thrift/pull/3436)). The current diff temporarily includes those changes — once they merge this branch will be rebased onto master and the diff will reduce to just the PHPUnit-migration files. Resolves [THRIFT-5961](https://issues.apache.org/jira/browse/THRIFT-5961) (attribute syntax migration) **and** [THRIFT-5962](https://issues.apache.org/jira/browse/THRIFT-5962) (PHPUnit 10 upgrade) together — they are not actually separable: PHPUnit 9.6 has no `Framework\Attributes\DataProvider` class, and PHPUnit 10 dropped support for the `@dataProvider` annotation. Either change in isolation breaks the test suite. **Changes:** - `composer.json`: bump `phpunit/phpunit` to `^10.5` and broaden `php-mock/php-mock-phpunit` to `^2.10 || ^3.0` (3.x is the line that works with PHPUnit 10). - `lib/php/phpunit.xml`: schema 10.5; replace the PHPUnit-9-style `<filter><whitelist>…</whitelist></filter>` with PHPUnit 10's `<source><include>…</include></source>`; drop the `convertErrorsToExceptions` / `convertNoticesToExceptions` / `convertWarningsToExceptions` options that PHPUnit 10 removed. - Convert every `@dataProvider` docblock to a `#[DataProvider(...)]` attribute across the unit + integration test suites (~95 attributes in 25 files), adding `use PHPUnit\Framework\Attributes\DataProvider;`. - Make every data-provider method `static` (PHPUnit 10 requirement). - Replace the few `$this->anything()` calls inside data providers with `Assert::anything()` so they remain valid in static context. - Replace every `withConsecutive(...)` chain — removed in PHPUnit 10 — with `willReturnCallback()` that pops expected arguments off a local array via `array_shift`. - Add `lib/php/test/ConsecutiveCalls.php` helper with `assertCallArgs(array $expected, array $actual)`. It compares positional arguments and supports PHPUnit `Constraint` matchers (`Assert::anything()` etc.) via `assertThat`. **Deliberately does NOT rely on `InvocationOrder::numberOfInvocations()` or any other `@internal` PHPUnit API** that may change between majors. **Out of scope (separate tickets):** - PSR-2 → PSR-12 migration / php-cs-fixer. - `declare(strict_types=1)` and native types in `lib/php/lib/`. - `t_php_generator.cc` modernization. - Migrating to PHPUnit 11 (would require PHP 8.2 floor). <!-- We recommend you review the checklist/tips before submitting a pull request. --> - [x] Did you create an [Apache Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket? [THRIFT-5961](https://issues.apache.org/jira/browse/THRIFT-5961) and [THRIFT-5962](https://issues.apache.org/jira/browse/THRIFT-5962) - [x] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"? - [x] Did you squash your changes to a single commit? (not required, but preferred) - [ ] Did you do your best to avoid breaking changes? *(Test-suite refactor only — no library behaviour change. Downstream test suites that subclass our test classes and use `withConsecutive` themselves will need the same migration.)* - [ ] If your change does not involve any code, include `[skip ci]` anywhere in the commit message to free up build resources. <!-- The Contributing Guide at: https://github.com/apache/thrift/blob/master/CONTRIBUTING.md has more details and tips for committing properly. --> Generated-by: Claude Opus 4.7 (1M context) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
