How to avoid plugins_url from breaking due to symlinks when developing Plugins for WordPress

<?php
 
// Fix the __FILE__ problem with symlinks.
// Now just use ___FILE___ instead of __FILE__
 
$___FILE___ = __FILE__;
 
if ( isset( $plugin ) ) {
    $___FILE___ = $plugin;
}
else if ( isset( $mu_plugin ) ) {
    $___FILE___ = $mu_plugin;
}
else if ( isset( $network_plugin ) ) {
    $___FILE___ = $network_plugin;
}
 
define( '___FILE___', $___FILE___ );
 
// Here we use ___FILE___ instead of __FILE__
wp_enqueue_script(
    'my-script',
    plugins_url('my-file.js', ___FILE___),
    array(),
    '',
    false
);
    
?>