Skip to content

Update of Symfony standards #1126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Update of Symfony standards #1126

wants to merge 2 commits into from

Conversation

stephpy
Copy link
Contributor

@stephpy stephpy commented Mar 5, 2012

As we can see on each symfony class, argument and parameter names are camelized.
They are only options which keep "underscore"

Just an update.

@weaverryan
Copy link
Member

Hi Stéphane!

I guess it's not clear what we mean by "parameters". I think of dependency injection parameters (but perhaps these are "options"), which are underscore (see http://symfony.com/doc/current/reference/configuration/framework.html#csrf-protection).

What do you think of when you see "parameters"?

Thanks!

@stephpy
Copy link
Contributor Author

stephpy commented Mar 14, 2012

Hi,
Imho "csrf_protection" is an option, imho parameters names are class properties, it's not clear and i'm may be wrong,

May it's a great idea to publish an example to be clear with everybody:

<?php
class MyClass // camelCase
{
    protected $argumentOne; // camelCase

    public function myMethod($argumentOne, $options) // camelCase
    {
        $myVariable = '...'; // camelCase
        $options = array_merge($options, array(
            'my_option' => 'value', // underscore
        ));
    }
}

@burn2delete
Copy link

+1 a good example would definitely help, or maybe i should learn better terminology :P

@stephpy
Copy link
Contributor Author

stephpy commented Apr 3, 2012

We are sure than each vars/arguments/properties are camelCase, except array keys for options like

<?php
$options = array_merge($options, array(
    'my_option' => 'value', // underscore
));

So, Either we show an exemple of an array keys of options and say than each other cases are camelCase, or we show a complete exemple of all known cases. What's your opinion ?

@burn2delete
Copy link

+1 for all known cases, makes it easier for new Symfony users to start doing things correctly from the start. (like myself)

@weaverryan
Copy link
Member

I'm going to close this PR, but what I think we need is just to add an example of the proper use of underscores to the main code block example that's already on this page: http://symfony.com/doc/current/contributing/code/standards.html

I think if we add that, it'll address that missing piece.

Thanks!

@weaverryan weaverryan closed this Apr 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants