@@ -21,42 +21,42 @@ class Index implements IndexInterface
2121 *
2222 * @var string
2323 */
24- protected $ id ;
24+ protected string $ id ;
2525
2626 /**
2727 * Index name.
2828 *
2929 * @var string
3030 */
31- protected $ name ;
31+ protected string $ name ;
3232
3333 /**
3434 * Sparse
3535 *
3636 * @var bool
3737 */
38- protected $ sparse ;
38+ protected bool $ sparse ;
3939
4040 /**
4141 * Index type
4242 *
4343 * @var string
4444 */
45- protected $ type ;
45+ protected string $ type ;
4646
4747 /**
4848 * Unique constraint
4949 *
5050 * @var bool
5151 */
52- protected $ unique ;
52+ protected bool $ unique ;
5353
5454 /**
5555 * Fields of index
5656 *
5757 * @var array
5858 */
59- protected $ fields ;
59+ protected array $ fields ;
6060
6161 /**
6262 * Collection where the index belongs to
@@ -71,15 +71,15 @@ class Index implements IndexInterface
7171 *
7272 * @var bool
7373 */
74- protected $ isNew ;
74+ protected bool $ isNew ;
7575
7676 /**
7777 * Valid indexes types
7878 *
7979 * @var array
8080 */
81- protected static $ indexTypes = [
82- 'fulltext ' , 'general ' , 'geo ' , 'hash ' , 'persistent ' , 'skiplist ' , 'ttl ' , 'primary ' , 'edge '
81+ protected static array $ indexTypes = [
82+ 'fulltext ' , 'general ' , 'geo ' , 'hash ' , 'persistent ' , 'skiplist ' , 'ttl ' , 'primary ' , 'edge ' , ' inverted '
8383 ];
8484
8585 /**
@@ -107,10 +107,10 @@ public function __construct(string $type, array $fields, array $attributes = [])
107107 $ this ->fields = $ fields ;
108108
109109 // Default values;
110- $ this ->id = isset ( $ attributes ['id ' ]) ? $ attributes [ ' id ' ] : '' ;
111- $ this ->name = isset ( $ attributes ['name ' ]) ? $ attributes [ ' name ' ] : '' ;
112- $ this ->unique = isset ( $ attributes ['unique ' ]) ? $ attributes [ ' unique ' ] : false ;
113- $ this ->sparse = isset ( $ attributes ['sparse ' ]) ? $ attributes [ ' sparse ' ] : false ;
110+ $ this ->id = $ attributes ['id ' ] ?? '' ;
111+ $ this ->name = $ attributes ['name ' ] ?? '' ;
112+ $ this ->unique = $ attributes ['unique ' ] ?? false ;
113+ $ this ->sparse = $ attributes ['sparse ' ] ?? false ;
114114 $ this ->isNew = !isset ($ attributes ['id ' ]);
115115 }
116116
0 commit comments