> */ public function getNodeTypes() : array { return [FuncCall::class]; } /** * @param FuncCall $node */ public function refactor(Node $node) : ?Node { if (!$this->isName($node, 'dirname')) { return null; } if ($node->isFirstClassCallable()) { return null; } if (\count($node->args) !== 1) { return null; } if (!isset($node->getArgs()[0])) { return null; } $firstArg = $node->getArgs()[0]; if (!$firstArg->value instanceof File) { return null; } return new Dir(); } public function provideMinPhpVersion() : int { return PhpVersionFeature::DIR_CONSTANT; } }