Re: Bug #19657 [Com]: TypeHintMissing not detecting invalid phpdoc var/type combination
| From: | ling_peng78@yahoo.com.cn | Date: | Tue, 13 Nov 2012 15:06:39 +0000 |
| Subject: | Re: Bug #19657 [Com]: TypeHintMissing not detecting invalid phpdoc var/type combination | ||
| References: | 1 | Groups: | php.pear.qa |
| Request: | Send a blank email to pear-qa+get-6117@lists.php.net to get a copy of this message | ||
[PEAR-BUG] Bug #19657 [Com]: TypeHintMissing not detecting invalid phpdoc var/type combination
发自我的 iPhone
在 2012-10-19,18:58,"david.gray@edigitalresearch.com" <pear-qa@lists.php.net>
写道:
> Edit report at
> https://pear.php.net/bugs/bug.php?id=19657&edit=1
>
> ID: 19657
> Comment by: david.gray@edigitalresearch.com
> Reported By: david dot gray at edigitalresearch dot com
> Summary: TypeHintMissing not detecting invalid phpdoc var/type
> combination
> Status: Open
> Type: Bug
> Package: PHP_CodeSniffer
> Operating System: CentOS release 6.3 (Final)
> Package Version: 1.4.0
> PHP Version: 5.3.16
> Roadmap Versions:
> New Comment:
>
> Hmmm, Ignore this, seems it is working as expected, meaning it must be a
> problem with my environment:
>
> <?php
> /**
> * Test Class.
> */
> class Test
> {
>
> /**
> * Foobar!
> *
> * @param $bar string|null Something.
> *
> * @return null
> */
> public function foo($bar = null)
> {
> return $bar;
> }
> }
> ?>
>
> FILE: /tmp/test/test.php
> --------------------------------------------------------------------------------
> FOUND 7 ERROR(S) AFFECTING 3 LINE(S)
> --------------------------------------------------------------------------------
> 2 | ERROR | Missing file doc comment
> 4 | ERROR | Missing @category tag in class comment
> 4 | ERROR | Missing @package tag in class comment
> 4 | ERROR | Missing @author tag in class comment
> 4 | ERROR | Missing @license tag in class comment
> 4 | ERROR | Missing @link tag in class comment
> 11 | ERROR | Doc comment for var string|null does not match actual
> variable
> | | name $bar at position 1
> --------------------------------------------------------------------------------
>
> "Doc comment for var string|null does not match actual variable name
> $bar at position 1" is the expected error.
>
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [2012-10-19 11:29:16] slydave
>
> Description:
> ------------
> If you get your @param var and type the wrong way around and
> the type contains a pipe, the warning from code sniffer is ignored
> - this is using the TypeHintMissing Sniff.
>
> Test script:
> ---------------
> Class Test {
> /**
> * Foobar!
> *
> * @param $bar null|string Something.
> *
> * @return null
> */
> public function foo($bar = null)
> {
> return $bar;
> }
> }
>
> Expected result:
> ----------------
> The pipe used to separate different possible types shouldn't
> cause PHPStorm to suppress the error that the var and hint are
> the wrong way around.
>
> Actual result:
> --------------
> PHPCS doesn't report any problem with the file - despite the type
> and var declarations are the wrong way around.
>
> ------------------------------------------------------------------------
>
>
> --
> Edit this bug report at
> https://pear.php.net/bugs/bug.php?id=19657&edit=1
>
> ---------------------
>
>
> --
> Edit this bug report at
> https://pear.php.net/bugs/bug.php?id=19657&edit=1
>