Re: Re: [PEPr] Comment on Web Services::Services_Memotoo
| From: | Philippe Jausions | Date: | Wed, 23 Apr 2008 00:22:43 +0000 |
| Subject: | Re: Re: [PEPr] Comment on Web Services::Services_Memotoo | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49861@lists.php.net to get a copy of this message | ||
Greg Sherwood wrote:
> Philippe Jausions wrote:
>> Pequet Thomas wrote:
>>
>>> Pequet Thomas (http://pear.php.net/user/memotoo) has commented on the
>>> proposal for Web Services::Services_Memotoo.
>>>
>>> Comment:
>>>
>>> Thanks for your comments :-)
>>>
>>> Ok I have modify as you say:
>>> - add better documentation for the method
>>> - correct error with phpcs (I have just a warning with php version ?)
>>>
>>
>> Things like missing {} blocks for if's, missing spaces around =, <,
>> etc... need to be corrected. Odd, phpcs might be crashing, I'm not
>> getting the error list either.
> It isn't crashing, there is just no check for control structures without
> braces.
>
> The PEAR standard does say: "You are strongly encouraged to always use
> curly braces even in situations where they are technically optional.
> Having them increases readability and decreases the likelihood of logic
> errors being introduced when new lines are added."
>
> I didn't include that specific check at the time I converted over the
> PEAR standard, but I think phpcs should probably throw a warning about
> it (not an error) because it is worded in the same way as the line
> length standard and phpcs already throws a warning about long lines.
>
> Greg
>
I guess then. I'm used to always put {} around control blocks and also
assumed (apparently wrongly) that was part of the PEAR CS.
So I'm surprised to see that:
<?php
$j=0;
for ($i=1;$i<10;++$i)
if ($j==$i)
++$j;
?>
is actually valid code CS-wise (with just a warning for $j=0). To be
valid, I'd always thought, the code above should have been written:
<?php
$j = 0;
for ($i = 1; $i < 10; ++$i) {
if ($j == $i) {
++$j;
}
}
?>
Pretty strange...
-Philippe