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

introduce more return type providers #3

Merged
merged 1 commit into from
Apr 9, 2021
Merged

introduce more return type providers #3

merged 1 commit into from
Apr 9, 2021

Conversation

azjezz
Copy link
Contributor

@azjezz azjezz commented Apr 4, 2021

new return type providers:

  • Iter\count return positive-int when $iterable is a non-empty-list<_>.
  • Iter\count return positive-int when $iterable is a non-empty-array<_, _>.
  • Iter\count return int(0) when $iterable is empty&array<_, _>
  • Iter\count return int(x) when $iterable is a non-empty-list<_> with a known count, where x is the size of $iterable.
  • Iter\count return int(x) when $iterable is a non-empty-array<_, _> with a known count, where x is the size of $iterable.
  • Iter\last return Tv when $iterable is a non-empty-list<Tv>.
  • Iter\last return Tv when $iterable is a non-empty-array<_, Tv>.
  • Iter\last return null when $iterable is empty&array<_, _>
  • Iter\last return Tv when $iterable is array{...} with at least 1 property.
  • Iter\first return Tv when $iterable is a non-empty-list<Tv>.
  • Iter\first return Tv when $iterable is a non-empty-array<_, Tv>.
  • Iter\first return null when $iterable is empty&array<_, _>
  • Iter\first return Tv when $iterable is array{...} with at least 1 property.
  • Str\after return null|lowercase-string when the first argument is lowercase-string.
  • Str\after_last return null|lowercase-string when the first argument is lowercase-string.
  • Str\after_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\after_last_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\before return null|lowercase-string when the first argument is lowercase-string.
  • Str\before_last return null|lowercase-string when the first argument is lowercase-string.
  • Str\before_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\before_last_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\Byte\after return null|lowercase-string when the first argument is lowercase-string.
  • Str\Byte\after_last return null|lowercase-string when the first argument is lowercase-string.
  • Str\Byte\after_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\Byte\after_last_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\Byte\before return null|lowercase-string when the first argument is lowercase-string.
  • Str\Byte\before_last return null|lowercase-string when the first argument is lowercase-string.
  • Str\Byte\before_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\Byte\before_last_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\Grapheme\after return null|lowercase-string when the first argument is lowercase-string.
  • Str\Grapheme\after_last return null|lowercase-string when the first argument is lowercase-string.
  • Str\Grapheme\after_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\Grapheme\after_last_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\Grapheme\before return null|lowercase-string when the first argument is lowercase-string.
  • Str\Grapheme\before_last return null|lowercase-string when the first argument is lowercase-string.
  • Str\Grapheme\before_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\Grapheme\before_last_ci return null|lowercase-string when the first argument is lowercase-string.
  • Str\chunk returns non-empty-list<non-empty-string> if $string is non-empty-string
  • Str\chunk returns non-empty-list<non-empty-lowercase-string> if $string is non-empty-lowercase-string
  • Str\Byte\chunk returns non-empty-list<non-empty-string> if $string is non-empty-string
  • Str\Byte\chunk returns non-empty-list<non-empty-lowercase-string> if $string is non-empty-lowercase-string
  • Str\lowercase returns non-empty-lowercase-string if $string is non-empty-string or non-falsy-string
  • Str\Byte\lowercase returns non-empty-lowercase-string if $string is non-empty-string or non-falsy-string
  • Str\repeat returns non-empty-lowercase-string if $string is non-empty-lowercase-string
  • Str\repeat returns non-empty-string if $string is non-empty-string
  • Str\repeat returns lowercase-string if $string is lowercase-string
  • Str\repeat returns string(x) if $string is a literal, and $multiplier is literal, where x is the result.
  • Str\slice returns lowercase-string if $string is lowercase-string
  • Str\Byte\slice returns lowercase-string if $string is lowercase-string
  • Str\Grapheme\slice returns lowercase-string if $string is lowercase-string
  • Str\splice returns lowercase-string if $string is lowercase-string and $replacement is lowercase-string
  • Str\Byte\splice returns lowercase-string if $string is lowercase-string and $replacement is lowercase-string
  • Str\split returns non-empty-list<non-empty-string> if $string is non-empty-string
  • Str\split returns non-empty-list<non-empty-lowercase-string> if $string is non-empty-lowercase-string
  • Str\Byte\split returns non-empty-list<non-empty-string> if $string is non-empty-string
  • Str\Byte\split returns non-empty-list<non-empty-lowercase-string> if $string is non-empty-lowercase-string
  • Str\uppercase returns non-empty-string if $string is non-empty-string
  • Str\Byte\uppercase returns non-empty-string if $string is non-empty-string

@azjezz azjezz added the enhancement New feature or request label Apr 4, 2021
@azjezz azjezz self-assigned this Apr 4, 2021
@azjezz
Copy link
Contributor Author

azjezz commented Apr 4, 2021

cc @bendavies, hopefully this solves your issue ( and more ) :)

@azjezz
Copy link
Contributor Author

azjezz commented Apr 4, 2021

TODO: add static analysis tests to PSL.

@bendavies
Copy link

awesome, thanks!

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.

support for non-empty-array/non-empty-list add support for lowercase-string return type in string functions
2 participants