[TYPO3-core] superfluous curly brackets {}

Ingmar Schlecht ingmar at typo3.org
Mon Oct 15 07:47:38 CEST 2012


Am 13.10.12 12:07, schrieb Stefan Neufeind:
> On 10/13/2012 12:02 PM, François Suter wrote:
>> Hi,
>>
>>> Well, looking into the code it turned out this reads:
>>>
>>>     $this->{$offset}
>>
>> Ah, that's quite different ;-)
>>
>>> or so. So imho the brackets make sense there and I'd favour if we could
>>> add it for the CGL.
>>
>> I agree that it would improve readability. OTOH I don't much like such
>> constructs, as they make the code quite unreadable. I would rather we
>> used some accessor method.
>
> It's only used in some small functions like:
>
>    public function offsetExists($offset) {
>      $offsetExists = FALSE;
>      if (in_array($offset, $this->gettableProperties, TRUE) &&
> isset($this->{$offset})) {
>        $offsetExists = TRUE;
>      }
>      return $offsetExists;
>    }
>
>
>    public function offsetSet($offset, $value) {
>      if (in_array($offset, $this->settableProperties, TRUE)) {
>        $this->{$offset} = $offset;
>      }
>    }
>
> Within such a limited scope it's imho okay.


I agree, and I also prefer the syntax with curly braces here.

cheers
Ingmar



More information about the TYPO3-team-core mailing list