|
| 1 | +# UPGRADE FROM 2.* to 3.* |
| 2 | + |
| 3 | +The main change, apart from requiring PHP >= 7.4, is that `PhpFunction` and `PhpMethod` now accepts a `$returnType` parameter which impacts four locations: |
| 4 | +- `WsdlToPhp\PhpGenerator\Element\PhpFunction::__construct` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the function return type |
| 5 | +- `WsdlToPhp\PhpGenerator\Element\PhpMethod::__construct` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type |
| 6 | +- `WsdlToPhp\PhpGenerator\Component\PhpClass::addMethod` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type |
| 7 | +- `WsdlToPhp\PhpGenerator\Component\PhpInterface::addMethod` has a new parameter after the `$parameters` parameter named `$returnType` which is a string allowing to set the method return type |
| 8 | + |
| 9 | +**Previously**: |
| 10 | +```php |
| 11 | +$phpFunction = new PhpFunction('name', ['firstParameter', 'secondParameter']); |
| 12 | + |
| 13 | +$phpMethod = new PhpMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC); |
| 14 | + |
| 15 | +$phpClass = (new PhpClass('MyClass')) |
| 16 | + ->addMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC); |
| 17 | + |
| 18 | +$phpInterface = (new PhpInterface('MyInterface')) |
| 19 | + ->addMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC); |
| 20 | +``` |
| 21 | + |
| 22 | +**Now**: |
| 23 | +```php |
| 24 | +$phpFunction = new PhpFunction('name', ['firstParameter', 'secondParameter'] /*, 'int' or '?int' or '?App\\Entity\\MyEntity'*/); |
| 25 | + |
| 26 | +$phpMethod = new PhpMethod('name', ['firstParameter', 'secondParameter'], null /*, 'int' or '?int' or '?App\\Entity\\MyEntity'*/, PhpMethod::ACCESS_PUBLIC); |
| 27 | + |
| 28 | +$phpClass = (new PhpClass('MyClass')) |
| 29 | + ->addMethod('name', ['firstParameter', 'secondParameter'], null /*, 'int' or '?int' or '?App\\Entity\\MyEntity'*/, PhpMethod::ACCESS_PUBLIC); |
| 30 | + |
| 31 | +$phpInterface = (new PhpInterface('MyInterface')) |
| 32 | + ->addMethod('name', ['firstParameter', 'secondParameter'], null /*, 'int' or '?int' or '?App\\Entity\\MyEntity'*/, PhpMethod::ACCESS_PUBLIC); |
| 33 | +``` |
0 commit comments