add() public méthode

public add ( string $class, string $method, string $argument, string $typehint )
$class string
$method string
$argument string
$typehint string
 /**
  * @param array $tokens
  * @param integer $index
  * @param array $token
  */
 private function extractTypehints(&$tokens, $index, $token)
 {
     $typehint = '';
     for ($i = $index - 1; in_array($tokens[$i][0], $this->typehintTokens); $i--) {
         $typehint = $tokens[$i][1] . $typehint;
         unset($tokens[$i]);
     }
     if ($typehint = trim($typehint)) {
         $class = $this->namespaceResolver->resolve($this->currentClass);
         try {
             $typehintFcqn = $this->namespaceResolver->resolve($typehint);
             $this->typeHintIndex->add($class, trim($this->currentFunction), $token[1], $typehintFcqn);
         } catch (DisallowedScalarTypehintException $e) {
             $this->typeHintIndex->addInvalid($class, trim($this->currentFunction), $token[1], $e);
         }
     }
 }
    function it_indexes_invalid_typehints(TypeHintIndex $typeHintIndex, NamespaceResolver $namespaceResolver)
    {
        $e = new DisallowedScalarTypehintException();
        $namespaceResolver->analyse(Argument::any())->shouldBeCalled();
        $namespaceResolver->resolve('Foo')->willReturn('Foo');
        $namespaceResolver->resolve('int')->willThrow($e);
        $this->rewrite('
        <?php

        class Foo
        {
            public function bar(int $bar)
            {
            }
        }

        ');
        $typeHintIndex->addInvalid('Foo', 'bar', '$bar', $e)->shouldHaveBeenCalled();
        $typeHintIndex->add('Foo', 'bar', '$bar', Argument::any())->shouldNotHaveBeenCalled();
    }