Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ad81e29

Browse files
committed
Changing empty to null, more consistent with CS
1 parent a687c84 commit ad81e29

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cookbook/doctrine/file_uploads.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ object, which is what's returned after a ``file`` field is submitted::
189189
public function upload()
190190
{
191191
// the file property can be empty if the field is not required
192-
if (empty($this->file)) {
192+
if (null === $this->file) {
193193
return;
194194
}
195195

@@ -246,7 +246,7 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
246246
*/
247247
public function preUpload()
248248
{
249-
if (!empty($this->file)) {
249+
if (null !== $this->file) {
250250
// do whatever you want to generate a unique name
251251
$this->setPath(uniq().'.'.$this->file->guessExtension());
252252
}
@@ -257,7 +257,7 @@ Next, refactor the ``Document`` class to take advantage of these callbacks::
257257
*/
258258
public function upload()
259259
{
260-
if (empty($this->file)) {
260+
if (null === $this->file) {
261261
return;
262262
}
263263

@@ -304,7 +304,7 @@ property, instead of the actual filename::
304304
*/
305305
public function preUpload()
306306
{
307-
if (!empty($this->file)) {
307+
if (null !== $this->file) {
308308
$this->setPath($this->file->guessExtension());
309309
}
310310
}
@@ -314,7 +314,7 @@ property, instead of the actual filename::
314314
*/
315315
public function upload()
316316
{
317-
if (empty($this->file)) {
317+
if (null === $this->file) {
318318
return;
319319
}
320320

0 commit comments

Comments
 (0)