I'm building a wordpress plugin using PHP 7.4 and this function returns error:
Parse error: syntax error, unexpected end of file
PHP has been properly broken out of and all curly brackets are in pairs:
<?php
function my_function()
{
$jer_ver = filemtime(WP_PLUGIN_DIR . '/somefile.js');
$style_ver = filemtime(WP_PLUGIN_DIR . '/somefile.css');
wp_enqueue_script('admin_js', plugins_url('../JS/admin.js', __FILE__), array(), $jer_ver);
wp_enqueue_style('admin_style', plugins_url('../CSS/admin.css', __FILE__), array(), $style_ver);
global $wpdb;
?>
//(some html) same error commented and uncommented
<?php
}
Adding an extra curly bracket to the end such as this fixes the error on wordpress but causes PhpStorm to freak out.
...
<?php
}
}
I have also tried adding closing tag ?>
Any suggestions?