-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
177 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
include __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use loophp\collection\Collection; | ||
use loophp\collection\Contract\Collection as CollectionInterface; | ||
|
||
$sum = static fn (int $carry, int $value): int => $carry + $value; | ||
$concat = static fn (?string $carry, string $string): string => sprintf('%s%s', (string) $carry, $string); | ||
|
||
/** | ||
* @param CollectionInterface<int, int> $collection | ||
*/ | ||
function scanleft_checkListInt(CollectionInterface $collection): void | ||
{ | ||
} | ||
|
||
/** | ||
* @param CollectionInterface<int, string> $collection | ||
*/ | ||
function scanleft_checkListString(CollectionInterface $collection): void | ||
{ | ||
} | ||
|
||
/** | ||
* @param CollectionInterface<int, string|null> $collection | ||
*/ | ||
function scanleft_checkListStringWithNull(CollectionInterface $collection): void | ||
{ | ||
} | ||
|
||
scanleft_checkListInt(Collection::fromIterable([1, 2, 3])->scanLeft($sum, 5)); | ||
scanleft_checkListString(Collection::fromIterable(range('a', 'c'))->scanLeft($concat, '')); | ||
scanleft_checkListStringWithNull(Collection::fromIterable(range('a', 'c'))->scanLeft($concat)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
include __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use loophp\collection\Collection; | ||
use loophp\collection\Contract\Collection as CollectionInterface; | ||
|
||
$concat = static fn (string $carry, string $string): string => sprintf('%s%s', $carry, $string); | ||
|
||
/** | ||
* @param CollectionInterface<int, string> $collection | ||
*/ | ||
function scanleft1_checkListString(CollectionInterface $collection): void | ||
{ | ||
} | ||
|
||
// see Psalm bug: https://github.com/vimeo/psalm/issues/6108 | ||
scanleft1_checkListString(Collection::fromIterable(range('a', 'c'))->scanLeft1($concat)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/** | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
include __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use loophp\collection\Collection; | ||
use loophp\collection\Contract\Collection as CollectionInterface; | ||
|
||
$sum = static fn (int $carry, int $value): int => $carry + $value; | ||
$concat = static fn (?string $carry, string $string): string => sprintf('%s%s', (string) $carry, $string); | ||
|
||
/** | ||
* @param CollectionInterface<int, int> $collection | ||
*/ | ||
function scanright_checkListInt(CollectionInterface $collection): void | ||
{ | ||
} | ||
|
||
/** | ||
* @param CollectionInterface<int, string> $collection | ||
*/ | ||
function scanright_checkListString(CollectionInterface $collection): void | ||
{ | ||
} | ||
|
||
/** | ||
* @param CollectionInterface<int, string|null> $collection | ||
*/ | ||
function scanright_checkListStringWithNull(CollectionInterface $collection): void | ||
{ | ||
} | ||
|
||
scanright_checkListInt(Collection::fromIterable([1, 2, 3])->scanRight($sum, 5)); | ||
scanright_checkListString(Collection::fromIterable(range('a', 'c'))->scanRight($concat, '')); | ||
scanright_checkListStringWithNull(Collection::fromIterable(range('a', 'c'))->scanRight($concat)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
/** | ||
* For the full copyright and license information, please view | ||
* the LICENSE file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
include __DIR__ . '/../../vendor/autoload.php'; | ||
|
||
use loophp\collection\Collection; | ||
use loophp\collection\Contract\Collection as CollectionInterface; | ||
|
||
$concat = static fn (string $carry, string $string): string => sprintf('%s%s', $carry, $string); | ||
|
||
/** | ||
* @param CollectionInterface<int, string> $collection | ||
*/ | ||
function scanright1_checkListString(CollectionInterface $collection): void | ||
{ | ||
} | ||
|
||
// see Psalm bug: https://github.com/vimeo/psalm/issues/6108 | ||
scanright1_checkListString(Collection::fromIterable(range('a', 'c'))->scanRight1($concat)); |