NameEntity::setName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
/**
4
 * Created by PhpStorm.
5
 * User: benedikt
6
 * Date: 1/3/18
7
 * Time: 11:02 AM
8
 */
9
10
namespace Tfboe\FmLib\Entity\Helpers;
11
12
/**
13
 * Trait NameEntity
14
 * @package Tfboe\FmLib\Entity\Helpers
15
 */
16
trait NameEntity
17
{
18
//<editor-fold desc="Fields">
19
  /**
20
   * @ORM\Column(type="string")
21
   * @var string
22
   */
23
  private $name;
24
//</editor-fold desc="Fields">
25
26
//<editor-fold desc="Public Methods">
27
  /**
28
   * @return string
29
   */
30
  public function getName(): string
31
  {
32
    return $this->name;
33
  }
34
35
  /**
36
   * @param string $name
37
   * @return $this|NameEntity
0 ignored issues
show
Comprehensibility Bug introduced by
The return type NameEntity is a trait, and thus cannot be used for type-hinting in PHP. Maybe consider adding an interface and use that for type-hinting?

In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.

If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.

Loading history...
38
   */
39
  public function setName(string $name)
40
  {
41
    $this->name = $name;
42
    return $this;
43
  }
44
//</editor-fold desc="Public Methods">
45
}