Debugging PHP code is part of any project, but WordPress comes with specific debug systems designed to simplify the process as well as standardize code across the core, plugins, and themes.
define( 'WP_DEBUG', true ); // Enable WordPress debug mode
define( 'WP_DEBUG_LOG', true ); // Enalbe all errors to also be saved to a debug.log inside the /wp-content/
define( 'SCRIPT_DEBUG', true ); // Loads non-minified WordPRess scripts (can be exntended to plugins as well)
@ini_set( 'display_errors', 1 ); // Display all errors