Documentation
    Preparing search index...
    • Inspects arguments for one or more method calls. If you want to scope the search within a specific context, then make sure to first narrow down the AST and pass a specific SgNode.

      For example: In case of validators, we will first find the Controller method for which we want the validation method calls.

      This function searches for call expressions that match the provided method names and returns their argument nodes for further analysis.

      Parameters

      • node: SgNode

        The AST node to search within for method calls

      • methodCalls: string[]

        Array of method call names to search for (supports dot notation)

      Returns SgNode<TypesMap, Kinds<TypesMap>>[]

      Array of SgNodes representing the arguments of matching method calls

      const controllerMethod = classNode.find({ rule: { kind: 'method_definition' } })
      const validatorArgs = inspectMethodArguments(controllerMethod, ['validate', 'request.validate'])
      validatorArgs.forEach(arg => console.log('Validator argument:', arg.text()))