mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2025-01-22 05:11:47 +01:00
Add sequence helper
This commit is contained in:
parent
8ea3a8de27
commit
871c4a186b
19
src/Psl/sequence.php
Normal file
19
src/Psl/sequence.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Psl;
|
||||
|
||||
/**
|
||||
* This function is a kludge that returns the last argument it receives.
|
||||
*
|
||||
* @psalm-template T
|
||||
*
|
||||
* @psalm-param T ...$args
|
||||
*
|
||||
* @psalm-return null|T
|
||||
*/
|
||||
function sequence(...$args)
|
||||
{
|
||||
return Iter\last($args);
|
||||
}
|
@ -16,6 +16,7 @@ function __bootstrap(): void
|
||||
'/Psl/Random/float.php',
|
||||
'/Psl/Random/bytes.php',
|
||||
'/Psl/internal.php',
|
||||
'/Psl/sequence.php',
|
||||
'/Psl/Str/replace_every_ci.php',
|
||||
'/Psl/Str/ends_with_ci.php',
|
||||
'/Psl/Str/pad_left.php',
|
||||
@ -129,7 +130,6 @@ function __bootstrap(): void
|
||||
'/Psl/Math/constants.php',
|
||||
'/Psl/Math/min_by.php',
|
||||
'/Psl/invariant.php',
|
||||
|
||||
'/Psl/Iter/pull.php',
|
||||
'/Psl/Iter/count.php',
|
||||
'/Psl/Iter/values.php',
|
||||
@ -245,7 +245,6 @@ function __bootstrap(): void
|
||||
'/Psl/Arr/count_values.php',
|
||||
'/Psl/Arr/merge.php',
|
||||
'/Psl/Arr/shuffle.php',
|
||||
'/bootstrap.php',
|
||||
];
|
||||
|
||||
if ($booted) {
|
||||
@ -254,11 +253,7 @@ function __bootstrap(): void
|
||||
|
||||
$booted = true;
|
||||
foreach ($files as $file) {
|
||||
if (!\file_exists(__DIR__.'/'.$file)) {
|
||||
\var_dump($file);
|
||||
} else {
|
||||
require_once __DIR__ . '/' . $file;
|
||||
}
|
||||
require_once __DIR__ . '/' . $file;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user