mirror of
https://github.com/danog/ext-php-rs.git
synced 2024-11-30 04:39:04 +01:00
Specify classes as fully-qualified names in stubs (#156)
* Specify classes as fully-qualified names in stubs When stubs are generated, the type annotations don't use a loading `\`, which means they are interpreted as relative to the current namespace. That's wrong, as all types are relative to the root namespace. * rustfmt
This commit is contained in:
parent
73902ef017
commit
90cbbc0fca
@ -153,6 +153,7 @@ impl ToStub for Parameter {
|
||||
|
||||
impl ToStub for DataType {
|
||||
fn fmt_stub(&self, buf: &mut String) -> FmtResult {
|
||||
let mut fqdn = "\\".to_owned();
|
||||
write!(
|
||||
buf,
|
||||
"{}",
|
||||
@ -162,7 +163,10 @@ impl ToStub for DataType {
|
||||
DataType::Double => "float",
|
||||
DataType::String => "string",
|
||||
DataType::Array => "array",
|
||||
DataType::Object(Some(ty)) => ty,
|
||||
DataType::Object(Some(ty)) => {
|
||||
fqdn.push_str(ty);
|
||||
fqdn.as_str()
|
||||
}
|
||||
DataType::Object(None) => "object",
|
||||
DataType::Resource => "resource",
|
||||
DataType::Reference => "reference",
|
||||
|
Loading…
Reference in New Issue
Block a user