Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

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

Appearance settings

No deprecation warning is triggered for nullable optional parameters before required ones #8024

Copy link
Copy link
@m-vo

Description

@m-vo
Issue body actions

Description

The following code:

<?php

function foo(int $param_optional = null, int $param_required) {}

Resulted in this output:

(no deprecation warning triggered)

But I expected this output instead:

Deprecated: Optional parameter $param_optional declared before required parameter $param_required is implicitly treated as a required parameter in […]```

It seems having a nullable parameter will prevent the deprecation from being triggered. See https://3v4l.org/biVG1#v8.1.2 for a comparison.

PHP Version

>=PHP8.0

Operating System

No response

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.