Skip to content
This repository was archived by the owner on Apr 5, 2020. It is now read-only.

Commit 62fe9ea

Browse files
committed
Fix HHVM
WTF?!
1 parent fbc977d commit 62fe9ea

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/main/php/webservices/rest/RestMarshalling.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php namespace webservices\rest;
22

3+
use lang\ClassLoader;
34
use lang\Enum;
4-
use lang\XPClass;
5-
use lang\Type;
65
use lang\Primitive;
6+
use lang\Type;
7+
use lang\XPClass;
78
use lang\reflect\Modifiers;
8-
use lang\ClassLoader;
99

1010
/**
1111
* Marshalling takes care of converting the value to a simple output

src/test/php/webservices/rest/unittest/RestMarshallingTest.class.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?php namespace webservices\rest\unittest;
22

3-
use webservices\rest\TypeMarshaller;
4-
use lang\Type;
5-
use lang\Primitive;
63
use lang\ArrayType;
4+
use lang\ClassLoader;
75
use lang\MapType;
6+
use lang\Primitive;
7+
use lang\Type;
88
use lang\XPClass;
9-
use lang\ClassLoader;
9+
use util\Currency;
1010
use util\Date;
11-
use util\TimeZone;
1211
use util\Money;
13-
use util\Currency;
12+
use util\TimeZone;
1413
use webservices\rest\RestMarshalling;
14+
use webservices\rest\TypeMarshaller;
1515
use webservices\rest\unittest\srv\fixture\Wallet;
1616

1717
/**
@@ -51,28 +51,28 @@ static function __static() {
5151
#[@beforeClass]
5252
public static function defineWalletClassMarshaller() {
5353
self::$walletClass= new XPClass(Wallet::class);
54-
self::$walletMarshaller= newinstance(TypeMarshaller::class, [], [
55-
'marshal' => function($wallet, $marshalling= null) {
54+
self::$walletMarshaller= newinstance(TypeMarshaller::class, [], '{
55+
public function marshal($wallet, $marshalling= null) {
5656
return $marshalling->marshal($wallet->values);
57-
},
58-
'unmarshal' => function(\lang\Type $t, $input, $marshalling= null) {
59-
return $t->newInstance($marshalling->unmarshal(new \lang\ArrayType('util.Money'), $input));
6057
}
61-
]);
58+
public function unmarshal(\lang\Type $t, $input, $marshalling= null) {
59+
return $t->newInstance($marshalling->unmarshal(new \lang\ArrayType("util.Money"), $input));
60+
}
61+
}');
6262
}
6363

6464
#[@beforeClass]
6565
public static function defineMoneyMarshaller() {
66-
self::$moneyMarshaller= newinstance(TypeMarshaller::class, [], [
67-
'marshal' => function($money, $marshalling= null) {
66+
self::$moneyMarshaller= newinstance(TypeMarshaller::class, [], '{
67+
public function marshal($money, $marshalling= null) {
6868
$amount= $money->amount();
69-
return sprintf('%.2f %s', is_object($amount) ? $amount->doubleValue() : $amount, $money->currency()->name());
70-
},
71-
'unmarshal' => function(\lang\Type $t, $input, $marshalling= null) {
72-
sscanf($input, '%f %s', $amount, $currency);
69+
return sprintf("%.2f %s", is_object($amount) ? $amount->doubleValue() : $amount, $money->currency()->name());
70+
}
71+
public function unmarshal(\lang\Type $t, $input, $marshalling= null) {
72+
sscanf($input, "%f %s", $amount, $currency);
7373
return $t->newInstance($amount, \util\Currency::getInstance($currency));
7474
}
75-
]);
75+
}');
7676
}
7777

7878
#[@test]

0 commit comments

Comments
 (0)