PHP function

Please use this forum to signal bugs.
Merci d'utiliser ce forum pour signaler des bugs.

PHP function

Postby parodid » Tue 13 Oct 2015 10:09

Dear Mr. Pagès

I think there is a bug in PHP code generation for function parameters.
When I declare a parameter inout in C++, BoUML automatically add & (passing by reference) operator.
When I do the same thing in PHP the parameter continue to be passed by value.

Best regards.

D.Parodi
Davide Parodi
SW Methodologies & Tools
Research & Technology
Centro Ricerche Fiat S.C.p.A.
parodid
 
Posts: 16
Joined: Mon 11 Mar 2013 13:44
Location: Orbassano, Turin, Piedmont, Italy

Re: PHP function

Postby Bruno Pagès » Tue 13 Oct 2015 11:59

Dear Mr. Parodi

You are right, to add the '&' when a parameter is out or inout seems a good idea

Note I plan to manage soon new features of PHP 7 : the optional return type on functions, and the new use form with '{' '}'

PHP 5 added the optional type for the parameters, but currently I do not put the ${t<i>} by default. How to introduce the type for parameters and return type of PHP 7, to force them in any case or to add a flag through the generation setting to do or not (may be through the choose of the php version old/5/7) ?

P.S. The missing '&' is not a 'bug', it is just I never think about that ;)
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 452
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: PHP function

Postby parodid » Wed 14 Oct 2015 12:07

Dear Mr. Pagès,

Currently I don't even think to use PHP 7 because I'm bonded to the versions of LAMP or WAMP my company provides.
Nevertheless, in my opionion it would be a great idea to customize code generation configuration according to the target language revision number.
Another possibility could be flagging project enitities as exportable or not in code generation on that parameter base.
I'm aware this could mean a huge work but having both features would be the best, and not only for PHP language, of course.

Best regards.
Davide Parodi
SW Methodologies & Tools
Research & Technology
Centro Ricerche Fiat S.C.p.A.
parodid
 
Posts: 16
Joined: Mon 11 Mar 2013 13:44
Location: Orbassano, Turin, Piedmont, Italy

Re: PHP function

Postby Bruno Pagès » Sun 18 Oct 2015 19:02

The release 6.9 is available, implementing your request, please refer to http://www.bouml.fr/historic.html
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 452
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: PHP function

Postby parodid » Tue 27 Oct 2015 07:39

Dear Mr. Pagès

I think I've found another issue in PHP parameter code generation.
If I declare a parameter, let's say a variable named "extra" having an empty string as default value, i.e., bouml generates:

public static function func( ...., $extra = '' = '')
{
${body}}

In other words the default value is repeated 2 times.
Luckily, clicking "Default definition" button, the error disappears.

Best regards
Davide Parodi
SW Methodologies & Tools
Research & Technology
Centro Ricerche Fiat S.C.p.A.
parodid
 
Posts: 16
Joined: Mon 11 Mar 2013 13:44
Location: Orbassano, Turin, Piedmont, Italy

Re: PHP function

Postby Bruno Pagès » Tue 27 Oct 2015 16:58

The only way to have that result is to set the default value both in the UML tab and at the Php definition level ( .... ${(}${t0} ${p0}${v0} = ''${)} ... ) and doing that is wrong because the default value is generated first by ${v0} then by the =''

The right way is to put '' as the value in the Uml Tab (the = is automatically added), when you use the button "default definition" the extra ='' is removed from the definition
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 452
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: PHP function

Postby parodid » Wed 28 Oct 2015 08:24

Dear Mr. Pagès,

Sorry but I can't understand your answer.
I'm pretty sure that it cannot be my error and as a matter of fact I attach a test project created with BoUML 6.9 leaving all generation settings to their default values.
Please consider generated code in Php tab of the Operation dialog for function Test::test.

Best regards
Attachments
Test.zip
Test project
(6.51 KiB) Downloaded 416 times
Davide Parodi
SW Methodologies & Tools
Research & Technology
Centro Ricerche Fiat S.C.p.A.
parodid
 
Posts: 16
Joined: Mon 11 Mar 2013 13:44
Location: Orbassano, Turin, Piedmont, Italy

Re: PHP function

Postby Bruno Pagès » Wed 28 Oct 2015 11:43

Dear Mr. Parodi

Oh yes, when you enter the name of a new parameter its definition contains two times ${v<i>}, and the duplication is removed when settings the type or using the button default definition

I will fix that, thank you for the report
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 452
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: PHP function

Postby Bruno Pagès » Wed 28 Oct 2015 17:30

Please find in advance Bouml_6.9.1_setup.exe before I deliver the other packages soon
ImageAuthor of Bouml
Bruno Pagès
 
Posts: 452
Joined: Mon 20 Feb 2012 08:23
Location: France

Re: PHP function

Postby parodid » Thu 29 Oct 2015 11:01

All behaves as expected, now.
Many thanks.
Davide Parodi
SW Methodologies & Tools
Research & Technology
Centro Ricerche Fiat S.C.p.A.
parodid
 
Posts: 16
Joined: Mon 11 Mar 2013 13:44
Location: Orbassano, Turin, Piedmont, Italy

Next

Return to Bug reports / Rapports de bugs

Who is online

Users browsing this forum: No registered users and 1 guest