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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adam at tux dot appstate dot edu
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 14:01:27 2025 UTC