[
https://issues.apache.org/jira/browse/THRIFT-5961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Volodymyr Panivko updated THRIFT-5961:
--------------------------------------
Description:
The PHP test suite at lib/php/test/ (59 Unit + 9 Integration files)
uses annotation-style PHPUnit 9.5: @dataProvider, @test,
@expectedException, @group, etc. PHPUnit 10 dropped annotation
support; tests must use PHP 8 attributes (#[DataProvider], #[Test],
#[Group]) before we can upgrade.
This ticket converts every test file in lib/php/test/\{Unit,Integration}
to attribute syntax:
* @dataProvider Foo::bar -> #[DataProvider('bar')] (or
#[DataProviderExternal(Foo::class, 'bar')])
* @test -> #[Test]
* @group foo -> #[Group('foo')]
* @covers \Foo -> #[CoversClass(Foo::class)]
* @before / @after -> #[Before] / #[After]
Pure mechanical conversion; no behaviour change.
was:
After the PSR-12 sweep lands, the PHP runtime library still uses
PHPDoc-only typing — zero native parameter types, zero return types,
zero typed properties, no declare(strict_types=1).
This ticket lands all three in one pass:
* declare(strict_types=1) in every file under lib/php/lib/ and
lib/php/test/.
* Native parameter and return types for the public API: TTransport,
TProtocol, TServer, TBase, TException, all Factory and Server
classes, all Transport and Protocol implementations.
* Typed properties wherever it is safe.
* Constructor property promotion in pure-assignment Factory classes.
* Native by-ref types in TProtocol abstract methods (PHP 8.1
supports types on by-ref params).
* Replace function_exists() runtime checks in TBinarySerializer,
TSocket, TSocketPool with cached capability flags.
* Selective switch -> match conversion in pure dispatchers; keep
switch where there is fall-through.
* After the sweep, raise phpstan level from 1 to a higher value (5
or higher; to be decided based on what the new baseline looks
like) and shrink the baseline accordingly.
This is a breaking change for downstream code that subclasses public-
API abstract bases (TTransport, TProtocol, TServer, TBase, TException).
Plain users of the library are not affected. Generated structs that
extend TBase continue to work because TBase::read/write retain loose
TProtocol-typed parameters without array shape constraints.
> Migrate PHPUnit tests to attribute syntax
> -----------------------------------------
>
> Key: THRIFT-5961
> URL: https://issues.apache.org/jira/browse/THRIFT-5961
> Project: Thrift
> Issue Type: New Feature
> Components: PHP - Library
> Affects Versions: 0.24.0
> Reporter: Volodymyr Panivko
> Assignee: Volodymyr Panivko
> Priority: Major
>
> The PHP test suite at lib/php/test/ (59 Unit + 9 Integration files)
> uses annotation-style PHPUnit 9.5: @dataProvider, @test,
> @expectedException, @group, etc. PHPUnit 10 dropped annotation
> support; tests must use PHP 8 attributes (#[DataProvider], #[Test],
> #[Group]) before we can upgrade.
> This ticket converts every test file in lib/php/test/\{Unit,Integration}
> to attribute syntax:
> * @dataProvider Foo::bar -> #[DataProvider('bar')] (or
> #[DataProviderExternal(Foo::class, 'bar')])
> * @test -> #[Test]
> * @group foo -> #[Group('foo')]
> * @covers \Foo -> #[CoversClass(Foo::class)]
> * @before / @after -> #[Before] / #[After]
> Pure mechanical conversion; no behaviour change.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)