22
33namespace LaunchDarkly \SharedTest \Tests ;
44
5- use LaunchDarkly \FeatureFlag ;
65use LaunchDarkly \FeatureRequester ;
7- use LaunchDarkly \Segment ;
6+ use LaunchDarkly \Impl \Model \FeatureFlag ;
7+ use LaunchDarkly \Impl \Model \Segment ;
88use LaunchDarkly \SharedTest \DatabaseFeatureRequesterTestBase ;
99
1010class FakeDatabase
1111{
1212 public static $ data = [];
1313
14- public static function getItem ($ prefix , $ namespace , $ key )
14+ public static function getItem (string $ prefix , string $ namespace , string $ key ): ? array
1515 {
1616 $ dataSet = self ::$ data [$ prefix ] ?? null ;
1717 if ($ dataSet ) {
@@ -24,7 +24,7 @@ public static function getItem($prefix, $namespace, $key)
2424 return null ;
2525 }
2626
27- public static function getAllItems ($ prefix , $ namespace )
27+ public static function getAllItems (string $ prefix , string $ namespace ): array
2828 {
2929 $ itemsOut = [];
3030 $ dataSet = self ::$ data [$ prefix ] ?? [];
@@ -35,7 +35,7 @@ public static function getAllItems($prefix, $namespace)
3535 return $ itemsOut ;
3636 }
3737
38- public static function putSerializedItem ($ prefix , $ namespace , $ key , $ json )
38+ public static function putSerializedItem (string $ prefix , string $ namespace , string $ key , string $ json ): void
3939 {
4040 if (!isset (self ::$ data [$ prefix ])) {
4141 self ::$ data [$ prefix ] = [];
@@ -56,7 +56,7 @@ public function __construct($prefix)
5656 $ this ->prefix = $ prefix ;
5757 }
5858
59- public function getFeature ($ key )
59+ public function getFeature (string $ key ): ? FeatureFlag
6060 {
6161 $ json = FakeDatabase::getItem ($ this ->prefix , 'features ' , $ key );
6262 if ($ json ) {
@@ -66,7 +66,7 @@ public function getFeature($key)
6666 return null ;
6767 }
6868
69- public function getSegment ($ key )
69+ public function getSegment (string $ key ): ? Segment
7070 {
7171 $ json = FakeDatabase::getItem ($ this ->prefix , 'segments ' , $ key );
7272 if ($ json ) {
@@ -76,7 +76,7 @@ public function getSegment($key)
7676 return null ;
7777 }
7878
79- public function getAllFeatures ()
79+ public function getAllFeatures (): array
8080 {
8181 $ jsonList = FakeDatabase::getAllItems ($ this ->prefix , 'features ' );
8282 $ itemsOut = [];
0 commit comments