Skip to content

Commit 08790e1

Browse files
committed
Add annotation with proper types for setter and getter methods
1 parent d971bfa commit 08790e1

File tree

3 files changed

+102
-1
lines changed

3 files changed

+102
-1
lines changed

src/AppBundle/Entity/Comment.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public function __construct()
8383

8484
/**
8585
* @Assert\IsTrue(message = "comment.is_spam")
86+
*
87+
* @return bool
8688
*/
8789
public function isLegitComment()
8890
{
@@ -91,46 +93,73 @@ public function isLegitComment()
9193
return !$containsInvalidCharacters;
9294
}
9395

96+
/**
97+
* @return int
98+
*/
9499
public function getId()
95100
{
96101
return $this->id;
97102
}
98103

104+
/**
105+
* @return string
106+
*/
99107
public function getContent()
100108
{
101109
return $this->content;
102110
}
103111

112+
/**
113+
* @param string $content
114+
*/
104115
public function setContent($content)
105116
{
106117
$this->content = $content;
107118
}
108119

120+
/**
121+
* @return string
122+
*/
109123
public function getAuthorEmail()
110124
{
111125
return $this->authorEmail;
112126
}
113127

128+
/**
129+
* @param string $authorEmail
130+
*/
114131
public function setAuthorEmail($authorEmail)
115132
{
116133
$this->authorEmail = $authorEmail;
117134
}
118135

136+
/**
137+
* @return \DateTime
138+
*/
119139
public function getPublishedAt()
120140
{
121141
return $this->publishedAt;
122142
}
123143

144+
/**
145+
* @param \DateTime $publishedAt
146+
*/
124147
public function setPublishedAt(\DateTime $publishedAt)
125148
{
126149
$this->publishedAt = $publishedAt;
127150
}
128151

152+
/**
153+
* @return Post
154+
*/
129155
public function getPost()
130156
{
131157
return $this->post;
132158
}
133159

160+
/**
161+
* @param Post $post
162+
*/
134163
public function setPost(Post $post)
135164
{
136165
$this->post = $post;

src/AppBundle/Entity/Post.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,46 +103,73 @@ public function __construct()
103103
$this->comments = new ArrayCollection();
104104
}
105105

106+
/**
107+
* @return int
108+
*/
106109
public function getId()
107110
{
108111
return $this->id;
109112
}
110113

114+
/**
115+
* @return string
116+
*/
111117
public function getTitle()
112118
{
113119
return $this->title;
114120
}
115121

122+
/**
123+
* @param string $title
124+
*/
116125
public function setTitle($title)
117126
{
118127
$this->title = $title;
119128
}
120129

130+
/**
131+
* @return string
132+
*/
121133
public function getSlug()
122134
{
123135
return $this->slug;
124136
}
125137

138+
/**
139+
* @param string $slug
140+
*/
126141
public function setSlug($slug)
127142
{
128143
$this->slug = $slug;
129144
}
130145

146+
/**
147+
* @return string
148+
*/
131149
public function getContent()
132150
{
133151
return $this->content;
134152
}
135153

154+
/**
155+
* @param string $content
156+
*/
136157
public function setContent($content)
137158
{
138159
$this->content = $content;
139160
}
140161

162+
/**
163+
* @return string
164+
*/
141165
public function getAuthorEmail()
142166
{
143167
return $this->authorEmail;
144168
}
145169

170+
/**
171+
* @param string $authorEmail
172+
*/
146173
public function setAuthorEmail($authorEmail)
147174
{
148175
$this->authorEmail = $authorEmail;
@@ -160,37 +187,58 @@ public function isAuthor(User $user)
160187
return $user->getEmail() === $this->getAuthorEmail();
161188
}
162189

190+
/**
191+
* @return \DateTime
192+
*/
163193
public function getPublishedAt()
164194
{
165195
return $this->publishedAt;
166196
}
167197

198+
/**
199+
* @param \DateTime $publishedAt
200+
*/
168201
public function setPublishedAt(\DateTime $publishedAt)
169202
{
170203
$this->publishedAt = $publishedAt;
171204
}
172205

206+
/**
207+
* @return Comment[]|ArrayCollection
208+
*/
173209
public function getComments()
174210
{
175211
return $this->comments;
176212
}
177213

214+
/**
215+
* @param Comment $comment
216+
*/
178217
public function addComment(Comment $comment)
179218
{
180219
$this->comments->add($comment);
181220
$comment->setPost($this);
182221
}
183222

223+
/**
224+
* @param Comment $comment
225+
*/
184226
public function removeComment(Comment $comment)
185227
{
186228
$this->comments->removeElement($comment);
187229
}
188230

231+
/**
232+
* @return string
233+
*/
189234
public function getSummary()
190235
{
191236
return $this->summary;
192237
}
193238

239+
/**
240+
* @param string $summary
241+
*/
194242
public function setSummary($summary)
195243
{
196244
$this->summary = $summary;

src/AppBundle/Entity/User.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class User implements UserInterface
5757
*/
5858
private $roles = [];
5959

60+
/**
61+
* @return int
62+
*/
6063
public function getId()
6164
{
6265
return $this->id;
@@ -70,16 +73,25 @@ public function getUsername()
7073
return $this->username;
7174
}
7275

76+
/**
77+
* @param string $username
78+
*/
7379
public function setUsername($username)
7480
{
7581
$this->username = $username;
7682
}
7783

84+
/**
85+
* @return string
86+
*/
7887
public function getEmail()
7988
{
8089
return $this->email;
8190
}
8291

92+
/**
93+
* @param string $email
94+
*/
8395
public function setEmail($email)
8496
{
8597
$this->email = $email;
@@ -93,13 +105,18 @@ public function getPassword()
93105
return $this->password;
94106
}
95107

108+
/**
109+
* @param string $password
110+
*/
96111
public function setPassword($password)
97112
{
98113
$this->password = $password;
99114
}
100115

101116
/**
102117
* Returns the roles or permissions granted to the user for security.
118+
*
119+
* @return array
103120
*/
104121
public function getRoles()
105122
{
@@ -113,25 +130,32 @@ public function getRoles()
113130
return array_unique($roles);
114131
}
115132

133+
/**
134+
* @param array $roles
135+
*/
116136
public function setRoles(array $roles)
117137
{
118138
$this->roles = $roles;
119139
}
120140

121141
/**
122142
* Returns the salt that was originally used to encode the password.
143+
*
144+
* {@inheritdoc}
123145
*/
124146
public function getSalt()
125147
{
126148
// See "Do you need to use a Salt?" at http://symfony.com/doc/current/cookbook/security/entity_provider.html
127149
// we're using bcrypt in security.yml to encode the password, so
128150
// the salt value is built-in and you don't have to generate one
129151

130-
return;
152+
return null;
131153
}
132154

133155
/**
134156
* Removes sensitive data from the user.
157+
*
158+
* @return void
135159
*/
136160
public function eraseCredentials()
137161
{

0 commit comments

Comments
 (0)