svn: /phpdoc/doc-base/trunk/scripts/ check-references.php

From: Date: Fri, 12 Aug 2011 19:59:47 +0000
Subject: svn: /phpdoc/doc-base/trunk/scripts/ check-references.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-8606@lists.php.net to get a copy of this message
vrana Fri, 12 Aug 2011 19:59:47 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=314847 Log: More checks Changed paths: U phpdoc/doc-base/trunk/scripts/check-references.php Modified: phpdoc/doc-base/trunk/scripts/check-references.php =================================================================== --- phpdoc/doc-base/trunk/scripts/check-references.php 2011-08-12 19:59:25 UTC (rev 314846) +++ phpdoc/doc-base/trunk/scripts/check-references.php 2011-08-12 19:59:47 UTC (rev 314847) @@ -334,7 +334,7 @@ preg_match_all('~,\\s*&([^,]+)~', $matches2[3], $matches3); foreach ($matches3[1] as $val) { if (preg_match('(\\b' . preg_quote($val) . '\\b(?:\\s*=\\s*([^,;]+))?)', $function_body, $match)) { - $source_inits[$function_name][] = ($match[1] == "0L" ? "0" : $match[1]); + $source_inits[$function_name][] = preg_replace('~^(\\d+)L$~', '\\1', $match[1]); } } } elseif (!in_array($function_name, $difficult_arg_count)) { @@ -410,7 +410,7 @@ // return type if (isset($return_types[$function_name])) { $counts["return"]++; - if (!preg_match('~::__construct$~', $function_name) && !preg_match("~<type>(" . $return_types[$function_name][0] . ")</type>~", $return_type) && ($return_types[$function_name][0] != "object" || preg_match("~<type>($valid_types|$invalid_types)</type>~", $return_type)) && $return_types[$function_name][0] != "mixed") { + if (!preg_match('~::__construct$~', $function_name) && !preg_match("~<type>(" . $return_types[$function_name][0] . ")</type>~", $return_type) && ($return_types[$function_name][0] != "object" || preg_match("~<type>($valid_types|$invalid_types)</type>~", $return_type))) { echo "Wrong return type in $filename on line $lineno.\n"; echo $return_types[$function_name][1] . ":" . $return_types[$function_name][2] . ": " . $return_types[$function_name][0] . "\n"; } @@ -437,7 +437,7 @@ } // parameter types and optional - preg_match_all('~<methodparam(\\s+choice=[\'"]opt[\'"])?>\\s*<type>([^<]+)</type>\\s*<parameter(?: role="reference")?>([^<]+)</parameter>(?:<initializer>([^<]+)</initializer>)?~i', $methodsynopsis, $matches); // (PREG_OFFSET_CAPTURE can be used to get precise line numbers) + preg_match_all('~<methodparam(\\s+choice=[\'"]opt[\'"])?>\\s*<type>([^<]+)</type>\\s*<parameter(?: role="reference")?>([^<]+)</parameter>(?:<initializer>(.*?)</initializer>)?~i', $methodsynopsis, $matches); // (PREG_OFFSET_CAPTURE can be used to get precise line numbers) foreach ($matches[2] as $i => $val) { if (preg_match("~^(void|$invalid_types)\$~", $val)) { echo "Parameter #" . ($i+1) . " has wrong type '$val' in $filename on line " . ($lineno + $i + 1) . ".\n"; @@ -469,7 +469,7 @@ if ($param == "bool" && strlen($init_source)) { $init_source = ($init_source ? "true" : "false"); } - $initializer = preg_replace('~^&(.+);$~', '\\1', $matches[4][$i]); + $initializer = preg_replace('~^&(.+);$~', '\\1', strip_tags($matches[4][$i])); if (($optional_source || $optional_doc) && $initializer != $init_source && $init_source != "NULL" && (is_int($source_refs[$function_name][0]) ? $source_refs[$function_name][0] > $i+1 : !in_array($i+1, (array) $source_refs[$function_name][0]))) { $error .= "Parameter #" . ($i+1) . " has wrong initial value ($initializer instead of $init_source) in $filename on line " . ($lineno + $i + 1) . ".\n"; }

« previous php.doc.cvs (#8606) next »