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

Add new functions #53

Merged
merged 11 commits into from
Dec 11, 2021
Merged

Add new functions #53

merged 11 commits into from
Dec 11, 2021

Conversation

bronek89
Copy link
Member

@bronek89 bronek89 commented Dec 9, 2021

ArrayValue:

    /**
     * @phpstan-return ArrayValue<TValue>
     */
    public function skip(int $length): ArrayValue;

    /**
     * @phpstan-return ArrayValue<TValue>
     */
    public function take(int $length): ArrayValue;

StringsArray:

    public function skip(int $length): StringsArray;

    public function take(int $length): StringsArray;

IterableValue:

    /**
     * @phpstan-return IterableValue<TKey, TValue>
     */
    public function skip(int $length): IterableValue;

    /**
     * @phpstan-return IterableValue<TKey, TValue>
     */
    public function take(int $length): IterableValue;

    /**
     * @phpstan-return array<int|string, TValue>
     */
    public function toAssocArray(): array;

    /**
     * @phpstan-return AssocValue<int|string, TValue>
     */
    public function toAssocValue(): AssocValue;

    /**
     * @phpstan-return IterableValue<int, TKey>
     */
    public function keys(): IterableValue;

@bronek89 bronek89 requested review from dazet and dlakomski December 9, 2021 16:49
@bronek89
Copy link
Member Author

@dazet i've made modifications look at f4f0107

@bronek89
Copy link
Member Author

?int $length = null smiling_imp

meh, I dont like it, I would like it to work like this:

function foo(int $a = null, ?int $b = null) {}

foo(null, null); // error
foo(0, null); // ok

either you provide valid int value, or not passing argument at all.

but it will probably never works like that so .. :)

@dazet
Copy link
Member

dazet commented Dec 11, 2021

?int $length = null smiling_imp

meh, I dont like it, I would like it to work like this:

function foo(int $a = null, ?int $b = null) {}

foo(null, null); // error
foo(0, null); // ok

either you provide valid int value, or not passing argument at all.

but it will probably never works like that so .. :)

🤔

@bronek89 bronek89 merged commit ac0120b into master Dec 11, 2021
@bronek89 bronek89 deleted the feature/new-funcs branch December 11, 2021 15:19
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.

2 participants