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

Change default for nullable_type_declaration_for_default_null_value #236

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

otsch
Copy link
Contributor

@otsch otsch commented Dec 1, 2023

Because support for implicit support for implicit nullability exists only for backwards compatibility reasons and will be removed in the future. See #235.

Because support for implicit support for implicit nullability exists
only for backwards compatibility reasons and will be removed in the
future. See laravel#235.
@taylorotwell taylorotwell merged commit a1ec24b into laravel:main Dec 4, 2023
7 checks passed
duncanmcclean added a commit to statamic/cms that referenced this pull request Dec 5, 2023
…behaviour

Changing back after the default changed in Pint: laravel/pint#236
duncanmcclean added a commit to statamic/cms that referenced this pull request Dec 5, 2023
…efault_null_value` default (#9126)

* Run Laravel Pint

* Revert "Run Laravel Pint"

This reverts commit 41b4476.

* Revert `nullable_type_declaration_for_default_null_value` to its old behaviour

Changing back after the default changed in Pint: laravel/pint#236
@jasonvarga
Copy link

Something to be aware of is that it could be a breaking change, particularly in packages where someone might override one of your classes.

For example:

class Foo
{
- public function test(string $arg = null)
+ public function test(?string $arg = null)
  {
      //
  }
}
class Bar extends Foo
{
  public function test(string $arg = null)
  {
    // Fatal Error:
    // Declaration of Bar::test(string $arg) must be compatible with Foo::test(?string $arg)
  }
}

@otsch
Copy link
Contributor Author

otsch commented Dec 5, 2023

Tried it and I don't get a fatal:
Bildschirmfoto 2023-12-05 um 21 51 26

I guess PHP internally knows that there is no difference if the type is explicitly or implicitly nullable.
Or do you really get the fatal error @jasonvarga?

@jasonvarga
Copy link

Yeah I really get the error. Here you can see it in a browser and cli. I don't think there's anything special about my setup that would show an error where others wouldn't see one. I could be wrong though!

CleanShot 2023-12-05 at 16 45 01

@Jubeki
Copy link
Contributor

Jubeki commented Dec 5, 2023

@jasonvarga in your image you are missing the '= null'.

@otsch
Copy link
Contributor Author

otsch commented Dec 5, 2023

@jasonvarga
In this screenshot the $name argument has no default value. That makes the difference.
?string $name and string $name definitely is not the same.
But ?string $name = null and string $name = null, basically is the same, as the null default value makes the string type implicitly nullable.

@jasonvarga
Copy link

Ah crap. You're absolutely right. Sorry for the bother! ☺️ 🤐 🤦‍♂️

szepeviktor referenced this pull request in conedevelopment/root Dec 14, 2023
renovate bot referenced this pull request in RadioRoster/backend Dec 23, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [laravel/pint](https://laravel.com)
([source](https://togithub.com/laravel/pint)) | `1.13.6` -> `1.13.7` |
[![age](https://developer.mend.io/api/mc/badges/age/packagist/laravel%2fpint/1.13.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/packagist/laravel%2fpint/1.13.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/packagist/laravel%2fpint/1.13.6/1.13.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/packagist/laravel%2fpint/1.13.6/1.13.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>laravel/pint (laravel/pint)</summary>

###
[`v1.13.7`](https://togithub.com/laravel/pint/blob/HEAD/CHANGELOG.md#v1137---2023-12-05)

[Compare
Source](https://togithub.com/laravel/pint/compare/v1.13.6...v1.13.7)

- Change default for nullable_type_declaration_for_default_null_value by
[@&#8203;otsch](https://togithub.com/otsch) in
[https://github.com/laravel/pint/pull/236](https://togithub.com/laravel/pint/pull/236)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/Lapotor/RadioRoster-api).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44Ny4yIiwidXBkYXRlZEluVmVyIjoiMzcuODcuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

5 participants