Skip to content

✨ PHP 8.1: New PHPCompatibility.InitialValue.NewNewInInitializers sniff#1464

Merged
wimg merged 1 commit intodevelopfrom
php-8.1/new-newininitializers-sniff-2
Jan 8, 2023
Merged

✨ PHP 8.1: New PHPCompatibility.InitialValue.NewNewInInitializers sniff#1464
wimg merged 1 commit intodevelopfrom
php-8.1/new-newininitializers-sniff-2

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants