timestamp', [new CodeSample(<<<'CODE_SAMPLE' class SomeClass { public function run() { $time = time(); } } CODE_SAMPLE , <<<'CODE_SAMPLE' class SomeClass { public function run() { $time = \Carbon\Carbon::now()->timestamp; } } CODE_SAMPLE )]); } /** * @return array> */ public function getNodeTypes() : array { return [FuncCall::class]; } /** * @param FuncCall $node */ public function refactor(Node $node) : ?Node { if (!$this->isName($node->name, 'time')) { return null; } $firstClassCallable = $node->isFirstClassCallable(); if (!$firstClassCallable && \count($node->getArgs()) !== 0) { return null; } // create now and format() $nowStaticCall = new StaticCall(new FullyQualified('Carbon\\Carbon'), 'now'); $propertyFetch = new PropertyFetch($nowStaticCall, 'timestamp'); if ($firstClassCallable) { return new ArrowFunction(['static' => \true, 'expr' => $propertyFetch]); } return $propertyFetch; } }