|IDE Validation Issues [message #7241]
||Sun, 02 December 2018 04:39
Registered: August 2008
I am just about to finish updating my environment with the latest and greatest release levels. As usual this was a lot of fun, needed more time than anticipated and had some unpleasant side effects. It turned out that the new IDE is much more strict in validating PHP code. I am now faced with 126 errors and the ridiculous quantity of 24000 warnings. I am using Eclipse (now 4.8, previously 4.6.1) with PHP Development Tools (now 6.0, previously 4.1) and PHP 7.2 (previously 7.0). I also upgraded Radicore to 2.10. In the prior environment I had 8 errors and 300 warnings, which didn't bother me. However with the actual numbers, it is much more difficult to see my own coding issues.
Not sure if you are interested to look into these errors, some developers are keen to create projects with as few errors and warnings as possible. Focusing on the errors, these can be categorized as follows:
1.) Cannot be resolved to a type error in the "real" PHP code
The following code in audit_transfer.php is a good example of this validation error:
$audit_hdr = new Audit_Hdr;
$audit_dtl = new Audit_Dtl;
$audit_dtl_jnr = new Audit_Dtl_jnr;
The mentioned include files are not present in my distribution. Therefore class definitions for Audit_Hdr, Audit_Dtl and Audit_Dtl_jnr could not be resolved. Running this code would obviously create a runtime exception. The IDE found similar issues in include.library.inc and tcpdf_php4.php.
2.) Cannot be resolved to a type error in the generated comment (PHPDOC)
An example is datamatrix.php where the generated comment looks as follows:
* Return the 253-state codeword
* @param $cwpad (int) Pad codeword.
* @param $cwpos (int) Number of data codewords from the beginning of encoded data.
* @return pad codeword
For the comment "@return pad codeword" a validation error is shown, it would need to be changed to something like "@return $pad codeword" (see also here: https://www.eclipse.org/forums/index.php/t/1093196/). Most of similar validation errors are in the tcpdf library. A few ones are nusoap.php and std.fileupload2.inc.
3.) Other validation issues (These did already show up in the previous version of the IDE)
- IDE complains about the class signature in alias.class.in and default.class.inc.
- There are XML issues reported for test-request-1.xml, test-request-2.xml and test-request-3.xml
I attach a file with my findings. Line numbers are provided for the radicore 2.10 version. Validation errors are in red.