Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 3d6db89

Browse files
lexidorAtry
authored andcommitted
Require hhvm 4.128 and support autoloading with ext_watchman
The hsl is always built-in. ext_watchman and HH\Facts are always available. varray eq vec and darray eq dict is always true. All legacy arrays have been replaced with Hack arrays.
1 parent 50901a2 commit 3d6db89

12 files changed

+50
-48
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ tests/ export-ignore
22
examples/ export-ignore
33
data/ export-ignore
44
.hhconfig export-ignore
5+
.hhvmconfig.hdf export-ignore

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
os: [ ubuntu ]
1515
hhvm:
16-
- '4.102'
16+
- '4.128'
1717
- latest
1818
- nightly
1919
runs-on: ${{matrix.os}}-latest

.hhvmconfig.hdf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Autoload {
2+
Query = {"expression": ["allof", ["type", "f"], ["suffix", ["anyof", "hack", "php"]], ["not",["anyof",["dirname",".var"],["dirname",".git"]]]]}
3+
}

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"keywords": ["hack", "router", "routing", "hhvm"],
66
"homepage": "https://github.com/hhvm/hack-router",
77
"require": {
8-
"hhvm": "^4.102",
9-
"hhvm/hsl": "^4.0",
8+
"hhvm": "^4.128",
109
"facebook/hack-http-request-response-interfaces": "^0.2|^0.3"
1110
},
1211
"extra": {

hh_autoload.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"devRoots": [
66
"tests/"
77
],
8-
"devFailureHandler": "Facebook\\AutoloadMap\\HHClientFallbackHandler"
8+
"devFailureHandler": "Facebook\\AutoloadMap\\HHClientFallbackHandler",
9+
"useFactsIfAvailable": true
910
}

src/router/PrefixMatchingResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function resolveWithMap(
6262
$regexps = $map->getRegexps();
6363
foreach ($regexps as $regexp => $_sub_map) {
6464
$pattern = '#^'.$regexp.'#';
65-
$matches = varray[];
65+
$matches = dict[];
6666

6767
if (\preg_match_with_matches($pattern, $path, inout $matches) !== 1) {
6868
continue;

src/router/SimpleRegexpResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function resolve(
3333
}
3434
$map = $this->map[$method];
3535
foreach ($map as $regexp => $responder) {
36-
$matches = varray[];
36+
$matches = dict[];
3737
if (\preg_match_with_matches($regexp, $path, inout $matches) !== 1) {
3838
continue;
3939
}

src/router/UnknownRouterException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
namespace Facebook\HackRouter;
1212

1313
class UnknownRouterException extends InternalServerErrorException {
14-
public function __construct(private varray<mixed> $fastRouteData) {
14+
public function __construct(private vec<mixed> $fastRouteData) {
1515
parent::__construct(
1616
'Unknown FastRoute response: '.\var_export($fastRouteData, true),
1717
);
1818
}
1919

20-
public function getFastRouteData(): varray<mixed> {
20+
public function getFastRouteData(): vec<mixed> {
2121
return $this->fastRouteData;
2222
}
2323
}

tests/ParserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use type Facebook\HackTest\DataProvider;
1515

1616
final class ParserTest extends \Facebook\HackTest\HackTest {
17-
public function getExamplePatterns(): varray<(string, string)> {
18-
return varray[
17+
public function getExamplePatterns(): vec<(string, string)> {
18+
return vec[
1919
tuple('/foo', "['/foo']"),
2020
tuple('/foo/{bar}', "['/foo/', {bar}]"),
2121
tuple('/foo/[{bar}]', "['/foo/', ?[{bar}]]"),

tests/RequestParametersTest.php

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,37 @@
1515

1616
final class RequestParametersTest extends \Facebook\HackTest\HackTest {
1717
public function testStringParam(): void {
18-
$parts = varray[new StringRequestParameter(
18+
$parts = vec[new StringRequestParameter(
1919
StringRequestParameterSlashes::WITHOUT_SLASHES,
2020
'foo',
2121
)];
2222
$data = dict['foo' => 'bar'];
23-
expect((new RequestParameters($parts, varray[], $data))->getString('foo'))
23+
expect((new RequestParameters($parts, vec[], $data))->getString('foo'))
2424
->toBeSame('bar');
2525
}
2626

2727
public function testIntParam(): void {
28-
$parts = varray[new IntRequestParameter('foo')];
28+
$parts = vec[new IntRequestParameter('foo')];
2929
$data = dict['foo' => '123'];
30-
expect((new RequestParameters($parts, varray[], $data))->getInt('foo'))->toBeSame(
31-
123,
32-
);
30+
expect((new RequestParameters($parts, vec[], $data))->getInt('foo'))
31+
->toBeSame(123);
3332
}
3433

3534
public function testFetchingStringAsInt(): void {
3635
expect(() ==> {
37-
$parts = varray[new StringRequestParameter(
36+
$parts = vec[new StringRequestParameter(
3837
StringRequestParameterSlashes::WITHOUT_SLASHES,
3938
'foo',
4039
)];
4140
$data = dict['foo' => 'bar'];
42-
(new RequestParameters($parts, varray[], $data))->getInt('foo');
41+
(new RequestParameters($parts, vec[], $data))->getInt('foo');
4342
})->toThrow(InvariantException::class);
4443
}
4544

4645
public function testEnumParam(): void {
47-
$parts = varray[new EnumRequestParameter(TestIntEnum::class, 'foo')];
46+
$parts = vec[new EnumRequestParameter(TestIntEnum::class, 'foo')];
4847
$data = dict['foo' => (string)TestIntEnum::BAR];
49-
$value = (new RequestParameters($parts, varray[], $data))->getEnum(
48+
$value = (new RequestParameters($parts, vec[], $data))->getEnum(
5049
TestIntEnum::class,
5150
'foo',
5251
);
@@ -85,7 +84,7 @@ public function testFromPattern(): void {
8584
'bar' => '123',
8685
'baz' => (string)TestIntEnum::FOO,
8786
];
88-
$params = new RequestParameters($parts, varray[], $data);
87+
$params = new RequestParameters($parts, vec[], $data);
8988
expect($params->getString('foo'))->toBeSame('some string');
9089
expect($params->getInt('bar'))->toBeSame(123);
9190
expect($params->getEnum(TestIntEnum::class, 'baz'))->toBeSame(
@@ -95,8 +94,8 @@ public function testFromPattern(): void {
9594

9695
public function testGetOptional(): void {
9796
$params = new RequestParameters(
98-
varray[],
99-
varray[new StringRequestParameter(
97+
vec[],
98+
vec[new StringRequestParameter(
10099
StringRequestParameterSlashes::WITHOUT_SLASHES,
101100
'foo',
102101
)],
@@ -107,8 +106,8 @@ public function testGetOptional(): void {
107106

108107
public function testGetMissingOptional(): void {
109108
$params = new RequestParameters(
110-
varray[],
111-
varray[new StringRequestParameter(
109+
vec[],
110+
vec[new StringRequestParameter(
112111
StringRequestParameterSlashes::WITHOUT_SLASHES,
113112
'foo',
114113
)],
@@ -120,8 +119,8 @@ public function testGetMissingOptional(): void {
120119
public function testGetOptionalAsRequired(): void {
121120
expect(() ==> {
122121
$params = new RequestParameters(
123-
varray[],
124-
varray[new StringRequestParameter(
122+
vec[],
123+
vec[new StringRequestParameter(
125124
StringRequestParameterSlashes::WITHOUT_SLASHES,
126125
'foo',
127126
)],
@@ -134,11 +133,11 @@ public function testGetOptionalAsRequired(): void {
134133
public function testGetRequiredAsOptional(): void {
135134
expect(() ==> {
136135
$params = new RequestParameters(
137-
varray[new StringRequestParameter(
136+
vec[new StringRequestParameter(
138137
StringRequestParameterSlashes::WITHOUT_SLASHES,
139138
'foo',
140139
)],
141-
varray[],
140+
vec[],
142141
dict['foo' => 'bar'],
143142
);
144143
$params->getOptionalString('foo');

0 commit comments

Comments
 (0)