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

Remove the need for Constraint::map() callables to be pure #8

Merged
merged 1 commit into from
Nov 11, 2024

Conversation

Baptouuuu
Copy link
Member

Problem

Even though technically the map callable must be pure for the Constraint to be pure, it's sometimes necessary to depend on an impure context to map the value. In the end this generates InvalidArgument by Psalm that doesn't help the program to be safer.

Users then need to write psalm-suppress annotations in their code to fix this.

This also prevents users to use third party packages that don't declare the purity of the code.

Solution

Remove the need for the callables to be pure.

@Baptouuuu Baptouuuu added the enhancement New feature or request label Nov 11, 2024
@Baptouuuu Baptouuuu self-assigned this Nov 11, 2024
Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.31%. Comparing base (4af5fbb) to head (8de2eae).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop       #8   +/-   ##
==========================================
  Coverage      96.31%   96.31%           
  Complexity       118      118           
==========================================
  Files             22       22           
  Lines           1545     1545           
==========================================
  Hits            1488     1488           
  Misses            57       57           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Baptouuuu Baptouuuu merged commit 0cd99d4 into develop Nov 11, 2024
23 checks passed
@Baptouuuu Baptouuuu deleted the impure-map branch November 11, 2024 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant