/** * Find ConstructorMethod Or Create it * * @param ClassFileDefinition $file * @return MethodDefinition|null */ protected function getConstructor(ClassFileDefinition $file) { $construct = $file->getMethod('__construct'); if (null === $construct) { $construct = new MethodDefinition(new PhpVariableName('__construct')); $file->addMethod($construct); } return $construct; }