Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.

Commit f753113

Browse files
committed
Update forward compatibility level, fix lint warnings
1 parent b897ada commit f753113

16 files changed

+47
-48
lines changed

.hhconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ enable_experimental_tc_features=shape_field_check,sealed_classes
1010
# - otherwise, we get a circular dependency
1111
# - we don't use anything other than executables from it
1212
ignored_paths = [ "vendor/.+/tests/.+", "vendor/hhvm/hhast/.+" ]
13-
forward_compatibility_level=20180704
13+
forward_compatibility_level=3.28

examples/dorm/CodegenDorm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private function getLoad(): CodegenMethod {
9191
$body = $this->codegen->codegenHackBuilder()
9292
->addLinef('$conn = new PDO(\'%s\');', $this->schema->getDsn())
9393
->add('$cursor = ')
94-
->addMultilineCall('$conn->query', Vector {"\"$sql\""}, true)
94+
->addMultilineCall('$conn->query', Vector {"\"".$sql."\""}, true)
9595
->addLine('$result = $cursor->fetch(PDO::FETCH_ASSOC);')
9696
->startIfBlock('!$result')
9797
->addReturnf('null')

examples/dorm/codegen.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh
1+
<?hh // strict
22
/*
33
* Copyright (c) 2015-present, Facebook, Inc.
44
* All rights reserved.
@@ -12,13 +12,13 @@
1212

1313
require_once(__DIR__.'/../../vendor/hh_autoload.php');
1414

15-
if ($argc == 1) {
15+
if ($argc === 1) {
1616
echo " Usage: ".$argv[0]." file_name.php\n\n";
1717
exit(1);
1818
}
1919
$fname = $argv[1];
2020
if (!file_exists($fname)) {
21-
echo " File doesn't exist: $fname\n\n";
21+
echo " File doesn't exist: ".$fname."\n\n";
2222
exit(1);
2323
}
2424

@@ -36,7 +36,7 @@
3636
if (!$instance instanceof DormSchema) {
3737
continue;
3838
}
39-
echo "Generating code for $class_name\n";
39+
echo "Generating code for ".$class_name."\n";
4040
(new CodegenDorm($instance))->generate();
4141
(new CodegenMutator($instance))->generate();
4242
}

examples/dorm/demo/demo_usage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh
1+
<?hh // strict
22
/*
33
* Copyright (c) 2015-present, Facebook, Inc.
44
* All rights reserved.
@@ -40,7 +40,7 @@
4040
->setIsActive(true)
4141
->save();
4242

43-
echo "Created user with id $id\n";
43+
echo "Created user with id ".$id."\n";
4444

4545
$user = DormUser::load($id);
4646
echo "Loaded: ".$user->getFirstName()." ".$user->getLastName()."\n";

src/CodegenClassBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ protected function buildGenericsDeclaration(): string {
269269
return '';
270270
}
271271

272-
if ($generics_count == 1) {
272+
if ($generics_count === 1) {
273273
return '<'.C\onlyx($this->genericsDecl).'>';
274274
}
275275

src/CodegenFactoryTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ final public function codegenGeneratedFromClass(
119119
string $class,
120120
): CodegenGeneratedFrom {
121121
return
122-
new CodegenGeneratedFrom($this->getConfig(), "Generated from $class");
122+
new CodegenGeneratedFrom($this->getConfig(), "Generated from ".$class);
123123
}
124124

125125
final public function codegenGeneratedFromMethod(
@@ -128,7 +128,7 @@ final public function codegenGeneratedFromMethod(
128128
): CodegenGeneratedFrom {
129129
return new CodegenGeneratedFrom(
130130
$this->getConfig(),
131-
"Generated from $class::$method()",
131+
"Generated from ".$class."::".$method."()",
132132
);
133133
}
134134

@@ -139,7 +139,7 @@ final public function codegenGeneratedFromMethodWithKey(
139139
): CodegenGeneratedFrom {
140140
return new CodegenGeneratedFrom(
141141
$this->getConfig(),
142-
"Generated from $class::$method()['$key']",
142+
"Generated from ".$class."::".$method."()['".$key."']",
143143
);
144144
}
145145

@@ -158,7 +158,7 @@ final public function codegenGeneratedFromScript(
158158
}
159159
return new CodegenGeneratedFrom(
160160
$this->getConfig(),
161-
"To re-generate this file run $script",
161+
"To re-generate this file run ".$script,
162162
);
163163
}
164164

src/CodegenFunctionBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ protected function getFunctionDeclarationBase(
168168

169169
$multi_line_builder = (new HackBuilder($this->config))
170170
->add($keywords)
171-
->addLine("$this->name(")
171+
->addLine($this->name."(")
172172
->indent()
173173
->addLines($parameter_lines)
174174
->unindent()

src/CodegenProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function appendToBuilder(HackBuilder $builder): HackBuilder {
101101
->addIf($this->isStatic, 'static ')
102102
->addIf($this->type !== null, $this->type.' ')
103103
->add('$'.$this->name)
104-
->addIf($this->value != self::UNSET_VALUE, ' = '.$this->value)
104+
->addIf($this->value !== self::UNSET_VALUE, ' = '.$this->value)
105105
->addLine(';');
106106
}
107107

src/HackBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function addMultilineCall(
7474
}
7575

7676
$this
77-
->addWithSuggestedLineBreaks("$func_call_line(")
77+
->addWithSuggestedLineBreaks($func_call_line."(")
7878
->newLine()
7979
->indent()
8080
->addLinesWithSuggestedLineBreaks(Vec\map($params, $line ==> $line.','))
@@ -577,7 +577,7 @@ private function addSimpleMultilineCall(
577577
Traversable<string> $params,
578578
): this {
579579
return $this
580-
->addLine("$name(")
580+
->addLine($name."(")
581581
->indent()
582582
->addLines(Vec\map($params, $line ==> $line.','))
583583
->unindent()

src/HackfmtFormatter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@
1010

1111
namespace Facebook\HackCodegen;
1212

13-
use namespace HH\Lib\Str;
1413

1514
final class HackfmtFormatter implements ICodegenFormatter {
1615
public function format(
1716
string $code,
18-
string $file_name,
17+
string $_file_name,
1918
): string {
2019
$output = array();
2120
$exit_code = null;

0 commit comments

Comments
 (0)