I crossed a tool called
PHPStan (Stan =
Static
Analysis)
However, it's been a little tough previewing so far, as it's optimized for OO code, rather than the procedural/OO mix of things as we have. Stan can scan directories of php files as well (as their examples show covering a src/ and test/ directories), but we have
many files at our root level that are not, so those may have to be scripted to ease the checking. (I've been wanting to clean up our root, a lower priority at the moment though)
Doesn't appear to automatically pull other definitions (like from the include files), but getting a basic config which specifies some include files to read at startup, and running a check on the same file gave the output below:
(Obviously, I do not yet have many other related definitions covered, such as the
property object:: stuff, and others.)
At first, there were ~140 errors before getting other definitions covered.
Code:
Line SelectOrderItems.php
------ ---------------------------------------------------------------
57 Variable $NewItemArray might not be defined.
60 Variable $InsertNum might not be defined.
60 Variable $Row might not be defined.
84 Class Cart referenced with incorrect case: cart.
86 Variable $CustomerLogin might not be defined.
111 Class Cart referenced with incorrect case: cart.
178 Variable $CustomerLogin might not be defined.
309 Variable $LastLineNo might not be defined.
322 Class Cart referenced with incorrect case: cart.
417 Variable $SelectedBranch might not be defined.
468 Variable $debug might not be defined.
593 Variable $RootPath might not be defined.
593 Variable $Theme might not be defined.
700 Class Cart referenced with incorrect case: cart.
714 Variable $RootPath might not be defined.
714 Variable $Theme might not be defined.
716 Access to an undefined property object::$Quotation.
722 Access to an undefined property object::$CustomerName.
723 Access to an undefined property object::$DeliverTo.
724 Access to an undefined property object::$LocationName.
725 Access to an undefined property object::$SalesTypeName.
726 Access to an undefined property object::$PaymentTerms.
838 Access to an undefined property object::$DefaultCurrency.
839 Access to an undefined property object::$DefaultCurrency.
880 Access to an undefined property object::$DeliveryDays.
896 Access to an undefined property object::$DeliveryDays.
922 Variable $NewItemQty might not be defined.
1036 Call to an undefined method object::Some_Already_Delivered().
1038 Call to an undefined method object::remove_from_cart().
1040 Access to an undefined property object::$LineItems.
1046 Access to an undefined property object::$LineItems.
1098 Variable $ItemDue might not be defined.
1098 Variable $NewItem might not be defined.
1100 Access to an undefined property object::$DeliveryDays.
1104 Access to an undefined property object::$LineItems.
1104 Call to an undefined method object::Some_Already_Delivered().
1106 Access to an undefined property object::$LineItems.
1106 Call to an undefined method object::Some_Already_Delivered().
1110 Access to an undefined property object::$LineItems.
1124 Access to an undefined property object::$CreditAvailable.
1138 Call to an undefined method object::update_cart_item().
1156 Access to an undefined property object::$LineItems.
1162 Access to an undefined property object::$LineItems.
1170 Access to an undefined property object::$DefaultSalesType.
1180 Access to an undefined property object::$LineItems.
1182 Access to an undefined property object::$LineItems.
1183 Access to an undefined property object::$LineItems.
1183 Access to an undefined property object::$LineItems.
1183 Access to an undefined property object::$LineItems.
1183 Access to an undefined property object::$LineItems.
1191 Variable $RootPath might not be defined.
1193 Variable $RootPath might not be defined.
1295 Access to an undefined property object::$LineItems.
1301 Access to an undefined property object::$LineItems.
1309 Access to an undefined property object::$DefaultSalesType.
1319 Access to an undefined property object::$LineItems.
1321 Access to an undefined property object::$LineItems.
1328 Access to an undefined property object::$LineItems.
1332 Access to an undefined property object::$DefaultPOLine.
1368 Access to an undefined property object::$total.
1369 Access to an undefined property object::$totalVolume.
1370 Access to an undefined property object::$totalWeight.
1372 Access to an undefined property object::$LineItems.
1375 Access to an undefined property object::$CurrDecimalPlaces.
1396 Variable $RootPath might not be defined.
1410 Access to an undefined property object::$CurrDecimalPlaces.
1414 Access to an undefined property object::$CurrDecimalPlaces.
1415 Access to an undefined property object::$CurrDecimalPlaces.
1420 Call to an undefined method object::Some_Already_Delivered().
1428 Access to an undefined property object::$DeliveryDays.
1429 Access to an undefined property object::$LineItems.
1453 Access to an undefined property object::$CurrDecimalPlaces.
1510 Variable $RootPath might not be defined.
1510 Variable $Theme might not be defined.
1541 Access to an undefined property object::$Location.
1550 Access to an undefined property object::$Location.
1555 Access to an undefined property object::$Location.
1609 Variable $RootPath might not be defined.
1609 Variable $Theme might not be defined.
1686 Variable $Offset might not be defined.
1688 Variable $Offset might not be defined.
1714 Access to an undefined property object::$Location.
1723 Access to an undefined property object::$Location.
1728 Access to an undefined property object::$Location.
1768 Variable $j might not be defined.
1769 Variable $j might not be defined.
1772 Variable $j might not be defined.
1779 Variable $Offset might not be defined.
1781 Variable $Offset might not be defined.
1794 Access to an undefined property object::$DefaultPOLine.
1801 Access to an undefined property object::$DeliveryDays.
1806 Access to an undefined property object::$DefaultPOLine.
1827 Access to an undefined property object::$DefaultPOLine.
1867 Access to an undefined property object::$ItemsOrdered.
------ ---------------------------------------------------------------
[ERROR] Found 94 errors
I'll tinker with stan a little more over the weekend to see if it could possibly be useful, or it could turn out to be more trouble than it's worth and need seek some other resource. There are other configurable items with this tool, maybe I could check only for the
might not be defined things first.