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

[stubs] missing type declarations for properties #184

Open
ju1ius opened this issue Nov 15, 2022 · 0 comments
Open

[stubs] missing type declarations for properties #184

ju1ius opened this issue Nov 15, 2022 · 0 comments

Comments

@ju1ius
Copy link
Contributor

ju1ius commented Nov 15, 2022

Component Version
ext_php_rs git:master
cargo-php v0.1.7

Extension code:

#[php_class]
pub struct Example {
  #[prop] pub foo: String,
  #[prop] pub bar: Option<String>,
}

#[php_impl]
impl Example {
  #[getter]
  pub fn get_baz(&self) -> Vec<bool> {
    vec![true, false]
  }
}

#[php_startup]
pub fn startup_function() {}

#[php_module]
pub fn get_module(module: ModuleBuilder) -> ModuleBuilder {
    module
}

Expected stubs:

<?php

class Example {
  public string $foo;
  public string|null $bar;
  /**
   * @var array<bool>
   */
  public readonly array $baz;
}

Actual stubs:

<?php
class Example {
  public $foo;
  public $bar;
  public $baz;
  public function getBaz(): array {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant