Skip to content
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

Phpdoc improvements #21

Merged
merged 5 commits into from
Jun 20, 2016
Merged

Conversation

arendvw
Copy link

@arendvw arendvw commented Jun 16, 2016

  • Improved comments from the doctrine point of view
  • Added getter/setter @method comments for base comments
  • Added better indenting of @Property comments
  • Added better type annotations (conversion from doctrine type to php, and hinting for date and time formats)
  • Added available options for enum types (and format for time based formats)

arendvw added 2 commits June 16, 2016 11:39
- Improved comments from the doctrine point of view
- Added getter/setter comments for base comments
- Added better indenting of @Property and @method comments
- Added better php-typing (conversion from doctrine type to php, and hinting for date and time formats
- Added available options for enum types.
- Improved comments from the doctrine point of view
- Added getter/setter comments for base comments
- Added better indenting of @Property and @method comments
- Added better php-typing (conversion from doctrine type to php, and hinting for date and time formats
- Added available options for enum types.
} else {
$commentOptions[] = sprintf("Type: %s(%s)", $column["type"], $column["length"]);
}
} else {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful about CS, we are in symfony1 not Symfony 2.
Should be :

}
else
{

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the heads up - this file did not follow the conventions to begin with in many cases, but I've adjusted the committed part.

@j0k3r
Copy link

j0k3r commented Jun 16, 2016

Could you provide a sample of a generated class before and after your changes?

@arendvw
Copy link
Author

arendvw commented Jun 16, 2016

A (payment) transaction table:

Before
Note that in this case all "@method" tags are generated by the sfDoctrineBuildModelTask

/**
 * BaseTransaction
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property integer $id
 * @property integer $order_id
 * @property enum $status
 * @property object $automaticResponse
 * @property datetime $automaticConfirmation
 * @property object $userResponse
 * @property datetime $userConfirmation
 * @property integer $amount
 * @property timestamp $expires
 * @property Order $Order
 * @property Doctrine_Collection $Messages
 * 
 * @method integer             getId()                    Returns the current record's "id" value
 * @method integer             getOrderId()               Returns the current record's "order_id" value
 * @method enum                getStatus()                Returns the current record's "status" value
 * @method object              getAutomaticResponse()     Returns the current record's "automaticResponse" value
 * @method datetime            getAutomaticConfirmation() Returns the current record's "automaticConfirmation" value
 * @method object              getUserResponse()          Returns the current record's "userResponse" value
 * @method datetime            getUserConfirmation()      Returns the current record's "userConfirmation" value
 * @method integer             getAmount()                Returns the current record's "amount" value
 * @method timestamp           getExpires()               Returns the current record's "expires" value
 * @method Order               getOrder()                 Returns the current record's "Order" value
 * @method Doctrine_Collection getMessages()              Returns the current record's "Messages" collection
 * @method Transaction         setId()                    Sets the current record's "id" value
 * @method Transaction         setOrderId()               Sets the current record's "order_id" value
 * @method Transaction         setStatus()                Sets the current record's "status" value
 * @method Transaction         setAutomaticResponse()     Sets the current record's "automaticResponse" value
 * @method Transaction         setAutomaticConfirmation() Sets the current record's "automaticConfirmation" value
 * @method Transaction         setUserResponse()          Sets the current record's "userResponse" value
 * @method Transaction         setUserConfirmation()      Sets the current record's "userConfirmation" value
 * @method Transaction         setAmount()                Sets the current record's "amount" value
 * @method Transaction         setExpires()               Sets the current record's "expires" value
 * @method Transaction         setOrder()                 Sets the current record's "Order" value
 * @method Transaction         setMessages()              Sets the current record's "Messages" collection
 * 
 * @package    [package]
 * @subpackage [subpackage]
 * @author     [author]
 * @version    [svn thingy]
 */

After:

 /**
 * BaseTransaction
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property int                                       $id                                   Type: integer(4), primary key
 * @property int                                       $order_id                             Type: integer(4), required
 * @property string                                    $status                               Type: enum, default "OPEN", Possible values (OPEN, PENDING, SUCCESS, FAILED, CANCELLED, EXPIRED)
 * @property object                                    $automaticResponse                    Type: object, A doctrine serialized object
 * @property string                                    $automaticConfirmation                Type: datetime, Date and time in ISO-8601 format (YYYY-MM-DD HH:MI)
 * @property object                                    $userResponse                         Type: object, A doctrine serialized object
 * @property string                                    $userConfirmation                     Type: datetime, Date and time in ISO-8601 format (YYYY-MM-DD HH:MI)
 * @property int                                       $amount                               Type: integer, required
 * @property string                                    $expires                              Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
 * @property Order                                     $Order                                
 * @property Doctrine_Collection|TransactionMessage[]  $Messages                             
 *  
 * @method int                                         getId()                               Type: integer(4), primary key
 * @method int                                         getOrderId()                          Type: integer(4), required
 * @method string                                      getStatus()                           Type: enum, default "OPEN", Possible values (OPEN, PENDING, SUCCESS, FAILED, CANCELLED, EXPIRED)
 * @method object                                      getAutomaticresponse()                Type: object, A doctrine serialized object
 * @method string                                      getAutomaticconfirmation()            Type: datetime, Date and time in ISO-8601 format (YYYY-MM-DD HH:MI)
 * @method object                                      getUserresponse()                     Type: object, A doctrine serialized object
 * @method string                                      getUserconfirmation()                 Type: datetime, Date and time in ISO-8601 format (YYYY-MM-DD HH:MI)
 * @method int                                         getAmount()                           Type: integer, required
 * @method string                                      getExpires()                          Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
 * @method Order                                       getOrder()                            
 * @method Doctrine_Collection|TransactionMessage[]    getMessages()                         
 *  
 * @method Transaction                                 setId(int $val)                       Type: integer(4), primary key
 * @method Transaction                                 setOrderId(int $val)                  Type: integer(4), required
 * @method Transaction                                 setStatus(string $val)                Type: enum, default "OPEN", Possible values (OPEN, PENDING, SUCCESS, FAILED, CANCELLED, EXPIRED)
 * @method Transaction                                 setAutomaticresponse(object $val)     Type: object, A doctrine serialized object
 * @method Transaction                                 setAutomaticconfirmation(string $val) Type: datetime, Date and time in ISO-8601 format (YYYY-MM-DD HH:MI)
 * @method Transaction                                 setUserresponse(object $val)          Type: object, A doctrine serialized object
 * @method Transaction                                 setUserconfirmation(string $val)      Type: datetime, Date and time in ISO-8601 format (YYYY-MM-DD HH:MI)
 * @method Transaction                                 setAmount(int $val)                   Type: integer, required
 * @method Transaction                                 setExpires(string $val)               Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
 * @method Transaction                                 setOrder(Order $val)                  
 * @method Transaction                                 setMessages(Doctrine_Collection $val) 
 *  
 * @package    [package]
 * @subpackage [subpackage]
 * @author     [author]
 * @version    [svn thingy]
 */

@arendvw
Copy link
Author

arendvw commented Jun 16, 2016

And sfGuardUser (before):

/**
 * BasesfGuardUser
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property string $first_name
 * @property string $last_name
 * @property string $email_address
 * @property string $username
 * @property string $algorithm
 * @property string $salt
 * @property string $password
 * @property boolean $is_active
 * @property boolean $is_super_admin
 * @property timestamp $last_login
 * @property integer $id
 * @property boolean $is_beta_user
 * @property boolean $allow_google
 * @property Doctrine_Collection $Groups
 * @property Doctrine_Collection $Permissions
 * @property Doctrine_Collection $sfGuardUserPermission
 * @property Doctrine_Collection $sfGuardUserGroup
 * @property sfGuardRememberKey $RememberKeys
 * @property sfGuardForgotPassword $ForgotPassword
 * @property sfGuardUserProfile $Profile
 * @property Doctrine_Collection $Tokens
 * @property Doctrine_Collection $Drawing
 * @property Doctrine_Collection $Order
 * @property Doctrine_Collection $OrderLog
 * 
 * @method string                getFirstName()             Returns the current record's "first_name" value
 * @method string                getLastName()              Returns the current record's "last_name" value
 * @method string                getEmailAddress()          Returns the current record's "email_address" value
 * @method string                getUsername()              Returns the current record's "username" value
 * @method string                getAlgorithm()             Returns the current record's "algorithm" value
 * @method string                getSalt()                  Returns the current record's "salt" value
 * @method string                getPassword()              Returns the current record's "password" value
 * @method boolean               getIsActive()              Returns the current record's "is_active" value
 * @method boolean               getIsSuperAdmin()          Returns the current record's "is_super_admin" value
 * @method timestamp             getLastLogin()             Returns the current record's "last_login" value
 * @method integer               getId()                    Returns the current record's "id" value
 * @method boolean               getIsBetaUser()            Returns the current record's "is_beta_user" value
 * @method boolean               getAllowGoogle()           Returns the current record's "allow_google" value
 * @method Doctrine_Collection   getGroups()                Returns the current record's "Groups" collection
 * @method Doctrine_Collection   getPermissions()           Returns the current record's "Permissions" collection
 * @method Doctrine_Collection   getSfGuardUserPermission() Returns the current record's "sfGuardUserPermission" collection
 * @method Doctrine_Collection   getSfGuardUserGroup()      Returns the current record's "sfGuardUserGroup" collection
 * @method sfGuardRememberKey    getRememberKeys()          Returns the current record's "RememberKeys" value
 * @method sfGuardForgotPassword getForgotPassword()        Returns the current record's "ForgotPassword" value
 * @method sfGuardUserProfile    getProfile()               Returns the current record's "Profile" value
 * @method Doctrine_Collection   getTokens()                Returns the current record's "Tokens" collection
 * @method Doctrine_Collection   getDrawing()               Returns the current record's "Drawing" collection
 * @method Doctrine_Collection   getOrder()                 Returns the current record's "Order" collection
 * @method Doctrine_Collection   getOrderLog()              Returns the current record's "OrderLog" collection
 * @method sfGuardUser           setFirstName()             Sets the current record's "first_name" value
 * @method sfGuardUser           setLastName()              Sets the current record's "last_name" value
 * @method sfGuardUser           setEmailAddress()          Sets the current record's "email_address" value
 * @method sfGuardUser           setUsername()              Sets the current record's "username" value
 * @method sfGuardUser           setAlgorithm()             Sets the current record's "algorithm" value
 * @method sfGuardUser           setSalt()                  Sets the current record's "salt" value
 * @method sfGuardUser           setPassword()              Sets the current record's "password" value
 * @method sfGuardUser           setIsActive()              Sets the current record's "is_active" value
 * @method sfGuardUser           setIsSuperAdmin()          Sets the current record's "is_super_admin" value
 * @method sfGuardUser           setLastLogin()             Sets the current record's "last_login" value
 * @method sfGuardUser           setId()                    Sets the current record's "id" value
 * @method sfGuardUser           setIsBetaUser()            Sets the current record's "is_beta_user" value
 * @method sfGuardUser           setAllowGoogle()           Sets the current record's "allow_google" value
 * @method sfGuardUser           setGroups()                Sets the current record's "Groups" collection
 * @method sfGuardUser           setPermissions()           Sets the current record's "Permissions" collection
 * @method sfGuardUser           setSfGuardUserPermission() Sets the current record's "sfGuardUserPermission" collection
 * @method sfGuardUser           setSfGuardUserGroup()      Sets the current record's "sfGuardUserGroup" collection
 * @method sfGuardUser           setRememberKeys()          Sets the current record's "RememberKeys" value
 * @method sfGuardUser           setForgotPassword()        Sets the current record's "ForgotPassword" value
 * @method sfGuardUser           setProfile()               Sets the current record's "Profile" value
 * @method sfGuardUser           setTokens()                Sets the current record's "Tokens" collection
 * @method sfGuardUser           setDrawing()               Sets the current record's "Drawing" collection
 * @method sfGuardUser           setOrder()                 Sets the current record's "Order" collection
 * @method sfGuardUser           setOrderLog()              Sets the current record's "OrderLog" collection
 * 
 * @package    [package]
 * @subpackage [subpackage]
 * @author     [author]
 * @version    [svn thingy]
 */

sfGuardUser after:

/**
 * BasesfGuardUser
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property string                                       $first_name                                        Type: string(255)
 * @property string                                       $last_name                                         Type: string(255)
 * @property string                                       $email_address                                     Type: string(255), unique
 * @property string                                       $username                                          Type: string(128), unique
 * @property string                                       $algorithm                                         Type: string(128), default "sha1"
 * @property string                                       $salt                                              Type: string(128)
 * @property string                                       $password                                          Type: string(128)
 * @property bool                                         $is_active                                         Type: boolean, default "1"
 * @property bool                                         $is_super_admin                                    Type: boolean
 * @property string                                       $last_login                                        Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
 * @property int                                          $id                                                Type: integer, primary key
 * @property bool                                         $is_beta_user                                      Type: boolean, default "1"
 * @property bool                                         $allow_google                                      Type: boolean
 * @property Doctrine_Collection|sfGuardGroup[]           $Groups                                            
 * @property Doctrine_Collection|sfGuardPermission[]      $Permissions                                       
 * @property Doctrine_Collection|sfGuardUserPermission[]  $sfGuardUserPermission                             
 * @property Doctrine_Collection|sfGuardUserGroup[]       $sfGuardUserGroup                                  
 * @property sfGuardRememberKey                           $RememberKeys                                      
 * @property sfGuardForgotPassword                        $ForgotPassword                                    
 * @property sfGuardUserProfile                           $Profile                                           
 * @property Doctrine_Collection|Token[]                  $Tokens                                            
 * @property Doctrine_Collection|Drawing[]                $Drawing                                           
 * @property Doctrine_Collection|Order[]                  $Order                                             
 * @property Doctrine_Collection|OrderLog[]               $OrderLog                                          
 *  
 * @method string                                         getFirstName()                                     Type: string(255)
 * @method string                                         getLastName()                                      Type: string(255)
 * @method string                                         getEmailAddress()                                  Type: string(255), unique
 * @method string                                         getUsername()                                      Type: string(128), unique
 * @method string                                         getAlgorithm()                                     Type: string(128), default "sha1"
 * @method string                                         getSalt()                                          Type: string(128)
 * @method string                                         getPassword()                                      Type: string(128)
 * @method bool                                           getIsActive()                                      Type: boolean, default "1"
 * @method bool                                           getIsSuperAdmin()                                  Type: boolean
 * @method string                                         getLastLogin()                                     Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
 * @method int                                            getId()                                            Type: integer, primary key
 * @method bool                                           getIsBetaUser()                                    Type: boolean, default "1"
 * @method bool                                           getAllowGoogle()                                   Type: boolean
 * @method Doctrine_Collection|sfGuardGroup[]             getGroups()                                        
 * @method Doctrine_Collection|sfGuardPermission[]        getPermissions()                                   
 * @method Doctrine_Collection|sfGuardUserPermission[]    getSfGuardUserPermission()                         
 * @method Doctrine_Collection|sfGuardUserGroup[]         getSfGuardUserGroup()                              
 * @method sfGuardRememberKey                             getRememberKeys()                                  
 * @method sfGuardForgotPassword                          getForgotPassword()                                
 * @method sfGuardUserProfile                             getProfile()                                       
 * @method Doctrine_Collection|Token[]                    getTokens()                                        
 * @method Doctrine_Collection|Drawing[]                  getDrawing()                                       
 * @method Doctrine_Collection|Order[]                    getOrder()                                         
 * @method Doctrine_Collection|OrderLog[]                 getOrderLog()                                      
 *  
 * @method sfGuardUser                                    setFirstName(string $val)                          Type: string(255)
 * @method sfGuardUser                                    setLastName(string $val)                           Type: string(255)
 * @method sfGuardUser                                    setEmailAddress(string $val)                       Type: string(255), unique
 * @method sfGuardUser                                    setUsername(string $val)                           Type: string(128), unique
 * @method sfGuardUser                                    setAlgorithm(string $val)                          Type: string(128), default "sha1"
 * @method sfGuardUser                                    setSalt(string $val)                               Type: string(128)
 * @method sfGuardUser                                    setPassword(string $val)                           Type: string(128)
 * @method sfGuardUser                                    setIsActive(bool $val)                             Type: boolean, default "1"
 * @method sfGuardUser                                    setIsSuperAdmin(bool $val)                         Type: boolean
 * @method sfGuardUser                                    setLastLogin(string $val)                          Type: timestamp, Timestamp in ISO-8601 format (YYYY-MM-DD HH:MI:SS)
 * @method sfGuardUser                                    setId(int $val)                                    Type: integer, primary key
 * @method sfGuardUser                                    setIsBetaUser(bool $val)                           Type: boolean, default "1"
 * @method sfGuardUser                                    setAllowGoogle(bool $val)                          Type: boolean
 * @method sfGuardUser                                    setGroups(Doctrine_Collection $val)                
 * @method sfGuardUser                                    setPermissions(Doctrine_Collection $val)           
 * @method sfGuardUser                                    setSfGuardUserPermission(Doctrine_Collection $val) 
 * @method sfGuardUser                                    setSfGuardUserGroup(Doctrine_Collection $val)      
 * @method sfGuardUser                                    setRememberKeys(sfGuardRememberKey $val)           
 * @method sfGuardUser                                    setForgotPassword(sfGuardForgotPassword $val)      
 * @method sfGuardUser                                    setProfile(sfGuardUserProfile $val)                
 * @method sfGuardUser                                    setTokens(Doctrine_Collection $val)                
 * @method sfGuardUser                                    setDrawing(Doctrine_Collection $val)               
 * @method sfGuardUser                                    setOrder(Doctrine_Collection $val)                 
 * @method sfGuardUser                                    setOrderLog(Doctrine_Collection $val)              
 *  
 * @package    [package]
 * @subpackage [subpackage]
 * @author     [author]
 * @version    [svn thingy]
 */

- Fixed CS issues
- Getters/Setters would have a different name if the base class had lowercase prefixes.
@miniche
Copy link

miniche commented Jun 20, 2016

Ok for me.

Can you squash your commits into only one?

arendvw added 2 commits June 20, 2016 17:22
- Improved comments from the doctrine point of view
- Added getter/setter comments for base comments
- Added better indenting of @Property and @method comments
- Added better php-typing (conversion from doctrine type to php, and hinting for date and time formats
- Added available options for enum types.

feature(better-comments):
- Improved comments from the doctrine point of view
- Added getter/setter comments for base comments
- Added better indenting of @Property and @method comments
- Added better php-typing (conversion from doctrine type to php, and hinting for date and time formats
- Added available options for enum types.

- Added timestamp autocomplete
- Fixed CS issues
- Getters/Setters would have a different name if the base class had lowercase prefixes.
@arendvw
Copy link
Author

arendvw commented Jun 20, 2016

Sure, is this what you meant? Or should I cherry pick the commit into a new branch?

@j0k3r
Copy link

j0k3r commented Jun 20, 2016

This is what we mean: https://ariejan.net/2011/07/05/git-squash-your-latests-commits-into-one/
But we can merge and squash your commit.

Thanks for the PR 👍

@j0k3r j0k3r merged commit 57fdca4 into FriendsOfSymfony1:master Jun 20, 2016
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