@@ -38,7 +38,7 @@ public function __construct($data = [])
3838 $ this ->setFlags (ArrayObject::ARRAY_AS_PROPS );
3939
4040 if ($ data && is_string ($ data ) && file_exists ($ data )) {
41- $ data = $ this -> readFile ($ data );
41+ $ data = self :: readFile ($ data );
4242 }
4343
4444 if (is_string ($ data )) {
@@ -74,7 +74,7 @@ protected function encode($data)
7474 * @param string $name The key to check
7575 * @return boolean
7676 */
77- public function has ($ name )
77+ public function has (string $ name ): bool
7878 {
7979 return $ this ->offsetExists ($ name );
8080 }
@@ -86,14 +86,14 @@ public function has($name)
8686 * @param mixed $filter Filter returned value
8787 * @return mixed
8888 */
89- public function get ($ key , $ default = null , $ filter = null )
89+ public function get (string $ key , $ default = null , $ filter = null )
9090 {
9191 $ result = $ default ;
9292 if ($ this ->has ($ key )) {
9393 $ result = $ this ->offsetGet ($ key );
9494 }
9595
96- return $ this -> filter ($ result , $ filter );
96+ return self :: filter ($ result , $ filter );
9797 }
9898
9999 /**
@@ -102,7 +102,7 @@ public function get($key, $default = null, $filter = null)
102102 * @param mixed $value The value to set
103103 * @return $this
104104 */
105- public function set ($ name , $ value )
105+ public function set (string $ name , $ value )
106106 {
107107 $ this ->offsetSet ($ name , $ value );
108108 return $ this ;
@@ -113,7 +113,7 @@ public function set($name, $value)
113113 * @param string $name The key of the data to remove
114114 * @return $this
115115 */
116- public function remove ($ name )
116+ public function remove (string $ name ): self
117117 {
118118 if ($ this ->has ($ name )) {
119119 $ this ->offsetUnset ($ name );
@@ -137,7 +137,7 @@ public function __toString()
137137 * Encode an array or an object in INI format
138138 * @return string
139139 */
140- public function write ()
140+ public function write (): string
141141 {
142142 return $ this ->encode ($ this ->getArrayCopy ());
143143 }
@@ -154,13 +154,13 @@ public function write()
154154 * @param string $separator The separator to use when searching for sub keys. Default is '.'
155155 * @return mixed
156156 */
157- public function find ($ key , $ default = null , $ filter = null , $ separator = '. ' )
157+ public function find (string $ key , $ default = null , $ filter = null , string $ separator = '. ' )
158158 {
159159 $ value = $ this ->get ($ key );
160160
161161 // check if key exists in array
162162 if (null !== $ value ) {
163- return $ this -> filter ($ value , $ filter );
163+ return self :: filter ($ value , $ filter );
164164 }
165165
166166 // explode search key and init search data
@@ -180,11 +180,11 @@ public function find($key, $default = null, $filter = null, $separator = '.')
180180 continue ;
181181 }
182182
183- return $ this -> filter ($ default , $ filter );
183+ return self :: filter ($ default , $ filter );
184184 }
185185
186186 // return existing value
187- return $ this -> filter ($ data , $ filter );
187+ return self :: filter ($ data , $ filter );
188188 }
189189
190190 /**
@@ -194,7 +194,7 @@ public function find($key, $default = null, $filter = null, $separator = '.')
194194 * @param mixed $filter
195195 * @return mixed
196196 */
197- protected function filter ($ value , $ filter )
197+ protected static function filter ($ value , $ filter )
198198 {
199199 if (null !== $ filter ) {
200200 $ value = Filter::_ ($ value , $ filter );
@@ -230,7 +230,7 @@ public function search($needle)
230230 * Return flattened array copy. Keys are <b>NOT</b> preserved.
231231 * @return array
232232 */
233- public function flattenRecursive ()
233+ public function flattenRecursive (): array
234234 {
235235 $ flat = [];
236236
@@ -245,7 +245,7 @@ public function flattenRecursive()
245245 * @param string $filePath
246246 * @return string|false
247247 */
248- protected function readFile ($ filePath )
248+ protected static function readFile (string $ filePath )
249249 {
250250 $ contents = false ;
251251
@@ -261,7 +261,7 @@ protected function readFile($filePath)
261261 * @param array $array
262262 * @return bool
263263 */
264- protected function isMulti ($ array )
264+ protected static function isMulti (array $ array ): bool
265265 {
266266 $ arrayCount = array_filter ($ array , '\is_array ' );
267267 return count ($ arrayCount ) > 0 ;
@@ -290,7 +290,7 @@ public function offsetGet($index)
290290 *
291291 * @SuppressWarnings(PHPMD.ShortMethodName)
292292 */
293- public function is ($ key , $ compareWith = true , $ strictMode = false )
293+ public function is (string $ key , $ compareWith = true , bool $ strictMode = false ): bool
294294 {
295295 if (strpos ($ key , '. ' ) === false ) {
296296 $ value = $ this ->get ($ key );
0 commit comments