|
|
|
|
@ -19,7 +19,7 @@ trait MagicMethodDetector |
|
|
|
|
if (count($methodDef->functionDef->argInfoList) != 2) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must take exactly 2 arguments"); |
|
|
|
|
} |
|
|
|
|
if (!$methodDef->functionDef->argInfoList[0]->type or $methodDef->functionDef->argInfoList[0]->type != 'string') { |
|
|
|
|
if ($methodDef->functionDef->argInfoList[0]->type and $methodDef->functionDef->argInfoList[0]->type != self::TYPE_STR) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must take string as argument"); |
|
|
|
|
} |
|
|
|
|
} elseif ($name == '__get') { |
|
|
|
|
@ -27,33 +27,33 @@ trait MagicMethodDetector |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must take exactly 1 argument"); |
|
|
|
|
} |
|
|
|
|
} elseif ($name == '__toString') { |
|
|
|
|
if (!$methodDef->functionDef->returnType or $methodDef->functionDef->returnType != 'string') { |
|
|
|
|
if (!$methodDef->functionDef->returnType or $methodDef->functionDef->returnType != self::TYPE_STR) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must return string"); |
|
|
|
|
} |
|
|
|
|
} elseif ($name == '__serialize') { |
|
|
|
|
if (!$methodDef->functionDef->returnType or $methodDef->functionDef->returnType != 'array') { |
|
|
|
|
if (!$methodDef->functionDef->returnType or $methodDef->functionDef->returnType != self::TYPE_ARRAY) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must return array"); |
|
|
|
|
} |
|
|
|
|
} elseif ($name == '__unserialize') { |
|
|
|
|
if (count($methodDef->functionDef->argInfoList) != 1) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must take exactly 1 argument"); |
|
|
|
|
} elseif (!$methodDef->functionDef->argInfoList[0]->type or $methodDef->functionDef->argInfoList[0]->type != 'array') { |
|
|
|
|
} elseif (!$methodDef->functionDef->argInfoList[0]->type or $methodDef->functionDef->argInfoList[0]->type != self::TYPE_ARRAY) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must take array as argument"); |
|
|
|
|
} |
|
|
|
|
} elseif ($name == '__isset' or $name == '__unset' or $name == '__set_state') { |
|
|
|
|
if (count($methodDef->functionDef->argInfoList) != 1) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must take exactly 1 argument"); |
|
|
|
|
} |
|
|
|
|
if (!$methodDef->functionDef->argInfoList[0]->type or $methodDef->functionDef->argInfoList[0]->type != 'string') { |
|
|
|
|
if (!$methodDef->functionDef->argInfoList[0]->type or $methodDef->functionDef->argInfoList[0]->type != self::TYPE_STR) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must take string as argument"); |
|
|
|
|
} |
|
|
|
|
if ($name == '__set_state') { |
|
|
|
|
if (!$methodDef->functionDef->returnType or $methodDef->functionDef->returnType != 'array') { |
|
|
|
|
if (!$methodDef->functionDef->returnType or $methodDef->functionDef->returnType != self::TYPE_ARRAY) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must return array"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} elseif ($name == '__debugInfo') { |
|
|
|
|
if (!$methodDef->functionDef->returnType or $methodDef->functionDef->returnType != 'array') { |
|
|
|
|
if (!$methodDef->functionDef->returnType or $methodDef->functionDef->returnType != self::TYPE_ARRAY) { |
|
|
|
|
$this->fatalError($v, 'Method ' . $this->class . "::{$name}() must return array"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|