Skip to content

Commit

Permalink
[php] added "object" to keywords list (fixes HaxeFoundation#6838)
Browse files Browse the repository at this point in the history
  • Loading branch information
RealyUniqueName committed Feb 4, 2018
1 parent 69a1b51 commit 0255ade
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions extra/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
php : added `php.Syntax.code()` instead of deprecated `untyped __php__()` (#6708)
php : added methods to `php.Syntax` for each php operator: `??`, `?:`, `**` etc. (#6708)
php : fixed multiple file uploads in php.Web.parseMultiPart() (#4173)
php : fixed an issue with "Object" used as a class name for PHP 7.2 (it's a new keyword in php) (#6838)
python : add ssl support for http requests
python : improve Sys.print(ln) code generation (#6184)
js : generate faster code for `x.iterator()` calls (#6669)
Expand Down
2 changes: 1 addition & 1 deletion src/generators/genphp7.ml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ let is_keyword str =
| "print" | "private" | "protected" | "public" | "require" | "require_once" | "return" | "static" | "switch"
| "throw" | "trait" | "try" | "unset" | "use" | "var" | "while" | "xor" | "yield" | "__class__" | "__dir__"
| "__file__" | "__function__" | "__line__" | "__method__" | "__trait__" | "__namespace__" | "int" | "float"
| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable"
| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable" | "object"
-> true
| _ -> false

Expand Down
2 changes: 1 addition & 1 deletion std/php/Boot.hx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class Boot {
| "print" | "private" | "protected" | "public" | "require" | "require_once" | "return" | "static" | "switch"
| "throw" | "trait" | "try" | "unset" | "use" | "var" | "while" | "xor" | "yield" | "__class__" | "__dir__"
| "__file__" | "__function__" | "__line__" | "__method__" | "__trait__" | "__namespace__" | "int" | "float"
| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable":
| "bool" | "string" | "true" | "false" | "null" | "parent" | "void" | "iterable" | "object":
part += '_hx';
case _:
}
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/src/unit/issues/Issue6838.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package unit.issues;

class Issue6838 extends unit.Test {
function test() {
var o = new Object();
eq('unit.issues._Issue6838.Object', Type.getClassName(Type.getClass(o)));
}
}

private class Object {
public function new() {}
}

0 comments on commit 0255ade

Please sign in to comment.