PHP Classes

File: UPGRADE-3.0.md

Recommend this page to a friend!
  Classes of WsdlToPhp  >  PHP Code Generator  >  UPGRADE-3.0.md  >  Download  
File: UPGRADE-3.0.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: PHP Code Generator
Generate PHP code elements programatically
Author: By
Last change:
Date: 1 year ago
Size: 2,114 bytes
 

Contents

Class file image Download

UPGRADE FROM 2.to 3.

The main change, apart from requiring PHP >= 7.4, is that PhpFunction and PhpMethod now accepts a $returnType parameter which impacts four locations: - 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 - 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 - 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 - 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

Previously:

$phpFunction = new PhpFunction('name', ['firstParameter', 'secondParameter']);

$phpMethod = new PhpMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC);

$phpClass = (new PhpClass('MyClass'))
    ->addMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC);

$phpInterface = (new PhpInterface('MyInterface'))
    ->addMethod('name', ['firstParameter', 'secondParameter'], PhpMethod::ACCESS_PUBLIC);

Now:

$phpFunction = new PhpFunction('name', ['firstParameter', 'secondParameter'] /, 'int' or '?int' or '?App\\Entity\\MyEntity'/);

$phpMethod = new PhpMethod('name', ['firstParameter', 'secondParameter'], null /, 'int' or '?int' or '?App\\Entity\\MyEntity'/, PhpMethod::ACCESS_PUBLIC);

$phpClass = (new PhpClass('MyClass'))
    ->addMethod('name', ['firstParameter', 'secondParameter'], null /, 'int' or '?int' or '?App\\Entity\\MyEntity'/, PhpMethod::ACCESS_PUBLIC);

$phpInterface = (new PhpInterface('MyInterface'))
    ->addMethod('name', ['firstParameter', 'secondParameter'], null /, 'int' or '?int' or '?App\\Entity\\MyEntity'/, PhpMethod::ACCESS_PUBLIC);
For more information send a message to info at phpclasses dot org.