ext-php-rs
ext-php-rs copied to clipboard
[stubs] class constants values are always null
Component | Version |
---|---|
ext_php_rs | git:master |
cargo-php | v0.1.7 |
Extension code
#[php_class]
pub struct Foo;
#[php_impl]
impl Foo {
const BAR: &'static str = "baz";
const BAZ: i32 = 42;
}
Expected stubs:
<?php
class Foo {
public const BAR = "baz";
public const BAZ = 42;
}
Actual stubs:
<?php
class Foo {
const BAR = null;
const BAZ = null;
}
IMO not exposing the actual value is not that much of an issue. Exposing a public constant in an api is meant to provide an abstraction over a value that may change between releases.
The issue is more about not exposing the actual type.
So it wouldn't matter if i.e. const FOO: u8 = 42
became const FOO = 0
.