Skip to content

Commit 903cc28

Browse files
committed
Reformat code for phpstan/phpstan ^0.12
1 parent 00ec59b commit 903cc28

File tree

5 files changed

+32
-16
lines changed

5 files changed

+32
-16
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,23 @@ get __prefix__:/default/c/foo
109109
```
110110

111111

112+
### Cache tags static cache
113+
114+
```php
115+
cache()->tags(['bop', 'zap'])->get('bar1');
116+
cache()->tags(['bop'])->get('bar2');
117+
cache()->tags(['bop', 'zap', 'foo'])->get('bar3');
118+
```
119+
```
120+
get tag:bop:key
121+
get tag:zap:key
122+
get bar1
123+
get bar2
124+
get tag:foo:key
125+
get bar3
126+
```
127+
128+
112129
### Mcrouter configuration
113130

114131
This configuration example is for multiple Memcached servers, one of which is local, such as a typical Kubernetes cluster.

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
includes:
22
- vendor/phpstan/phpstan-mockery/extension.neon
33
parameters:
4-
checkMissingIterableValueType: false
54
ignoreErrors:
65
-
76
message: '#Cannot access offset (.+)#'

src/Model/Values/Mcrouter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class Mcrouter
2121
/**
2222
* Supported prefixes in Mcrouter
2323
*
24-
* @var string[]
24+
* @var array<string>
2525
*/
2626
private $prefixes = [];
2727

2828
/**
2929
* Mcrouter constructor
3030
*
31-
* @param string $sharedPrefix
32-
* @param string[] $supportedPrefixes
31+
* @param string $sharedPrefix
32+
* @param array<string> $supportedPrefixes
3333
*/
3434
public function __construct(string $sharedPrefix, array $supportedPrefixes = [])
3535
{
@@ -40,7 +40,7 @@ public function __construct(string $sharedPrefix, array $supportedPrefixes = [])
4040
/**
4141
* Get the cache prefixes.
4242
*
43-
* @return string[]
43+
* @return array<string>
4444
*/
4545
public function getPrefixes(): array
4646
{

src/Model/Values/TagSet.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class TagSet extends LaravelTagSet
1010
/**
1111
* Static cache for tags
1212
*
13-
* @var string[]
13+
* @var array<string>
1414
*/
1515
private static $tags = [];
1616

@@ -25,7 +25,7 @@ class TagSet extends LaravelTagSet
2525
* Create a new TagSet instance.
2626
*
2727
* @param \Illuminate\Contracts\Cache\Store $store
28-
* @param string[] $names
28+
* @param array<string> $names
2929
* @param \Inspirum\Mcrouter\Model\Values\Mcrouter $mcrouter
3030
*/
3131
public function __construct(Store $store, array $names, Mcrouter $mcrouter)
@@ -38,7 +38,7 @@ public function __construct(Store $store, array $names, Mcrouter $mcrouter)
3838
/**
3939
* Get an array of tag identifiers for all of the tags in the set.
4040
*
41-
* @return string[]
41+
* @return array<string>
4242
*/
4343
protected function tagIds()
4444
{
@@ -98,7 +98,7 @@ public static function resetCachedTags(): void
9898
/**
9999
* Get cached tags from static memory
100100
*
101-
* @return string[]
101+
* @return array<string>
102102
*/
103103
public static function getCachedTags(): array
104104
{

src/Services/MemcachedStore.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(Memcached $memcached, string $prefix = '', Mcrouter
3434
/**
3535
* Begin executing a new tags operation.
3636
*
37-
* @param string|string[] $names
37+
* @param string|array<string> $names
3838
*
3939
* @return \Illuminate\Cache\TaggedCache
4040
*/
@@ -66,24 +66,24 @@ public function get($key)
6666
*
6767
* Items not found in the cache will have a null value.
6868
*
69-
* @param string[] $keys
69+
* @param array<string> $keys
7070
*
71-
* @return array
71+
* @return array<string,mixed>
7272
*/
7373
public function many(array $keys)
7474
{
7575
$prefixedKeys = array_map(function ($key) {
7676
return $this->getPrefixedKey($key);
7777
}, $keys);
7878

79-
/** @var array $values */
79+
/** @var array<mixed> $values */
8080
$values = $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER);
8181

8282
if ($this->memcached->getResultCode() !== 0) {
8383
return array_fill_keys($keys, null);
8484
}
8585

86-
/** @var array $values */
86+
/** @var array<mixed> $values */
8787
$values = array_combine($keys, $values);
8888

8989
return $values;
@@ -106,8 +106,8 @@ public function put($key, $value, $seconds)
106106
/**
107107
* Store multiple items in the cache for a given number of minutes.
108108
*
109-
* @param array $values
110-
* @param int $seconds
109+
* @param array<string,mixed> $values
110+
* @param int $seconds
111111
*
112112
* @return bool
113113
*/

0 commit comments

Comments
 (0)