@@ -34,9 +34,9 @@ protected function bootTagProvider(iterable $tags): void
3434 }
3535
3636 /**
37- * @return list<TagInterface>
38- *@see TagsProviderInterface::getTags()
37+ * @see TagsProviderInterface::getTags()
3938 *
39+ * @return list<TagInterface>
4040 */
4141 public function getTags (): array
4242 {
@@ -45,11 +45,15 @@ public function getTags(): array
4545
4646 public function offsetExists (mixed $ offset ): bool
4747 {
48+ assert (\is_int ($ offset ));
49+
4850 return isset ($ this ->tags [$ offset ]);
4951 }
5052
5153 public function offsetGet (mixed $ offset ): ?TagInterface
5254 {
55+ assert (\is_int ($ offset ));
56+
5357 return $ this ->tags [$ offset ] ?? null ;
5458 }
5559
@@ -60,6 +64,9 @@ public function offsetGet(mixed $offset): ?TagInterface
6064 */
6165 public function offsetSet (mixed $ offset , mixed $ value ): void
6266 {
67+ assert (\is_int ($ offset ));
68+ assert ($ value instanceof TagInterface);
69+
6370 throw new \BadMethodCallException (self ::class . ' objects are immutable ' );
6471 }
6572
@@ -70,6 +77,8 @@ public function offsetSet(mixed $offset, mixed $value): void
7077 */
7178 public function offsetUnset (mixed $ offset ): void
7279 {
80+ assert (\is_int ($ offset ));
81+
7382 throw new \BadMethodCallException (self ::class . ' objects are immutable ' );
7483 }
7584
0 commit comments