PluginProbe
Media Cloud Sync / 1.4.1
Media Cloud Sync v1.4.1
1.4.1 1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 35 releases
← All changes | includes/sdk/google/ramsey/collection/src/Map/MapInterface.php +28 -35 1.2.121.4.1 View file →
@@ -9,16 +9,17 @@
9 9 * @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
10 10 * @license http://opensource.org/licenses/MIT MIT
11 11 */
12 12 declare (strict_types=1);
13 -namespace Dudlewebs\WPMCS\Ramsey\Collection\Map;
13 +namespace Dudlewebs\WPMCS\GCP\Ramsey\Collection\Map;
14 14
15 -use Dudlewebs\WPMCS\Ramsey\Collection\ArrayInterface;
15 +use Dudlewebs\WPMCS\GCP\Ramsey\Collection\ArrayInterface;
16 16 /**
17 17 * An object that maps keys to values.
18 18 *
19 19 * A map cannot contain duplicate keys; each key can map to at most one value.
20 20 *
21 + * @template K of array-key
21 22 * @template T
22 23 * @extends ArrayInterface<T>
23 24 */
24 25 interface MapInterface extends ArrayInterface
@@ -25,11 +26,11 @@
25 26 {
26 27 /**
27 28 * Returns `true` if this map contains a mapping for the specified key.
28 29 *
29 - * @param array-key $key The key to check in the map.
30 + * @param K $key The key to check in the map.
30 31 */
31 - public function containsKey($key): bool;
32 + public function containsKey(int|string $key) : bool;
32 33 /**
33 34 * Returns `true` if this map maps one or more keys to the specified value.
34 35 *
35 36 * This performs a strict type check on the value.
@@ -35,28 +36,26 @@
35 36 * This performs a strict type check on the value.
36 37 *
37 38 * @param T $value The value to check in the map.
38 39 */
39 - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
40 - public function containsValue($value): bool;
40 + public function containsValue(mixed $value) : bool;
41 41 /**
42 42 * Return an array of the keys contained in this map.
43 43 *
44 - * @return list<array-key>
44 + * @return list<K>
45 45 */
46 - public function keys(): array;
46 + public function keys() : array;
47 47 /**
48 48 * Returns the value to which the specified key is mapped, `null` if this
49 49 * map contains no mapping for the key, or (optionally) `$defaultValue` if
50 50 * this map contains no mapping for the key.
51 51 *
52 - * @param array-key $key The key to return from the map.
53 - * @param T|null $defaultValue The default value to use if `$key` is not found.
52 + * @param K $key The key to return from the map.
53 + * @param T | null $defaultValue The default value to use if `$key` is not found.
54 54 *
55 - * @return T|null the value or `null` if the key could not be found.
55 + * @return T | null the value or `null` if the key could not be found.
56 56 */
57 - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
58 - public function get($key, $defaultValue = null);
57 + public function get(int|string $key, mixed $defaultValue = null) : mixed;
59 58 /**
60 59 * Associates the specified value with the specified key in this map.
61 60 *
62 61 * If the map previously contained a mapping for the key, the old value is
@@ -61,16 +60,15 @@
61 60 *
62 61 * If the map previously contained a mapping for the key, the old value is
63 62 * replaced by the specified value.
64 63 *
65 - * @param array-key $key The key to put or replace in the map.
64 + * @param K $key The key to put or replace in the map.
66 65 * @param T $value The value to store at `$key`.
67 66 *
68 - * @return T|null the previous value associated with key, or `null` if
67 + * @return T | null the previous value associated with key, or `null` if
69 68 * there was no mapping for `$key`.
70 69 */
71 - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
72 - public function put($key, $value);
70 + public function put(int|string $key, mixed $value) : mixed;
73 71 /**
74 72 * Associates the specified value with the specified key in this map only if
75 73 * it is not already set.
76 74 *
@@ -76,26 +74,24 @@
76 74 *
77 75 * If there is already a value associated with `$key`, this returns that
78 76 * value without replacing it.
79 77 *
80 - * @param array-key $key The key to put in the map.
78 + * @param K $key The key to put in the map.
81 79 * @param T $value The value to store at `$key`.
82 80 *
83 - * @return T|null the previous value associated with key, or `null` if
81 + * @return T | null the previous value associated with key, or `null` if
84 82 * there was no mapping for `$key`.
85 83 */
86 - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
87 - public function putIfAbsent($key, $value);
84 + public function putIfAbsent(int|string $key, mixed $value) : mixed;
88 85 /**
89 86 * Removes the mapping for a key from this map if it is present.
90 87 *
91 - * @param array-key $key The key to remove from the map.
88 + * @param K $key The key to remove from the map.
92 89 *
93 - * @return T|null the previous value associated with key, or `null` if
90 + * @return T | null the previous value associated with key, or `null` if
94 91 * there was no mapping for `$key`.
95 92 */
96 - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
97 - public function remove($key);
93 + public function remove(int|string $key) : mixed;
98 94 /**
99 95 * Removes the entry for the specified key only if it is currently mapped to
100 96 * the specified value.
101 97 *
@@ -100,27 +96,25 @@
100 96 * the specified value.
101 97 *
102 98 * This performs a strict type check on the value.
103 99 *
104 - * @param array-key $key The key to remove from the map.
100 + * @param K $key The key to remove from the map.
105 101 * @param T $value The value to match.
106 102 *
107 103 * @return bool true if the value was removed.
108 104 */
109 - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
110 - public function removeIf($key, $value): bool;
105 + public function removeIf(int|string $key, mixed $value) : bool;
111 106 /**
112 107 * Replaces the entry for the specified key only if it is currently mapped
113 108 * to some value.
114 109 *
115 - * @param array-key $key The key to replace.
110 + * @param K $key The key to replace.
116 111 * @param T $value The value to set at `$key`.
117 112 *
118 - * @return T|null the previous value associated with key, or `null` if
113 + * @return T | null the previous value associated with key, or `null` if
119 114 * there was no mapping for `$key`.
120 115 */
121 - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
122 - public function replace($key, $value);
116 + public function replace(int|string $key, mixed $value) : mixed;
123 117 /**
124 118 * Replaces the entry for the specified key only if currently mapped to the
125 119 * specified value.
126 120 *
@@ -125,13 +119,12 @@
125 119 * specified value.
126 120 *
127 121 * This performs a strict type check on the value.
128 122 *
129 - * @param array-key $key The key to remove from the map.
123 + * @param K $key The key to remove from the map.
130 124 * @param T $oldValue The value to match.
131 125 * @param T $newValue The value to use as a replacement.
132 126 *
133 127 * @return bool true if the value was replaced.
134 128 */
135 - // phpcs:ignore SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
136 - public function replaceIf($key, $oldValue, $newValue): bool;
129 + public function replaceIf(int|string $key, mixed $oldValue, mixed $newValue) : bool;
137 130 }