8000 [PropertyInfo] Implement Naming Strategy for Properties · Issue #16889 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[PropertyInfo] Implement Naming Strategy for Properties #16889
Closed
@zanbaldwin

Description

@zanbaldwin

The ReflectionExtractor sees a public property as separate from its accessor/mutator methods. For example:

class Website
{
    public $domainName;
    public $author;

    public function getDomainName()
    {
        return $this->domainName;
    }

    public function getAuthor()
    {
        return $this->author;
    }
}

var_dump($reflectionExtractor->getProperties());
/*
array (size=4)
  0 => string 'domainName' (length=10)
  1 => string 'author' (length=6)
  2 => string 'DomainName' (length=10)
  3 => string 'Author' (length=6)
*/

The easiest fix would be to lowercase the first letter of the property name determined from a method, though this would cause problems with properties that actually do start with an uppercase letter.

Keeping in mind that it's likely that this component will be used in conjunction with the PropertyAccess component, would it be suitable for a naming strategy to be added (the most obvious being the underscore naming strategy used in both PropertyAccess and Doctrine)?

/cc @dunglas

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0