-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stubs marking immediately invoked callables in utils and caching
- Loading branch information
Showing
5 changed files
with
126 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Nette\Caching; | ||
|
||
class Cache | ||
{ | ||
|
||
/** | ||
* @param array<mixed>|null $dependencies | ||
* @param-immediately-invoked-callable $generator | ||
*/ | ||
public function load(mixed $key, ?callable $generator = null, ?array $dependencies = null): mixed | ||
{ | ||
} | ||
|
||
/** | ||
* @param array<scalar> $keys | ||
* @return array<mixed> | ||
* @param-immediately-invoked-callable $generator | ||
*/ | ||
public function bulkLoad(array $keys, ?callable $generator = null): array | ||
{ | ||
} | ||
|
||
/** | ||
* @param-immediately-invoked-callable $function | ||
*/ | ||
public function call(callable $function): mixed | ||
{ | ||
} | ||
|
||
/** | ||
* @param array<mixed>|null $dependencies | ||
* @param-immediately-invoked-callable $function | ||
*/ | ||
public function wrap(callable $function, ?array $dependencies = null): \Closure | ||
{ | ||
} | ||
|
||
} |
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,43 @@ | ||
<?php | ||
|
||
namespace Nette\Utils; | ||
|
||
class Arrays | ||
{ | ||
|
||
/** | ||
* @template K of array-key | ||
* @template V | ||
* @param array<K, V> $array | ||
* @param callable(V, K, array<K, V>): bool $callback | ||
* @param-immediately-invoked-callable $callback | ||
*/ | ||
public static function some(iterable $array, callable $callback): bool | ||
{ | ||
} | ||
|
||
/** | ||
* @template K of array-key | ||
* @template V | ||
* @param array<K, V> $array | ||
* @param callable(V, K, array<K, V>): bool $callback | ||
* @param-immediately-invoked-callable $callback | ||
*/ | ||
public static function every(iterable $array, callable $callback): bool | ||
{ | ||
} | ||
|
||
/** | ||
* @template K of array-key | ||
* @template V | ||
* @template R | ||
* @param array<K, V> $array | ||
* @param callable(V, K, array<K, V>): R $callback | ||
* @return array<K, R> | ||
* @param-immediately-invoked-callable $callback | ||
*/ | ||
public static function map(iterable $array, callable $callback): array | ||
{ | ||
} | ||
|
||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Nette\Utils; | ||
|
||
class Callback | ||
{ | ||
|
||
/** | ||
* @param-immediately-invoked-callable $callable | ||
* @param mixed[] ...$args | ||
*/ | ||
public static function invoke(callable $callable, ...$args): mixed | ||
{ | ||
} | ||
|
||
/** | ||
* @param-immediately-invoked-callable $callable | ||
* @param mixed[] $args | ||
*/ | ||
public static function invokeArgs(callable $callable, array $args = []): mixed | ||
{ | ||
} | ||
|
||
} |
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,15 @@ | ||
<?php | ||
|
||
namespace Nette\Utils; | ||
|
||
class Helpers | ||
{ | ||
|
||
/** | ||
* @param-immediately-invoked-callable $func | ||
*/ | ||
public static function capture(callable $func): string | ||
{ | ||
} | ||
|
||
} |