Susan, I find that a lot of things that used to take me hours to find went away when I started using JetBrains' PhpStorm. Its code inspection is nothing short of amazing. For example:
if (isset($scriptProperties['useFilter']) && $scriptProperties['useFilter'])) {
$userFilter = true;
}
$resource = $modx->getObject('modResource', 12);
if (! $resource) {
return('Failed to get resource');
}
/* lots more code here */
if ($useFilter) {
filter($resource);
}
PhpStorm will flag the $useFilter at the bottom as an error. When you hover over it, you get a message: "$useFilter may not have been set."
My "projects" always include the entire MODX core (I put my code in assets/mycomponents). PhpStorm has the whole core and my code indexed. I can right-click on any MODX method and jump to the function declaration in a new window, wherever it is in the core. I can also right-click in the project tree and do fairly fast regular or regex searches of the entire core or any subdirectory and get a list of links I can click on to open those files with the cursor at the search term.
It does type checking for arguments to your functions and MODX methods, and more directly relevant to your suspicions, it highlights misspelled variable names in both directions. A variable that's used but hasn't been set gets highlighted, *and* a variable that is never used or that gets its value changed before it is ever used is also highlighted.
It also has fairly impressive code inspection for HTML, JS, and CSS.
The only down side is that it takes a long time to load. Once it's up, though, it's plenty fast.
I resisted giving up my old favorite editor for a long time, but I wish I has switched sooner.
------------------------------------------------------------------------------------------
PLEASE, PLEASE specify the version of MODX you are using.
MODX info for everyone:
http://bobsguides.com/modx.html