I removed your comment, as that just restates what I can read from the code. I'd still like a comment here though. It's unclear to me why you are shifting the bits right by zero places. The only reason that I can see is that it forces PHP to treat $maximum_length as an integer. If that's A comment would be helpful, but I wouldn't put it then why nothere. Instead use a helper function here.
$this->maximum_length = UIntArray::make_int32(int)$maximum_length > 0 ? (int)$maximum_length >> 0 : 1;1);
which says what it is doing explicitly rather than relying on a side effect?. Also, I put it all the way around, as you want to force it to be a 32 bit integer all the time, not just when the value is not the default.
private static function make_int32($value)
{
// Doing a shift forces PHP to treat the value as a 32 bit integer.
// Shifting by 0 means that this is otherwise a no-op.
return $value >> 0;
}
if ( 0 > $offset || ( UIntArray::make_int32(int)$offset) >= $this->maximum_length ) )
// $uint_array[] = <value>; will set the $offset to null
if ( is_null($offset) )
{
if ( $this->count >= $this->maximum_length )
{
// panic somehow and do not proceed
}
$offset = $this->count++;
}
$this->data[>data[UIntArray::make_int32(int$offset)$offset]] = $this->sanitize($value);
$offset = UIntArray::make_int32($offset);
$dummy = isset( $this->data[(int)$offset]>data[$offset])
? $this->data[(int)$offset]>data[$offset]
: null;
return $dummy;