diff --git a/extension.neon b/extension.neon index 832a9cb..e0bd64d 100644 --- a/extension.neon +++ b/extension.neon @@ -7,6 +7,7 @@ parameters: stubFiles: - stubs/Application/Routers/RouteList.stub - stubs/Application/UI/Component.stub + - stubs/Caching/Cache.stub - stubs/ComponentModel/IComponent.stub - stubs/Database/ResultSet.stub - stubs/Database/Table/ActiveRow.stub diff --git a/stubs/Caching/Cache.stub b/stubs/Caching/Cache.stub new file mode 100644 index 0000000..a4f68e7 --- /dev/null +++ b/stubs/Caching/Cache.stub @@ -0,0 +1,82 @@ +, files?: list, items?: list, const?: list|string, callbacks?: list>, namespaces?: list } + * @phpstan-type clean-conditions array{ priority?: int, tags?: list, all?: true } + */ +class Cache +{ + + /** + * @template T + * @param mixed $key + * @param (callable(cache-dependencies &$dependencies): T)|null $generator + * @return T + */ + public function load($key, callable $generator = null) + { + // nothing + } + + /** + * @template T of array + * @param array $key + * @param (callable(mixed, cache-dependencies &$dependencies): T)|null $generator + * @return T + */ + public function bulkLoad($key, callable $generator = null) + { + // nothing + } + + /** + * @template T + * @param mixed $key + * @param T $data + * @param cache-dependencies|null $dependencies + * @return T + * @throws InvalidArgumentException + */ + public function save($key, $data, array $dependencies = null) + { + // nothing + } + + + /** + * @param clean-conditions|null $conditions + */ + public function clean(array $conditions = null): void + { + // nothing + } + + + /** + * @template T + * @param (callable(): T) $function + * @return T + */ + public function call(callable $function) + { + // nothing + } + + + /** + * @template T + * @param (callable(): T) $function + * @param cache-dependencies|null $dependencies + * @return (\Closure(): T) + */ + public function wrap(callable $function, array $dependencies = null): \Closure + { + // nothing + } + +}