コード例 #1
0
 /**
  * Returns whether this function is deprecated
  *
  * This is purely a wrapper method, which calls the corresponding method of
  * the parent class.
  * @return boolean
  */
 public function isDeprecated()
 {
     // TODO: also check @deprecated annotation
     if ($this->reflectionSource instanceof ReflectionFunction) {
         return $this->reflectionSource->isDeprecated();
     } else {
         return parent::isDeprecated();
     }
 }
コード例 #2
0
 /**
  * Constructor.
  *
  * Uses the Reflection API to get a list of deprecated functions.
  */
 public function __construct()
 {
     $functions = get_defined_functions();
     foreach ($functions['internal'] as $functionName) {
         $function = new ReflectionFunction($functionName);
         if ($function->isDeprecated() === true) {
             $this->forbiddenFunctions[$functionName] = null;
         }
     }
 }
コード例 #3
0
<?php

$r = new ReflectionExtension("mysql");
$ignore = array();
$functions = $r->getFunctions();
asort($functions);
printf("Functions:\n");
foreach ($functions as $func) {
    if (isset($ignore[$func->name])) {
        continue;
    }
    printf("  %s\n", $func->name);
    $rf = new ReflectionFunction($func->name);
    printf("    Deprecated: %s\n", $rf->isDeprecated() ? "yes" : "no");
    printf("    Accepted parameters: %d\n", $rf->getNumberOfParameters());
    printf("    Required parameters: %d\n", $rf->getNumberOfRequiredParameters());
    foreach ($rf->getParameters() as $param) {
        printf("      %s\n", $param);
    }
}
print "done!";
<?php

// We currently don't have any deprecated functions :/
$rc = new ReflectionFunction('var_dump');
var_dump($rc->isDeprecated());