Skip to content

Commit ab8d233

Browse files
committed
Support nightlies
1 parent 30147cd commit ab8d233

6 files changed

Lines changed: 35 additions & 26 deletions

File tree

composer.lock

Lines changed: 18 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/dorm/CodegenDorm.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private function getGetters(): Vector<CodegenMethod> {
131131
$return_type = $field->getType();
132132
$data = '$this->data[\''.$field->getDbColumn().'\']';
133133
if ($return_type === \DateTime::class) {
134-
$return_data = 'new DateTime($value)';
134+
$return_data = '(new DateTime())->setTimestamp($value)';
135135
} else {
136136
$return_data = '$value';
137137
}

examples/dorm/CodegenMutator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private function getSaveMethod(): CodegenMethod {
154154
->addLinef('$conn = new PDO(\'%s\');', $this->schema->getDsn())
155155
->addMultilineCall(
156156
'$quoted = $this->data->mapWithKey',
157-
Vector{'($k, $v) ==> $conn->quote($v, self::$pdoType[$k])'},
157+
Vector{'($k, $v) ==> $conn->quote((string) $v, self::$pdoType[$k])'},
158158
)
159159
->addAssignment(
160160
'$id',

examples/dorm/demo/DormUser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* To re-generate this file run codegen.php DormUserSchema
77
*
88
*
9-
* @partially-generated SignedSource<<09509aa1af895b3a95cd41b6c344247c>>
9+
* @partially-generated SignedSource<<9e4466dec9ad5e268b1df61c65b84fd3>>
1010
*/
1111
use namespace Facebook\TypeAssert;
1212

@@ -47,7 +47,7 @@ public function getLastName(): string {
4747

4848
public function getBirthday(): ?DateTime {
4949
$value = $this->data['birthday'] ?? null;
50-
return $value === null ? null : new DateTime($value);
50+
return $value === null ? null : (new DateTime())->setTimestamp($value);
5151
}
5252

5353
public function getCountryId(): ?int {

examples/dorm/demo/DormUserMutator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* To re-generate this file run codegen.php DormUserSchema
77
*
88
*
9-
* @partially-generated SignedSource<<9fb8e54530e36453a76d12bf05064db6>>
9+
* @partially-generated SignedSource<<3eab32bd5832befe294cd6d493ac3953>>
1010
*/
1111

1212
final class DormUserMutator {
@@ -35,7 +35,7 @@ public function update(int $id): this {
3535
public function save(): int {
3636
$conn = new PDO('sqlite:/path/to/database.db');
3737
$quoted = $this->data->mapWithKey(
38-
($k, $v) ==> $conn->quote($v, self::$pdoType[$k]),
38+
($k, $v) ==> $conn->quote((string) $v, self::$pdoType[$k]),
3939
);
4040
$id = $this->id;
4141
if ($id === null) {

tests/TestLib/ExpectObj.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,25 @@
1212

1313
final class ExpectObj<T> extends \Facebook\FBExpect\ExpectObj<T> {
1414

15-
public function __construct(private T $obj, private string $called_class = '') {
15+
public function __construct(
16+
private T $obj,
17+
private string $called_class = '',
18+
) {
1619
parent::__construct($obj);
1720
$this->called_class = $called_class;
1821
}
1922

20-
public function toBeUnchanged(?string $token = null, string $msg = '', ...): void {
21-
$msg = \vsprintf($msg, \array_slice(\func_get_args(), 2));
23+
public function toBeUnchanged(
24+
?string $token = null,
25+
string $msg = '',
26+
mixed ...$args
27+
): void {
28+
$msg = \vsprintf($msg, $args);
2229
$class_name = $this->called_class;
2330
$path = CodegenExpectedFile::getPath($class_name);
2431
$expected = CodegenExpectedFile::parseFile($path);
2532
$token = $token === null ? CodegenExpectedFile::findToken() : $token;
26-
$value = (string) $this->obj;
33+
$value = (string)$this->obj;
2734
if ($expected->contains($token) && $expected[$token] === $value) {
2835
return;
2936
}

0 commit comments

Comments
 (0)