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

feat: narrow ResultInterface to concrete implementation after calling isSucceeded() and isFailed() #466

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

simPod
Copy link
Contributor

@simPod simPod commented Apr 18, 2024

No description provided.

@coveralls
Copy link

coveralls commented Apr 18, 2024

Pull Request Test Coverage Report for Build 8735731205

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.781%

Totals Coverage Status
Change from base Build 8728644504: 0.0%
Covered Lines: 4377
Relevant Lines: 4431

💛 - Coveralls

Copy link
Collaborator

@veewee veewee left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.
Seems like a nice addition!

@veewee veewee added Priority: Medium This issue may be useful, and needs some attention. 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 Apr 18, 2024
@veewee veewee added this to the 3.0.0 milestone Apr 18, 2024
@veewee veewee merged commit d211454 into azjezz:next Apr 18, 2024
14 checks passed
@simPod simPod deleted the assert branch April 18, 2024 11:18
simPod added a commit to simPod/psl that referenced this pull request Apr 18, 2024
@azjezz
Copy link
Owner

azjezz commented Apr 19, 2024

I think we need to revert this 😅 ResultInterface is part of the public API, and while it is quite unlikey, someone could re-implement Success/Failure, e.g MySuccess/MyFailure, in which case, MySuccess::isSucceeded would return true, but that does not mean its an instance of Success ( that is what psalm would think ).

repro:

function foo(ResultInterface $result): Success {
  if ($result->isSucceeded()) {
    return $result;
  }

  exit('no');
}

foo($mySuccessImplementation); // throws an exception

CRIES

@simPod
Copy link
Contributor Author

simPod commented Apr 19, 2024

Hm, that's true. 😢2

Should I send revert PR?

@veewee
Copy link
Collaborator

veewee commented Apr 19, 2024

Woops, merged a bit too fast - sorry.
A revert PR is welcome. 😢 **3

simPod added a commit to simPod/psl that referenced this pull request Apr 19, 2024
… calling `isSucceeded()` and `isFailed()` (azjezz#466)"

This reverts commit d211454.
@simPod
Copy link
Contributor Author

simPod commented Apr 19, 2024

There u go #469

azjezz pushed a commit that referenced this pull request Apr 19, 2024
… calling `isSucceeded()` and `isFailed()` (#466)" (#469)

This reverts commit d211454.
@simPod
Copy link
Contributor Author

simPod commented Apr 19, 2024

BTW is there any chance the RFC is accepted in the future? (like it was missing something that could be fixed)

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: 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.

4 participants