File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 55use BEA \Theme \Framework \Service ;
66use BEA \Theme \Framework \Service_Container ;
77use BEA \Theme \Framework \Tools \Assets as Assets_Tools ;
8+ use function json_last_error ;
9+ use const JSON_ERROR_NONE ;
810
911/**
1012 * Class Assets
@@ -113,22 +115,22 @@ public function stylesheet_uri( string $stylesheet_uri ): string {
113115 *
114116 * @param string $type
115117 *
116- * @return bool|null
118+ * @return string
117119 */
118- public function get_min_file ( string $ type ): ? bool {
120+ public function get_min_file ( string $ type ): string {
119121 if ( empty ( $ type ) ) {
120- return false ;
122+ return '' ;
121123 }
122124
123125 if ( ! file_exists ( \get_theme_file_path ( '/dist/assets/assets.json ' ) ) ) {
124- return false ;
126+ return '' ;
125127 }
126128
127129 $ json = file_get_contents ( \get_theme_file_path ( '/dist/assets/assets.json ' ) ); //phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
128130 $ assets = json_decode ( $ json , true );
129131
130- if ( empty ( $ assets ) ) {
131- return false ;
132+ if ( empty ( $ assets ) || JSON_ERROR_NONE !== json_last_error () ) {
133+ return '' ;
132134 }
133135
134136 switch ( $ type ) {
@@ -155,7 +157,7 @@ public function get_min_file( string $type ): ?bool {
155157 }
156158
157159 if ( empty ( $ file ) ) {
158- return false ;
160+ return '' ;
159161 }
160162
161163 return $ file ;
You can’t perform that action at this time.
0 commit comments