Fixed inspection issues.

This commit is contained in:
Jan Böhmer 2020-03-29 22:47:25 +02:00
parent 0fe83c7b3a
commit eb9b24d5d7
20 changed files with 33 additions and 49 deletions

View file

@ -72,7 +72,7 @@ class FootprintController extends BaseAdminController
* *
* @return \Symfony\Component\HttpFoundation\RedirectResponse * @return \Symfony\Component\HttpFoundation\RedirectResponse
*/ */
public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper) public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper): \Symfony\Component\HttpFoundation\RedirectResponse
{ {
return $this->_delete($request, $entity, $recursionHelper); return $this->_delete($request, $entity, $recursionHelper);
} }
@ -83,7 +83,7 @@ class FootprintController extends BaseAdminController
* *
* @return Response * @return Response
*/ */
public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null) public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
{ {
return $this->_edit($entity, $request, $em, $timestamp); return $this->_edit($entity, $request, $em, $timestamp);
} }

View file

@ -53,7 +53,6 @@ use App\Services\LogSystem\EventUndoHelper;
use App\Services\LogSystem\TimeTravel; use App\Services\LogSystem\TimeTravel;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Omines\DataTablesBundle\DataTableFactory; use Omines\DataTablesBundle\DataTableFactory;
use phpDocumentor\Reflection\Element;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -100,7 +99,7 @@ class LogController extends AbstractController
/** /**
* @Route("/undo", name="log_undo", methods={"POST"}) * @Route("/undo", name="log_undo", methods={"POST"})
*/ */
public function undoRevertLog(Request $request, EventUndoHelper $eventUndoHelper) public function undoRevertLog(Request $request, EventUndoHelper $eventUndoHelper): \Symfony\Component\HttpFoundation\RedirectResponse
{ {
$mode = EventUndoHelper::MODE_UNDO; $mode = EventUndoHelper::MODE_UNDO;
$id = $request->request->get('undo'); $id = $request->request->get('undo');

View file

@ -62,9 +62,11 @@ class TypeaheadController extends AbstractController
/** /**
* @Route("/builtInResources/search/{query}", name="typeahead_builtInRessources", requirements={"query"= ".+"}) * @Route("/builtInResources/search/{query}", name="typeahead_builtInRessources", requirements={"query"= ".+"})
* *
* @param string $query
* @param BuiltinAttachmentsFinder $finder
* @return JsonResponse * @return JsonResponse
*/ */
public function builtInResources(Request $request, string $query, BuiltinAttachmentsFinder $finder) public function builtInResources(string $query, BuiltinAttachmentsFinder $finder)
{ {
$array = $finder->find($query); $array = $finder->find($query);

View file

@ -84,11 +84,7 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
return array_keys($this->getOldData()); return array_keys($this->getOldData());
} }
if (isset($this->extra['f'])) { return $this->extra['f'] ?? [];
return $this->extra['f'];
}
return [];
} }
/** /**

View file

@ -120,16 +120,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
} }
} }
/**
* Returns the name of the specification (e.g. "Collector-Base Voltage").
*
* @return string
*/
public function getName(): string
{
return $this->name;
}
/** /**
* Returns the element this parameter belongs to. * Returns the element this parameter belongs to.
* *

View file

@ -53,7 +53,6 @@ namespace App\Entity\UserSystem;
use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\UserAttachment; use App\Entity\Attachments\UserAttachment;
use App\Entity\Base\AbstractNamedDBElement; use App\Entity\Base\AbstractNamedDBElement;
use App\Entity\Base\MasterAttachmentTrait;
use App\Entity\PriceInformations\Currency; use App\Entity\PriceInformations\Currency;
use App\Security\Interfaces\HasPermissionsInterface; use App\Security\Interfaces\HasPermissionsInterface;
use App\Validator\Constraints\Selectable; use App\Validator\Constraints\Selectable;
@ -114,7 +113,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @var string|null The hash of a token the user must provide when he wants to reset his password. * @var string|null The hash of a token the user must provide when he wants to reset his password.
* @ORM\Column(type="string", nullable=true) * @ORM\Column(type="string", nullable=true)
*/ */
protected $pw_reset_token = null; protected $pw_reset_token;
/** /**
* @ORM\Column(type="text", name="config_instock_comment_a") * @ORM\Column(type="text", name="config_instock_comment_a")
@ -252,7 +251,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @ORM\JoinColumn(name="currency_id", referencedColumnName="id") * @ORM\JoinColumn(name="currency_id", referencedColumnName="id")
* @Selectable() * @Selectable()
*/ */
protected $currency = null; protected $currency;
/** @var PermissionsEmbed /** @var PermissionsEmbed
* @ORM\Embedded(class="PermissionsEmbed", columnPrefix="perms_") * @ORM\Embedded(class="PermissionsEmbed", columnPrefix="perms_")
@ -264,7 +263,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
* @var DateTime The time until the password reset token is valid. * @var DateTime The time until the password reset token is valid.
* @ORM\Column(type="datetime", nullable=true) * @ORM\Column(type="datetime", nullable=true)
*/ */
protected $pw_reset_expires = null; protected $pw_reset_expires;
public function __construct() public function __construct()
{ {

View file

@ -73,7 +73,7 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase
$this->assertTrue($client->getResponse()->isSuccessful(), 'Request not successful. Status code is '.$client->getResponse()->getStatusCode()); $this->assertTrue($client->getResponse()->isSuccessful(), 'Request not successful. Status code is '.$client->getResponse()->getStatusCode());
} }
public function urlProvider() public function urlProvider(): ?\Generator
{ {
//Homepage //Homepage
//yield ['/']; //yield ['/'];

View file

@ -54,7 +54,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
protected static $base_path = 'not_valid'; protected static $base_path = 'not_valid';
protected static $entity_class = 'not valid'; protected static $entity_class = 'not valid';
public function readDataProvider() public function readDataProvider(): array
{ {
return [ return [
['noread', false], ['noread', false],
@ -118,7 +118,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase
$this->assertSame($read, ! $client->getResponse()->isForbidden(), 'Permission Checking not working!'); $this->assertSame($read, ! $client->getResponse()->isForbidden(), 'Permission Checking not working!');
} }
public function deleteDataProvider() public function deleteDataProvider(): array
{ {
return [ return [
['noread', false], ['noread', false],

View file

@ -55,7 +55,7 @@ class DatatablesAvailabilityTest extends WebTestCase
$this->assertJson($client->getResponse()->getContent()); $this->assertJson($client->getResponse()->getContent());
} }
public function urlProvider() public function urlProvider(): ?\Generator
{ {
//Part lists //Part lists
yield ['/category/1/parts']; yield ['/category/1/parts'];

View file

@ -145,7 +145,7 @@ class AttachmentTest extends TestCase
$attachment->setElement($element); $attachment->setElement($element);
} }
public function externalDataProvider() public function externalDataProvider(): array
{ {
return [ return [
['', false], ['', false],
@ -170,7 +170,7 @@ class AttachmentTest extends TestCase
$this->assertSame($expected, $attachment->isExternal()); $this->assertSame($expected, $attachment->isExternal());
} }
public function extensionDataProvider() public function extensionDataProvider(): array
{ {
return [ return [
['%MEDIA%/foo/bar.txt', null, 'txt'], ['%MEDIA%/foo/bar.txt', null, 'txt'],
@ -197,7 +197,7 @@ class AttachmentTest extends TestCase
$this->assertSame($expected, $attachment->getExtension()); $this->assertSame($expected, $attachment->getExtension());
} }
public function pictureDataProvider() public function pictureDataProvider(): array
{ {
return [ return [
['%MEDIA%/foo/bar.txt', false], ['%MEDIA%/foo/bar.txt', false],
@ -221,7 +221,7 @@ class AttachmentTest extends TestCase
$this->assertSame($expected, $attachment->isPicture()); $this->assertSame($expected, $attachment->isPicture());
} }
public function builtinDataProvider() public function builtinDataProvider(): array
{ {
return [ return [
['', false], ['', false],
@ -243,7 +243,7 @@ class AttachmentTest extends TestCase
$this->assertSame($expected, $attachment->isBuiltIn()); $this->assertSame($expected, $attachment->isBuiltIn());
} }
public function hostDataProvider() public function hostDataProvider(): array
{ {
return [ return [
['%MEDIA%/foo/bar.txt', null], ['%MEDIA%/foo/bar.txt', null],
@ -262,7 +262,7 @@ class AttachmentTest extends TestCase
$this->assertSame($expected, $attachment->getHost()); $this->assertSame($expected, $attachment->getHost());
} }
public function filenameProvider() public function filenameProvider(): array
{ {
return [ return [
['%MEDIA%/foo/bar.txt', null, 'bar.txt'], ['%MEDIA%/foo/bar.txt', null, 'bar.txt'],

View file

@ -139,7 +139,7 @@ class AbstractLogEntryTest extends TestCase
$this->assertSame(10, $log->getTargetID()); $this->assertSame(10, $log->getTargetID());
$log->setTargetElement(null); $log->setTargetElement(null);
$this->assertSame(null, $log->getTargetClass()); $this->assertNull($log->getTargetClass());
$this->assertSame(null, $log->getTargetID()); $this->assertNull($log->getTargetID());
} }
} }

View file

@ -46,7 +46,6 @@ use App\Entity\Attachments\AttachmentType;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use InvalidArgumentException; use InvalidArgumentException;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Tests\A;
/** /**
* Test StructuralDBElement entities. * Test StructuralDBElement entities.

View file

@ -43,7 +43,6 @@ declare(strict_types=1);
namespace App\Tests\Entity\UserSystem; namespace App\Tests\Entity\UserSystem;
use App\Entity\UserSystem\PermissionsEmbed; use App\Entity\UserSystem\PermissionsEmbed;
use Doctrine\ORM\Mapping\Embedded;
use InvalidArgumentException; use InvalidArgumentException;
use PHPUnit\Framework\TestCase; use PHPUnit\Framework\TestCase;
use ReflectionClass; use ReflectionClass;
@ -137,7 +136,7 @@ class PermissionsEmbedTest extends TestCase
$embed->getPermissionValue('parts', 1); $embed->getPermissionValue('parts', 1);
} }
public function getStatesBINARY() public function getStatesBINARY(): array
{ {
return [ return [
'ALLOW' => [PermissionsEmbed::ALLOW], 'ALLOW' => [PermissionsEmbed::ALLOW],
@ -147,7 +146,7 @@ class PermissionsEmbedTest extends TestCase
]; ];
} }
public function getStatesBOOL() public function getStatesBOOL(): array
{ {
return [ return [
'ALLOW' => [true], 'ALLOW' => [true],

View file

@ -54,7 +54,7 @@ class BBCodeToMarkdownConverterTest extends TestCase
$this->converter = new BBCodeToMarkdownConverter(); $this->converter = new BBCodeToMarkdownConverter();
} }
public function dataProvider() public function dataProvider(): array
{ {
return [ return [
['[b]Bold[/b]', '**Bold**'], ['[b]Bold[/b]', '**Bold**'],

View file

@ -95,7 +95,7 @@ class AttachmentPathResolverTest extends WebTestCase
$this->assertNull(self::$service->parameterToAbsolutePath('/./this/one/too')); $this->assertNull(self::$service->parameterToAbsolutePath('/./this/one/too'));
} }
public function placeholderDataProvider() public function placeholderDataProvider(): array
{ {
return [ return [
['%FOOTPRINTS%/test/test.jpg', self::$footprint_path.'/test/test.jpg'], ['%FOOTPRINTS%/test/test.jpg', self::$footprint_path.'/test/test.jpg'],
@ -117,7 +117,7 @@ class AttachmentPathResolverTest extends WebTestCase
]; ];
} }
public function realPathDataProvider() public function realPathDataProvider(): array
{ {
return [ return [
[self::$media_path.'/test/img.jpg', '%MEDIA%/test/img.jpg'], [self::$media_path.'/test/img.jpg', '%MEDIA%/test/img.jpg'],

View file

@ -58,7 +58,7 @@ class AttachmentURLGeneratorTest extends WebTestCase
self::$service = self::$container->get(AttachmentURLGenerator::class); self::$service = self::$container->get(AttachmentURLGenerator::class);
} }
public function dataProvider() public function dataProvider(): array
{ {
return [ return [
['/public/test.jpg', 'test.jpg'], ['/public/test.jpg', 'test.jpg'],

View file

@ -63,7 +63,7 @@ class BuiltinAttachmentsFinderTest extends WebTestCase
self::$service = self::$container->get(BuiltinAttachmentsFinder::class); self::$service = self::$container->get(BuiltinAttachmentsFinder::class);
} }
public function dataProvider() public function dataProvider(): array
{ {
return [ return [
//No value should return empty array //No value should return empty array

View file

@ -109,7 +109,7 @@ class PermissionResolverTest extends WebTestCase
$this->group->method('getParent')->willReturn($parent_group); $this->group->method('getParent')->willReturn($parent_group);
} }
public function getPermissionNames() public function getPermissionNames(): array
{ {
//List all possible operation names. //List all possible operation names.
return [ return [

View file

@ -64,7 +64,7 @@ class PricedetailHelperTest extends WebTestCase
$this->service = self::$container->get(PricedetailHelper::class); $this->service = self::$container->get(PricedetailHelper::class);
} }
public function maxDiscountAmountDataProvider() public function maxDiscountAmountDataProvider(): ?\Generator
{ {
$part = new Part(); $part = new Part();
yield [$part, null, 'Part without any orderdetails failed!']; yield [$part, null, 'Part without any orderdetails failed!'];

View file

@ -66,7 +66,7 @@ class BackupCodeGeneratorTest extends TestCase
new BackupCodeGenerator(4, 10); new BackupCodeGenerator(4, 10);
} }
public function codeLengthDataProvider() public function codeLengthDataProvider(): array
{ {
return [[6], [8], [10], [16]]; return [[6], [8], [10], [16]];
} }
@ -80,7 +80,7 @@ class BackupCodeGeneratorTest extends TestCase
$this->assertRegExp("/^([a-f0-9]){{$code_length}}\$/", $generator->generateSingleCode()); $this->assertRegExp("/^([a-f0-9]){{$code_length}}\$/", $generator->generateSingleCode());
} }
public function codeCountDataProvider() public function codeCountDataProvider(): array
{ {
return [[2], [8], [10]]; return [[2], [8], [10]];
} }