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 Nette\Caching stub #81

Open
wants to merge 1 commit into
base: 1.1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions extension.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
82 changes: 82 additions & 0 deletions stubs/Caching/Cache.stub
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

namespace Nette\Caching;

use Nette\InvalidArgumentException;


/**
* @phpstan-type cache-dependencies array{ priority?: int, expire?: string|int|\DateTimeInterface, sliding?: mixed, tags?: list<string>, files?: list<string>, items?: list<string>, const?: list<string>|string, callbacks?: list<array{0: (callable(): bool)}&array<mixed>>, namespaces?: list<string> }
* @phpstan-type clean-conditions array{ priority?: int, tags?: list<string>, 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<mixed> $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
}

}