Skip to content

Add ReturnTypeWillChange attribute to silence PHP 8.1 deprecations - #896

Merged
cboden merged 1 commit into
ratchetphp:v0.4.4from
mbabker:patch-2
Dec 12, 2021
Merged

cboden merged 1 commit into
ratchetphp:v0.4.4from
mbabker:patch-2

Conversation

@mbabker

@mbabker mbabker commented Jul 25, 2021

Copy link
Copy Markdown
Contributor

PHP 8.1 adds tentative return types to a number of API symbols as noted in https://wiki.php.net/rfc/internal_method_return_types which will cause deprecation notices to be emitted if return types are missing. Those can be silenced by adding the return types or adding the #[ReturnTypeWillChange] attribute until types can be added.

This PR adds the attribute (which is B/C with PHP 7 and older since the attribute syntax will be parsed as comments) to methods that will cause deprecations to be triggered, silencing these deprecation notices when running on PHP 8.1:

Return type of Ratchet\Wamp\Topic::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Return type of Ratchet\Wamp\Topic::count() should either be compatible with Countable::count(): int, or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

@cboden cboden added this to the 0.4.4 milestone Dec 10, 2021
@cboden
cboden changed the base branch from master to v0.4.4 December 12, 2021 16:38
@cboden
cboden merged commit 547c117 into ratchetphp:v0.4.4 Dec 12, 2021
@mbabker
mbabker deleted the patch-2 branch December 12, 2021 16:52
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.

3 participants