Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #17908 CodeSniffer does not recognise optional @params
Submitted: 2010-09-29 14:29 UTC
From: pete Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.3.0RC1)
PHP Version: Not relevant OS: Not relevant
Roadmaps: (Not assigned)    
Subscription  


 [2010-09-29 14:29 UTC] pete (Pete Walker)
Description: ------------ PHPDoc allows you to describe optional infinite @params that function may accept, but that do not appear in the function signature. When using the PEAR code standard, the sniffer throws an error every time you include too many parameters, regardless of trailing dots. I can imagine a temporary fix would simply check for the ",..." at the end of the variable name, but you would also need to check that the optional parameter is the last variable defined. Any variables defined after it should also produce an error. Test script: --------------- See example at http://manual.phpdoc.org/HTMLframesConverter/default/phpDocumentor/tutorial_tags.param.pkg.html Expected result: ---------------- No output Actual result: -------------- 70 | ERROR | Superfluous doc comment at position 3

Comments

 [2010-09-29 15:00 UTC] pete (Pete Walker)
 [2010-09-29 20:05 UTC] pete (Pete Walker)
-Operating System: Mac OS X +Operating System: Mac OS X 10.6
 [2010-10-08 20:02 UTC] doconnor (Daniel O'Connor)
-Assigned To: +Assigned To: squiz
 [2012-07-11 17:24 UTC] pete (Pete Walker)
Any movement on this..? It's been over a year and a half...
 [2012-07-11 17:24 UTC] pete (Pete Walker)
-Operating System: Mac OS X 10.6 +Operating System: Not relevant -PHP Version: 5.3.2 +PHP Version: Not relevant
 [2012-08-17 07:35 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Better late than never I hope. Patch is slightly different, but think it still works. Commit is here: https://github.com/squizlabs/PHP_CodeSniffer/commit/303a5a45c90200209881787f3 935fa530599f9a1