> */ public function getNodeTypes() : array { return [ArrayDimFetch::class]; } /** * @param ArrayDimFetch $node */ public function refactor(Node $node) : ?Node { if (!$this->isFollowedByCurlyBracket($this->file, $node)) { return null; } // re-draw the ArrayDimFetch to use [] bracket $node->setAttribute(AttributeKey::ORIGINAL_NODE, null); return $node; } private function isFollowedByCurlyBracket(File $file, ArrayDimFetch $arrayDimFetch) : bool { $oldTokens = $file->getOldTokens(); $endTokenPost = $arrayDimFetch->getEndTokenPos(); if (isset($oldTokens[$endTokenPost]) && $oldTokens[$endTokenPost] === '}') { $startTokenPost = $arrayDimFetch->getStartTokenPos(); return !(isset($oldTokens[$startTokenPost][1]) && $oldTokens[$startTokenPost][1] === '${'); } return \false; } }