Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function execute(File $file, $pointer)
 {
     $openCurlyBrackets = $file->findNext(T_OPEN_CURLY_BRACKET, $pointer);
     $closeParenthesis = $file->findNext(T_CLOSE_PARENTHESIS, $pointer);
     $file->fixer->beginChangeset();
     foreach ($file->findAllBetween([T_STRING, T_COLON], $closeParenthesis, $openCurlyBrackets) as $token) {
         $file->fixer->replaceToken($token, '');
     }
     $file->fixer->endChangeset();
     return $file->fixer->getContents();
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function execute(File $file, $pointer)
 {
     $openParenthesis = $file->findNext(T_OPEN_PARENTHESIS, $pointer);
     $closeParenthesis = $file->findNext(T_CLOSE_PARENTHESIS, $pointer);
     $variables = $file->findAllBetween(T_VARIABLE, $openParenthesis, $closeParenthesis);
     $file->fixer->beginChangeset();
     foreach ($variables as $variable) {
         $typeHint = $file->findPrevious(T_STRING, $variable, $openParenthesis);
         if (!$typeHint) {
             continue;
         }
         $file->fixer->replaceToken($typeHint, '');
         $file->fixer->replaceToken($typeHint + 1, '');
     }
     $file->fixer->endChangeset();
     return $file->fixer->getContents();
 }