private function detectAndHandlePhp4Ctor(Node\Stmt\Class_ $cls) { if ($this->mode & self::MODE_DEPRECATION && !$cls->isAnonymous()) { $name = isset($cls->namespacedName) ? $cls->namespacedName->toString() : $cls->name; $possibleCtorInfo = null; /** @var Node\Stmt\ClassMethod $method */ foreach ($cls->getMethods() as $method) { if (strcasecmp($method->name, '__construct') === 0) { return; // This will always be treated as ctor. Drop everything else } elseif (strcasecmp($method->name, ltrim($name, '\\')) === 0) { $possibleCtorInfo = [Reason::PHP4_CONSTRUCTOR, $method->getLine(), null, ['name' => $method->name]]; } } if ($possibleCtorInfo !== null) { call_user_func_array([$this->getResult(), 'addLimit'], $possibleCtorInfo); } } }