Fixed some inspection issues.

This commit is contained in:
Jan Böhmer 2019-03-20 23:24:20 +01:00
parent e2f7aafa2d
commit 3fe452626d
9 changed files with 25 additions and 27 deletions

View file

@ -585,9 +585,9 @@ class Part extends AttachmentContainingDBElement
if (\is_string($delimeter)) {
return implode($delimeter, $supplier_names);
} else {
return $supplier_names;
}
return $supplier_names;
}
}

View file

@ -286,9 +286,9 @@ class PermissionsEmbed
if (self::DISALLOW == $value) {
return false;
} else {
return null;
}
return null;
}
/**

View file

@ -40,10 +40,10 @@ use Doctrine\ORM\PersistentCollection;
*/
abstract class StructuralDBElement extends AttachmentContainingDBElement
{
const ID_ROOT_ELEMENT = 0;
public const ID_ROOT_ELEMENT = 0;
//This is a not standard character, so build a const, so a dev can easily use it
const PATH_DELIMITER_ARROW = ' → ';
public const PATH_DELIMITER_ARROW = ' → ';
// We can not define the mapping here or we will get an exception. Unfortunatly we have to do the mapping in the
// subclasses
@ -146,9 +146,7 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
*/
public function getComment(bool $parse_bbcode = true): string
{
$val = htmlspecialchars($this->comment ?? '');
return $val;
return htmlspecialchars($this->comment ?? '');
}
/**
@ -217,7 +215,8 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
if (!$recursive) {
return $this->children;
} else {
}
$all_elements = array();
foreach ($this->children as $subelement) {
$all_elements[] = $subelement;
@ -226,7 +225,6 @@ abstract class StructuralDBElement extends AttachmentContainingDBElement
return $all_elements;
}
}
/******************************************************************************
*

View file

@ -76,15 +76,13 @@ class ElementPermissionListener
$annotation = $reader->getPropertyAnnotation($property,
ColumnSecurity::class);
if (null !== $annotation) {
//Check if user is allowed to read info, otherwise apply placeholder
if (!$this->security->isGranted($annotation->getReadOperationName(), $element)) {
if ((null !== $annotation) && !$this->security->isGranted($annotation->getReadOperationName(), $element)) {
$property->setAccessible(true);
$property->setValue($element, $annotation->getPlaceholder());
}
}
}
}
/**
* @PreUpdate

View file

@ -13,7 +13,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\Voter;
*/
class PartVoter extends ExtendedVoter
{
const READ = 'read';
public const READ = 'read';
protected function supports($attribute, $subject)
{

View file

@ -109,5 +109,7 @@ class EntityURLGenerator
if ($entity instanceof NamedDBElement) {
return sprintf('<a href="%s">%s</a>', $href, $entity->getName());
}
throw new EntityNotSupported('The given entity is not supported yet!');
}
}

View file

@ -18,7 +18,7 @@
<div class="col-md-9">
<div class="row">
<div class="col-md-3">
<img src="{{ main_image }}" class="img-fluid img-thumbnail bg-light" height="300" width="300">
<img src="{{ main_image }}" class="img-fluid img-thumbnail bg-light" alt="Part main image" height="300" width="300">
</div>
<div class="col-md-9">
<h5 class="text-muted pt-2" title="{% trans %}manufacturer.label{% endtrans %}">{{ part.manufacturer.name ?? ""}}</h5>

View file

@ -9,7 +9,7 @@
<div class="card-body row">
<div class="col-md-2">
<div class="img-thumbnail">
<img class="img-fluid img-rounded" src="{{ avatar }}">
<img class="img-fluid img-rounded" alt="User avatar" src="{{ avatar }}">
</div>
</div>
<div class="col-md-5">

View file

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="{{ app.request.locale }}">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">