Skip to content

Improve options type declarations and add andThen method#398

Merged
veewee merged 1 commit intophp-standard-library:nextfrom
veewee:option-improvements
Jan 24, 2023
Merged

Improve options type declarations and add andThen method#398
veewee merged 1 commit intophp-standard-library:nextfrom
veewee:option-improvements

Conversation

@veewee
Copy link
Copy Markdown
Collaborator

@veewee veewee commented Jan 24, 2023

Partially fixes #379:

$option = Option\some(2);

static::assertSame(3, $option->andThen(static fn($i) => Option\some($i + 1))->unwrapOr(null));

Improves types of unwrapOr and unwrapOrElse:

Option::<T>::unwrapOr::<O>(O $other): T|O

@veewee veewee requested a review from azjezz January 24, 2023 10:46
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 3995385287

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.0007%) to 99.125%

Totals Coverage Status
Change from base Build 3964265631: 0.0007%
Covered Lines: 3966
Relevant Lines: 4001

💛 - Coveralls

Copy link
Copy Markdown
Member

@azjezz azjezz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚢

@veewee veewee added Priority: Medium This issue may be useful, and needs some attention. Status: Accepted It's clear what the subject of the issue is about, and what the resolution should be. Status: Completed Nothing further to be done with this issue. Awaiting to be closed by the requestor out of politeness Type: Enhancement Most issues will probably ask for additions or changes. labels Jan 24, 2023
@veewee veewee merged commit 33496f6 into php-standard-library:next Jan 24, 2023
@azjezz azjezz added this to the 2.4.0 milestone Jan 24, 2023
renovate bot referenced this pull request in ben-challis/sql-migrations Jan 26, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [azjezz/psl](https://togithub.com/azjezz/psl) | require | minor |
`2.3.1` -> `2.4.1` |

---

### ⚠ Dependency Lookup Warnings ⚠

Warnings were logged while processing this repo. Please check the
Dependency Dashboard for more information.

---

### Release Notes

<details>
<summary>azjezz/psl</summary>

### [`v2.4.1`](https://togithub.com/azjezz/psl/releases/tag/2.4.1):
Lenalee - 2.4.1

[Compare Source](https://togithub.com/azjezz/psl/compare/2.4.0...2.4.1)

#### What's Changed

- undeprecate `positive_int()` by
[@&#8203;dragosprotung](https://togithub.com/dragosprotung) in
[https://github.com/azjezz/psl/pull/400](https://togithub.com/azjezz/psl/pull/400)

**Full Changelog**: php-standard-library/php-standard-library@2.4.0...2.4.1

### [`v2.4.0`](https://togithub.com/azjezz/psl/releases/tag/2.4.0):
Lenalee - 2.4.0

[Compare Source](https://togithub.com/azjezz/psl/compare/2.3.1...2.4.0)

#### What's Changed

##### Features

- Add range function by [@&#8203;azjezz](https://togithub.com/azjezz) in
[https://github.com/azjezz/psl/pull/385](https://togithub.com/azjezz/psl/pull/385)
- Add nonnull type by [@&#8203;azjezz](https://togithub.com/azjezz) in
[https://github.com/azjezz/psl/pull/392](https://togithub.com/azjezz/psl/pull/392)
- Add uint type by [@&#8203;azjezz](https://togithub.com/azjezz) in
[https://github.com/azjezz/psl/pull/393](https://togithub.com/azjezz/psl/pull/393)
- Add signed integer types by
[@&#8203;azjezz](https://togithub.com/azjezz) in
[https://github.com/azjezz/psl/pull/394](https://togithub.com/azjezz/psl/pull/394)
- Add unsigned integer types by
[@&#8203;KennedyTedesco](https://togithub.com/KennedyTedesco) in
[https://github.com/azjezz/psl/pull/395](https://togithub.com/azjezz/psl/pull/395)
- Add f32 and f64 types by
[@&#8203;KennedyTedesco](https://togithub.com/KennedyTedesco) in
[https://github.com/azjezz/psl/pull/396](https://togithub.com/azjezz/psl/pull/396)

##### fixes, and improvements

- Return might be non-empty-list/non-empty-array for map functions by
[@&#8203;dragosprotung](https://togithub.com/dragosprotung) in
[https://github.com/azjezz/psl/pull/384](https://togithub.com/azjezz/psl/pull/384)
- Add Async documentation by
[@&#8203;azjezz](https://togithub.com/azjezz) in
[https://github.com/azjezz/psl/pull/386](https://togithub.com/azjezz/psl/pull/386)
- remove float ranges by [@&#8203;azjezz](https://togithub.com/azjezz)
in
[https://github.com/azjezz/psl/pull/391](https://togithub.com/azjezz/psl/pull/391)
- update changelog by
[@&#8203;KennedyTedesco](https://togithub.com/KennedyTedesco) in
[https://github.com/azjezz/psl/pull/397](https://togithub.com/azjezz/psl/pull/397)
- Improve options type declarations and add andThen method by
[@&#8203;veewee](https://togithub.com/veewee) in
[https://github.com/azjezz/psl/pull/398](https://togithub.com/azjezz/psl/pull/398)

#### New Contributors

- [@&#8203;KennedyTedesco](https://togithub.com/KennedyTedesco) made
their first contribution in
[https://github.com/azjezz/psl/pull/395](https://togithub.com/azjezz/psl/pull/395)

**Full Changelog**: php-standard-library/php-standard-library@2.3.1...2.4.0

</details>

---

### Configuration

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

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, 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://app.renovatebot.com/dashboard#github/ben-challis/sql-migrations).

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

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

Priority: Medium This issue may be useful, and needs some attention. Status: Accepted It's clear what the subject of the issue is about, and what the resolution should be. Status: Completed Nothing further to be done with this issue. Awaiting to be closed by the requestor out of politeness Type: Enhancement Most issues will probably ask for additions or changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

andThen()

3 participants