Open andergmartins opened 2 days ago
I've found a similar issue on src/core/Classes/Utils.php
:
et_get_theme_version
Use call_user_func
on that function.
ELEMENTOR_PRO_VERSION
Use constant('ELEMENTOR_PRO_VERSION')
instead of the constant directly.
WPSEO_VERSION
Also use constant(....
.
Expected Behavior
When opening the plugin's code in my IDE (Cursor), I expect not to see error flags about classes that are not found.
Current Behavior
The class
MA_Wpengine_Integration
is flagged with an error in the methodflushWPECache
because the class\WpeCommon
does not exist on the project. The flag is correct since that class is only defined when that 3rd party plugin is installed, but we have options to keep its functionality and still avoid those flags.Possible Solution
Refactor the method
flushWPECache
usingmethod_exists
instead offunction_exists
and usingcall_user_func
instead of mentioning the class name directly. Something like the following snippetUsing that snippet, we mention the class name as a string, not triggering the errors, considering it will only be called if the class is also defined.