HaxeFoundation / HaxeFoundation/haxe

[PHP] Redefinition of variable code in subclass is not allowed. Previously declared at haxe._Exception.NativeException

Open
#12,084 5 comments 0 reactions 0 assignees View on GitHub
platform-php
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Hej,

I want to use a custom exception with a `code` param, but it seems it's yet used in PHP target `haxe._Exception.NativeException` even if `haxe.Exception` haven't it in its extern declaration...
So this piece of code compile well on all targets excepts on PHP :
```haxe
@:native( "MyError" )
class Error extends haxe.Exception{
public var code : Null;
public function new( ?code : Null, ?message : String ){
super( message );
this.code = code;
}
}

class Main {
public static function main() {
throw new Error( "Fatal" );
}
}
```

Thanks for reading me

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.