Fixed some inspection issues.

This commit is contained in:
Jan Böhmer 2019-08-20 18:39:57 +02:00
parent 8e23629dc0
commit 1629f31fed
31 changed files with 187 additions and 211 deletions

View file

@ -52,7 +52,6 @@ declare(strict_types=1);
namespace App\Entity\Base;
use App\Entity\Base\StructuralDBElement;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
@ -67,39 +66,39 @@ abstract class Company extends StructuralDBElement
* @var string The address of the company
* @ORM\Column(type="string")
*/
protected $address = "";
protected $address = '';
/**
* @var string The phone number of the company
* @ORM\Column(type="string")
*/
protected $phone_number = "";
protected $phone_number = '';
/**
* @var string The fax number of the company
* @ORM\Column(type="string")
*/
protected $fax_number = "";
protected $fax_number = '';
/**
* @var string The email address of the company
* @ORM\Column(type="string")
* @Assert\Email()
*/
protected $email_address = "";
protected $email_address = '';
/**
* @var string The website of the company
* @ORM\Column(type="string")
* @Assert\Url()
*/
protected $website = "";
protected $website = '';
/**
* @var string
* @ORM\Column(type="string")
*/
protected $auto_product_url = "";
protected $auto_product_url = '';
/********************************************************************************
*

View file

@ -55,10 +55,8 @@ namespace App\Entity\Base;
use App\Entity\Attachments\AttachmentContainingDBElement;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\PersistentCollection;
use App\Validator\Constraints\NoneOfItsChildren;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups;
/**
@ -102,7 +100,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
* @ORM\Column(type="text")
* @Groups({"simple", "extended", "full"})
*/
protected $comment = "";
protected $comment = '';
/**
* @var int
@ -132,6 +130,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
public function __construct()
{
parent::__construct();
$this->children = new ArrayCollection();
}
@ -154,16 +153,16 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
$class_name = \get_class($this);
//Check if both elements compared, are from the same type:
if ($class_name != \get_class($another_element)) {
if ($class_name !== \get_class($another_element)) {
throw new \InvalidArgumentException('isChildOf() only works for objects of the same type!');
}
if (null == $this->getParent()) { // this is the root node
if (null === $this->getParent()) { // this is the root node
return false;
}
//If this' parents element, is $another_element, then we are finished
return ($this->parent->getID() == $another_element->getID())
return ($this->parent->getID() === $another_element->getID())
|| $this->parent->isChildOf($another_element); //Otherwise, check recursivley
}
@ -247,7 +246,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
$overflow = 20; //We only allow 20 levels depth
while (null != $element->parent && $overflow >= 0) {
while (null !== $element->parent && $overflow >= 0) {
$element = $element->parent;
$this->full_path_strings[] = $element->getName();
//Decrement to prevent mem overflow.