chobie / php-protocolbuffers

PECL ProtocolBuffers
pecl.php.net/package/protocolbuffers
Other
128 stars 38 forks source link

case sensitive field #8

Closed toannguyen closed 11 years ago

toannguyen commented 11 years ago

When dec field, "regPlace" Err: undefined method ::setRegPlace()

chobie commented 11 years ago

Yea, current imlementation expects snake case field name. I'll add an option for accept this case.

Thanks

chobie commented 11 years ago

for now, support case sensitive fields. but I should ask google guys about how to treat case sensitive fields.

chobie commented 11 years ago

okay, we should use underscore_separated_names for member name. https://developers.google.com/protocol-buffers/docs/style

Technically, magic method is able to detect case sensitive field name. but user land method does not. so I recommend to follow google's style when you define a message.

<?php

class A extends ProtocolBuffers\Message
{
  public function getBar()
  {
  }

  // you can't define `getbar` method as already defined above.
  public function getbar()
  {
  }
}

# Fatal error: Cannot redeclare A::getbar() in check.php on line 9