I've had an extension that for awhile has a method where I've had the following code:
object.method<&ClassName::toImage>("toImage", Php::Public, {
Php::ByVal("format", Php::Type::Const), //<-- This is the problem - and likely my fault.
Php::ByVal("output", Php::Type::String),
Php::ByVal("dpi", Php::Type::Numeric, false)
});
This compiles fine because the callable.h fill() has a default block when figuring out what the type of an argument should be. Allowing ::Const as a type here is likely incorrect (though with 8.3 you can type hint an constant Enum) - though I don't think php-cpp supports that type yet.
I'm not sure what the correct solution should be. I'm wondering if I'm correct in thinking that my original code was always wrong. If so, can we protect others from making this error? put a Const case in the fill method that throws an exception or something like that? I can submit a PR but just wanted to fully understand the issue.
Hello,
I've had an extension that for awhile has a method where I've had the following code:
This compiles fine because the
callable.h fill()
has a default block when figuring out what the type of an argument should be. Allowing::Const
as a type here is likely incorrect (though with 8.3 you can type hint an constant Enum) - though I don't think php-cpp supports that type yet.I'm not sure what the correct solution should be. I'm wondering if I'm correct in thinking that my original code was always wrong. If so, can we protect others from making this error? put a Const case in the fill method that throws an exception or something like that? I can submit a PR but just wanted to fully understand the issue.
This is the ticket I mentioned I'd file in https://github.com/CopernicaMarketingSoftware/PHP-CPP/pull/530