forked from hhvm/hhast
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypedMigrationStep.hack
More file actions
39 lines (33 loc) · 951 Bytes
/
Copy pathTypedMigrationStep.hack
File metadata and controls
39 lines (33 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
namespace Facebook\HHAST;
use type Facebook\HHAST\Node;
use type Facebook\HHAST\_Private\SoftDeprecated;
/* HHAST_IGNORE_ALL[5639] */
final class TypedMigrationStep<Tin as Node, Tout as Node>
implements IMigrationStep {
<<SoftDeprecated(NodeTypeMigrationStep::class)>>
public function __construct(
private string $name,
private classname<Tin> $tin,
classname<Tout> $_tout,
private (function(Tin): Tout) $rewriter,
) {
}
public function getName(): string {
return $this->name;
}
public function rewrite(Node $node): Node {
if (!\is_a($node, $this->tin)) {
return $node;
}
$rewriter = $this->rewriter;
return $rewriter(/* HH_FIXME[4110] need reified generics */ $node);
}
}