File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -124,15 +124,17 @@ public function get_sprite_hash( string $sprite_name ): ?string {
124124 $ json_file = get_theme_file_path ( '/dist/sprite-hashes.json ' );
125125
126126 if ( is_readable ( $ php_file ) ) {
127- $ sprite_hashes = require $ php_file ;
128- $ sprite_hashes = \is_array ( $ sprite_hashes ) ? $ sprite_hashes : [];
127+ $ sprite_hash = require $ php_file ;
128+ $ sprite_hash = \is_array ( $ sprite_hashes ) ? $ sprite_hashes : [];
129129 } elseif ( is_readable ( $ json_file ) ) {
130- $ json_content = file_get_contents ( $ json_file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
130+ $ sprite_hash = file_get_contents ( $ json_file ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
131131 try {
132- $ sprite_hashes = json_decode ( $ json_content , true , 512 , JSON_THROW_ON_ERROR );
133- $ sprite_hashes = \is_array ( $ sprite_hashes ) ? $ sprite_hashes : [];
132+ $ sprite_hash = json_decode ( $ json_content , true , 512 , JSON_THROW_ON_ERROR );
133+ $ sprite_hash = \is_array ( $ sprite_hashes ) ? $ sprite_hashes : [];
134134 } catch ( \JsonException $ e ) {
135135 $ sprite_hashes = [];
136+
137+ return null ;
136138 }
137139 } else {
138140 $ sprite_hashes = [];
You can’t perform that action at this time.
0 commit comments