@@ -21,41 +21,52 @@ interface DataInterface
2121 /**
2222 * Append a value to a key (assumes key refers to an array value)
2323 *
24+ * If the key does not yet exist it will be created.
25+ * If the key references a non-array it's existing contents will be added into a new array before appending the new value.
26+ *
2427 * @param string $key
2528 * @param mixed $value
2629 *
27- * @throws InvalidPathException if the given path is empty
30+ * @throws InvalidPathException if the given key is empty
2831 */
2932 public function append (string $ key , $ value = null ): void ;
3033
3134 /**
3235 * Set a value for a key
3336 *
37+ * If the key does not yet exist it will be created.
38+ *
3439 * @param string $key
3540 * @param mixed $value
3641 *
37- * @throws InvalidPathException if the given path is empty
38- * @throws DataException if the given path does not target an array
42+ * @throws InvalidPathException if the given key is empty
43+ * @throws DataException if the given key does not target an array
3944 */
4045 public function set (string $ key , $ value = null ): void ;
4146
4247 /**
4348 * Remove a key
4449 *
50+ * No exception will be thrown if the key does not exist
51+ *
4552 * @param string $key
4653 *
47- * @throws InvalidPathException if the given path is empty
54+ * @throws InvalidPathException if the given key is empty
4855 */
4956 public function remove (string $ key ): void ;
5057
5158 /**
5259 * Get the raw value for a key
5360 *
61+ * If the key does not exist, the provided default value (or null) will be returned instead.
62+ *
5463 * @param string $key
5564 * @param mixed $default
5665 *
5766 * @return mixed
5867 *
68+ * @throws InvalidPathException if the given key is empty
69+ *
5970 * @psalm-mutation-free
6071 */
6172 public function get (string $ key , $ default = null );
@@ -67,6 +78,8 @@ public function get(string $key, $default = null);
6778 *
6879 * @return bool
6980 *
81+ * @throws InvalidPathException if the given key is empty
82+ *
7083 * @psalm-mutation-free
7184 */
7285 public function has (string $ key ): bool ;
@@ -78,7 +91,8 @@ public function has(string $key): bool;
7891 *
7992 * @return DataInterface
8093 *
81- * @throws DataException if the given path does not reference an array
94+ * @throws InvalidPathException if the given key is empty
95+ * @throws DataException if the given key does not reference an array
8296 *
8397 * @psalm-mutation-free
8498 */
0 commit comments