php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20265 PHPDoc and NULL variables
Submitted: 2002-11-05 13:34 UTC Modified: 2003-04-27 11:14 UTC
From: adam at tux dot appstate dot edu Assigned:
Status: Wont fix Package: PEAR related
PHP Version: 4.2.3 OS: Red Hat 8.0
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-11-05 13:34 UTC] adam at tux dot appstate dot edu
When using the @param or @var markup and defining a type for a variable, phpdoc gives errors in it's report when the default value for a variable is NULL and it is not designated the "resource" type.  IMHO NULL should be a valid value for any variable type.

Ex:

/**
 * This is a function
 * @param string $var1 A variable with default=NULL
 * @return string
 */
function foo($var1 = NULL) {
  return $var1;
}

The above will produce the following in the report:

[function] foo          mismatch

1st parameter type "$var1" does not match the the documented type "string", possible error consider an update to "@param resource $var1 A variable with default=NULL" or "@param resource A variable with default=NULL", the variable name is optional.

I hope this is enough information.

Adam

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-27 11:14 UTC] jellybob@php.net
PHPDoc is no longer supported, please use PHPDocumentor instead (see
http://pear.php.net/package-info.php?package=PhpDocumentor and
http://phpdocu.sourceforge.net/ for more details.)
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Dec 02 23:03:35 2021 UTC