:sparkles: PHP 8.1: New `PHPCompatibility.InitialValue.NewNewInInitializers` sniff by jrfnl · Pull Request #1464 · PHPCompatibility/PHPCompatibility

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Conversation

@jrfnl

Copy link Copy Markdown

Member

@jrfnl jrfnl commented

Jan 3, 2023

new in Initializers

It is now possible to use new ClassName() expressions as the default value of a parameter, static variable, global constant initializers, and as attribute arguments.

Refs:

Includes unit tests.

Related to #1299

…niff

> `new` in Initializers
>
> It is now possible to use `new ClassName()` expressions as the default value of a parameter, static variable, global constant initializers, and as attribute arguments.

Refs:
* https://wiki.php.net/rfc/new_in_initializers
* https://www.php.net/manual/en/migration81.new-features.php#migration81.new-features.core.new-in-initializer
* php/php-src#7153
* php/php-src@52d3d0d

Includes unit tests.

@wimg wimg merged commit 94e73ef into develop

Jan 8, 2023

@wimg wimg deleted the php-8.1/new-newininitializers-sniff-2 branch

January 8, 2023 14:50

@jrfnl jrfnl added the PHP: 8.1 label

Nov 4, 2025

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

Reviewers

@wimg wimg wimg approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

10.0.0-alpha1

Development

Successfully merging this pull request may close these issues.

2 participants

@jrfnl @wimg