new object creation
Closed this issue · 2 comments
bin_factory = BinFactory(width, height, count, self._pack_algo, **kwargs)
converts to
$bin_factory = py2php_kwargs_function_call('new BinFactory', [$width,$height,$count,$this->_pack_algo], $kwargs);
but should be more like...
$bin_factory = new BinFactory( $width,$height,$count,$this->_pack_algo, $kwargs );
although there is a separate issue related to that **kwargs
param. I'm not 100% sure what python expects that to be. I'll make it a separate ticket :)
There's a fix for this in 327fca3. Well, the generated code remains the same but py2php_kwargs_function_call() is now able to detect the call to new and assemble the constructor's arguments accordingly from the named params. So the generated code executes correctly.
I added an example of this in tests/namedparameters.py
nice thanks. I've been fixing these things by hand now so I won't be re-running the script anymore cuz it would overwrite my manual changes. Just letting you know what I come across :)
I do think in most cases it'd be better to replace the code with the call as opposed to calling your method to figure it out on the fly