Migrating to v0.16
Void Return Type for Functions Without Explicit Return
Functions and methods without an explicit Rust return type now declare void as their PHP return type.
Before (v0.15)
#[php_function]
pub fn do_something() {
println!("Hello");
}
Generated PHP signature: function do_something() (implicit mixed return)
After (v0.16)
The same Rust code now generates: function do_something(): void
Migration
If your function actually returns a value but didn’t declare it, you must now add the return type:
// Before: worked but was incorrect
#[php_function]
pub fn get_value() {
42 // implicitly returned, but no declared type
}
// After: must declare return type
#[php_function]
pub fn get_value() -> i32 {
42
}
Exceptions
The magic methods __destruct and __clone are excluded from this change, as PHP forbids return type declarations on them.