Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(php) - minor #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/phpTranspiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class PhpTranspiler extends BaseTranspiler {
}
}

// below is commented, due to : https://github.com/ccxt/ast-transpiler/pull/15
// below is commented, due to failing tests ( https://github.com/ccxt/ast-transpiler/pull/15
//
// If the identifier is a function parameter (callback), it should remain a variable with `$` prefix
// if (node.parent && (ts.isParameter(node.parent) || (ts.isCallExpression(node.parent) && ts.isIdentifier(node)))) {
Expand Down
12 changes: 7 additions & 5 deletions tests/phpTranspiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@ describe('php transpiling tests', () => {
" public static x: number = 10;\n" +
" public static y: string = \"test\";\n" +
" public static a1: string[] = [ 'a', 'b' ];\n" +
" public static a2: any = whatever;\n" +
" public static a3: any = {};\n" +
" public static a2: any = {};\n" +
" public static a3: any = whateverCamelConstant;\n" +
" public static a4: any = UppercaseConstant;\n" +
" mainFeature(message) {\n" +
" console.log(\"Hello! I'm inside main class:\" + message)\n" +
" }\n" +
Expand All @@ -312,8 +313,9 @@ describe('php transpiling tests', () => {
" public static $x = 10;\n" +
" public static $y = 'test';\n" +
" public static $a1 = ['a', 'b'];\n" +
" public static $a2 = whatever;\n" +
" public static $a3 = array();\n" +
" public static $a2 = array();\n" +
" public static $a3 = $whateverCamelConstant;\n" +
" public static $a4 = UppercaseConstant;\n" +
"\n" +
" public function mainFeature($message) {\n" +
" var_dump('Hello! I\\'m inside main class:' . $message);\n" +
Expand Down Expand Up @@ -842,7 +844,7 @@ describe('php transpiling tests', () => {
const output = transpiler.transpilePhp(ts).content;
expect(output).toBe(php);
});
test.only('transpile constants & imports', () => {
test('transpile constants & imports', () => {
ttodua marked this conversation as resolved.
Show resolved Hide resolved
const ts = "import { decimalToPrecision, ROUND, TRUNCATE, DECIMAL_PLACES, } from '../../somewhere.js';\n" +
"const exc = new xyz ();\n" +
"assert (exc.decimalToPrecision ('12.3456000', TRUNCATE, 100, DECIMAL_PLACES) === '12.3456');";
Expand Down
Loading