Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Type function declarations #202

Closed
gaglioffo opened this issue Aug 2, 2023 · 2 comments
Closed

Problem with Type function declarations #202

gaglioffo opened this issue Aug 2, 2023 · 2 comments

Comments

@gaglioffo
Copy link

Pint Version

1.10.5

PHP Version

8.1.10

Description

Type null remove into declaration function

Steps To Reproduce

Scenario
OS: Windows
PHP: 8.1.10

./vendor/bin/pint

public function nameFunction(?string $value = null) {
or
public function nameFunction(string|null $value = null) {

Pint 1.10.5 remove null and become
public function nameFunction(string $value = null) { <-- wrong

I tried with Pint 1.10.3 and the type aren't touched
public function nameFunction(?string $value = null) { <-- correct
public function nameFunction(string|null $value = null) { <-- correct

pint.json

{
    "preset": "laravel",
    "rules": {
        "simplified_null_return": true,
        "braces": false,
        "new_with_braces": {
            "anonymous_class": false,
            "named_class": false
        }
    }
}
@crynobone
Copy link
Member

You can disable the rules using the following configuration:

{
    "rules": {
        "nullable_type_declaration_for_default_null_value": {
            "use_nullable_type_declaration": true
        }
    }
}

Original PR: #193

@gaglioffo
Copy link
Author

Thanks a lot and sorry

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

No branches or pull requests

2 participants