2
2
3
3
namespace Salient \Collection ;
4
4
5
- use Salient \Contract \Collection \CollectionInterface ;
5
+ use Salient \Contract \Collection \DictionaryInterface ;
6
6
use Salient \Contract \Core \Arrayable ;
7
7
use Salient \Contract \Core \Comparable ;
8
8
use Salient \Contract \Core \Jsonable ;
22
22
* @template TKey of array-key
23
23
* @template TValue
24
24
*
25
- * @phpstan-require-implements CollectionInterface
25
+ * @phpstan-require-implements DictionaryInterface
26
26
* @phpstan-require-implements IteratorAggregate
27
27
*/
28
28
trait ReadOnlyCollectionTrait
@@ -68,7 +68,7 @@ public function get($key)
68
68
/**
69
69
* @inheritDoc
70
70
*/
71
- public function forEach (callable $ callback , int $ mode = CollectionInterface ::CALLBACK_USE_VALUE )
71
+ public function forEach (callable $ callback , int $ mode = DictionaryInterface ::CALLBACK_USE_VALUE )
72
72
{
73
73
$ prev = null ;
74
74
$ item = null ;
@@ -91,7 +91,7 @@ public function forEach(callable $callback, int $mode = CollectionInterface::CAL
91
91
/**
92
92
* @inheritDoc
93
93
*/
94
- public function find (callable $ callback , int $ mode = CollectionInterface ::CALLBACK_USE_VALUE | CollectionInterface ::FIND_VALUE )
94
+ public function find (callable $ callback , int $ mode = DictionaryInterface ::CALLBACK_USE_VALUE | DictionaryInterface ::FIND_VALUE )
95
95
{
96
96
$ prev = null ;
97
97
$ item = null ;
@@ -349,31 +349,31 @@ protected function compareItems($a, $b): int
349
349
}
350
350
351
351
/**
352
- * @param int-mask-of<CollectionInterface ::*> $mode
352
+ * @param int-mask-of<DictionaryInterface ::*> $mode
353
353
* @param TKey $key
354
354
* @param TValue $value
355
355
* @return ($mode is 3|11|19 ? array{TKey,TValue} : ($mode is 2|10|18 ? TKey : TValue))
356
356
*/
357
357
protected function getCallbackValue (int $ mode , $ key , $ value )
358
358
{
359
- $ mode &= CollectionInterface ::CALLBACK_USE_BOTH ;
360
- return $ mode === CollectionInterface ::CALLBACK_USE_KEY
359
+ $ mode &= DictionaryInterface ::CALLBACK_USE_BOTH ;
360
+ return $ mode === DictionaryInterface ::CALLBACK_USE_KEY
361
361
? $ key
362
- : ($ mode === CollectionInterface ::CALLBACK_USE_BOTH
362
+ : ($ mode === DictionaryInterface ::CALLBACK_USE_BOTH
363
363
? [$ key , $ value ]
364
364
: $ value );
365
365
}
366
366
367
367
/**
368
- * @param int-mask-of<CollectionInterface ::*> $mode
368
+ * @param int-mask-of<DictionaryInterface ::*> $mode
369
369
* @param TKey $key
370
370
* @param TValue $value
371
371
* @return ($mode is 16|17|18|19 ? TKey : TValue)
372
372
*/
373
373
protected function getReturnValue (int $ mode , $ key , $ value )
374
374
{
375
- return $ mode & CollectionInterface ::FIND_KEY
376
- && !($ mode & CollectionInterface ::FIND_VALUE )
375
+ return $ mode & DictionaryInterface ::FIND_KEY
376
+ && !($ mode & DictionaryInterface ::FIND_VALUE )
377
377
? $ key
378
378
: $ value ;
379
379
}
0 commit comments