@@ -49,10 +49,10 @@ protected function populateFromConfig(): void
4949 {
5050 $ populate = [];
5151 foreach ($ this ->getElements () as $ element ) {
52- [$ section , $ key ] = $ this ->getIniKeyFromName ($ element ->getName ());
53- if ($ section === null || $ key === null ) {
52+ if (($ parts = $ this ->getIniKeyFromName ($ element ->getName ())) === null ) {
5453 continue ;
5554 }
55+ [$ section , $ key ] = $ parts ;
5656 $ value = $ this ->getPopulatedValue ($ element ->getName ()) ?? $ this ->config ->get ($ section , $ key );
5757 if ($ value === null ) {
5858 continue ;
@@ -67,17 +67,13 @@ protected function populateFromConfig(): void
6767 *
6868 * @param string $name The element name
6969 *
70- * @return string[] |null
70+ * @return array{ string, string} |null
7171 */
7272 protected function getIniKeyFromName (string $ name ): ?array
7373 {
7474 $ parts = explode ('__ ' , $ name , 2 );
7575
76- if (count ($ parts ) !== 2 ) {
77- return [null , null ];
78- }
79-
80- return $ parts ;
76+ return count ($ parts ) === 2 ? $ parts : null ;
8177 }
8278
8379 /**
@@ -90,10 +86,10 @@ protected function getIniKeyFromName(string $name): ?array
9086 */
9187 public function getConfigValue (string $ name , mixed $ default = null ): mixed
9288 {
93- [$ section , $ key ] = $ this ->getIniKeyFromName ($ name );
94- if ($ section === null || $ key === null ) {
89+ if (($ parts = $ this ->getIniKeyFromName ($ name )) === null ) {
9590 return $ default ;
9691 }
92+ [$ section , $ key ] = $ parts ;
9793
9894 return $ this ->config ->get ($ section , $ key , $ default );
9995 }
@@ -110,10 +106,10 @@ protected function save(): void
110106 if (in_array ($ element ->getName (), $ this ->ignoredElements )) {
111107 continue ;
112108 }
113- [$ section , $ key ] = $ this ->getIniKeyFromName ($ element ->getName ());
114- if ($ section === null || $ key === null ) {
109+ if (($ parts = $ this ->getIniKeyFromName ($ element ->getName ())) === null ) {
115110 continue ;
116111 }
112+ [$ section , $ key ] = $ parts ;
117113
118114 $ value = $ this ->getPopulatedValue ($ element ->getName ());
119115 $ configSection = $ this ->config ->getSection ($ section );
0 commit comments