diff --git a/src/Controller/AdminPages/FootprintController.php b/src/Controller/AdminPages/FootprintController.php index e60caba1..42a653ce 100644 --- a/src/Controller/AdminPages/FootprintController.php +++ b/src/Controller/AdminPages/FootprintController.php @@ -72,7 +72,7 @@ class FootprintController extends BaseAdminController * * @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); } @@ -83,7 +83,7 @@ class FootprintController extends BaseAdminController * * @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); } diff --git a/src/Controller/LogController.php b/src/Controller/LogController.php index 59759747..9c34be59 100644 --- a/src/Controller/LogController.php +++ b/src/Controller/LogController.php @@ -53,7 +53,6 @@ use App\Services\LogSystem\EventUndoHelper; use App\Services\LogSystem\TimeTravel; use Doctrine\ORM\EntityManagerInterface; use Omines\DataTablesBundle\DataTableFactory; -use phpDocumentor\Reflection\Element; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -100,7 +99,7 @@ class LogController extends AbstractController /** * @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; $id = $request->request->get('undo'); diff --git a/src/Controller/TypeaheadController.php b/src/Controller/TypeaheadController.php index 8a8054d0..22a31e12 100644 --- a/src/Controller/TypeaheadController.php +++ b/src/Controller/TypeaheadController.php @@ -62,9 +62,11 @@ class TypeaheadController extends AbstractController /** * @Route("/builtInResources/search/{query}", name="typeahead_builtInRessources", requirements={"query"= ".+"}) * + * @param string $query + * @param BuiltinAttachmentsFinder $finder * @return JsonResponse */ - public function builtInResources(Request $request, string $query, BuiltinAttachmentsFinder $finder) + public function builtInResources(string $query, BuiltinAttachmentsFinder $finder) { $array = $finder->find($query); diff --git a/src/Entity/LogSystem/ElementEditedLogEntry.php b/src/Entity/LogSystem/ElementEditedLogEntry.php index 2b4011f2..d3449cfc 100644 --- a/src/Entity/LogSystem/ElementEditedLogEntry.php +++ b/src/Entity/LogSystem/ElementEditedLogEntry.php @@ -84,11 +84,7 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf return array_keys($this->getOldData()); } - if (isset($this->extra['f'])) { - return $this->extra['f']; - } - - return []; + return $this->extra['f'] ?? []; } /** diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index 70665026..081a2cda 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -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. * diff --git a/src/Entity/UserSystem/User.php b/src/Entity/UserSystem/User.php index 1389711a..641f0657 100644 --- a/src/Entity/UserSystem/User.php +++ b/src/Entity/UserSystem/User.php @@ -53,7 +53,6 @@ namespace App\Entity\UserSystem; use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\UserAttachment; use App\Entity\Base\AbstractNamedDBElement; -use App\Entity\Base\MasterAttachmentTrait; use App\Entity\PriceInformations\Currency; use App\Security\Interfaces\HasPermissionsInterface; 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. * @ORM\Column(type="string", nullable=true) */ - protected $pw_reset_token = null; + protected $pw_reset_token; /** * @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") * @Selectable() */ - protected $currency = null; + protected $currency; /** @var PermissionsEmbed * @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. * @ORM\Column(type="datetime", nullable=true) */ - protected $pw_reset_expires = null; + protected $pw_reset_expires; public function __construct() { diff --git a/tests/ApplicationAvailabilityFunctionalTest.php b/tests/ApplicationAvailabilityFunctionalTest.php index 0268d557..a0e2cc1a 100644 --- a/tests/ApplicationAvailabilityFunctionalTest.php +++ b/tests/ApplicationAvailabilityFunctionalTest.php @@ -73,7 +73,7 @@ class ApplicationAvailabilityFunctionalTest extends WebTestCase $this->assertTrue($client->getResponse()->isSuccessful(), 'Request not successful. Status code is '.$client->getResponse()->getStatusCode()); } - public function urlProvider() + public function urlProvider(): ?\Generator { //Homepage //yield ['/']; diff --git a/tests/Controller/AdminPages/AbstractAdminControllerTest.php b/tests/Controller/AdminPages/AbstractAdminControllerTest.php index 41f5b7bc..d462291a 100644 --- a/tests/Controller/AdminPages/AbstractAdminControllerTest.php +++ b/tests/Controller/AdminPages/AbstractAdminControllerTest.php @@ -54,7 +54,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase protected static $base_path = 'not_valid'; protected static $entity_class = 'not valid'; - public function readDataProvider() + public function readDataProvider(): array { return [ ['noread', false], @@ -118,7 +118,7 @@ abstract class AbstractAdminControllerTest extends WebTestCase $this->assertSame($read, ! $client->getResponse()->isForbidden(), 'Permission Checking not working!'); } - public function deleteDataProvider() + public function deleteDataProvider(): array { return [ ['noread', false], diff --git a/tests/DatatablesAvailabilityTest.php b/tests/DatatablesAvailabilityTest.php index 057b22c0..0ad3632a 100644 --- a/tests/DatatablesAvailabilityTest.php +++ b/tests/DatatablesAvailabilityTest.php @@ -55,7 +55,7 @@ class DatatablesAvailabilityTest extends WebTestCase $this->assertJson($client->getResponse()->getContent()); } - public function urlProvider() + public function urlProvider(): ?\Generator { //Part lists yield ['/category/1/parts']; diff --git a/tests/Entity/Attachments/AttachmentTest.php b/tests/Entity/Attachments/AttachmentTest.php index 5d0e20bf..182d3049 100644 --- a/tests/Entity/Attachments/AttachmentTest.php +++ b/tests/Entity/Attachments/AttachmentTest.php @@ -145,7 +145,7 @@ class AttachmentTest extends TestCase $attachment->setElement($element); } - public function externalDataProvider() + public function externalDataProvider(): array { return [ ['', false], @@ -170,7 +170,7 @@ class AttachmentTest extends TestCase $this->assertSame($expected, $attachment->isExternal()); } - public function extensionDataProvider() + public function extensionDataProvider(): array { return [ ['%MEDIA%/foo/bar.txt', null, 'txt'], @@ -197,7 +197,7 @@ class AttachmentTest extends TestCase $this->assertSame($expected, $attachment->getExtension()); } - public function pictureDataProvider() + public function pictureDataProvider(): array { return [ ['%MEDIA%/foo/bar.txt', false], @@ -221,7 +221,7 @@ class AttachmentTest extends TestCase $this->assertSame($expected, $attachment->isPicture()); } - public function builtinDataProvider() + public function builtinDataProvider(): array { return [ ['', false], @@ -243,7 +243,7 @@ class AttachmentTest extends TestCase $this->assertSame($expected, $attachment->isBuiltIn()); } - public function hostDataProvider() + public function hostDataProvider(): array { return [ ['%MEDIA%/foo/bar.txt', null], @@ -262,7 +262,7 @@ class AttachmentTest extends TestCase $this->assertSame($expected, $attachment->getHost()); } - public function filenameProvider() + public function filenameProvider(): array { return [ ['%MEDIA%/foo/bar.txt', null, 'bar.txt'], diff --git a/tests/Entity/LogSystem/AbstractLogEntryTest.php b/tests/Entity/LogSystem/AbstractLogEntryTest.php index f20aacd2..072cb9d0 100644 --- a/tests/Entity/LogSystem/AbstractLogEntryTest.php +++ b/tests/Entity/LogSystem/AbstractLogEntryTest.php @@ -139,7 +139,7 @@ class AbstractLogEntryTest extends TestCase $this->assertSame(10, $log->getTargetID()); $log->setTargetElement(null); - $this->assertSame(null, $log->getTargetClass()); - $this->assertSame(null, $log->getTargetID()); + $this->assertNull($log->getTargetClass()); + $this->assertNull($log->getTargetID()); } } diff --git a/tests/Entity/StructuralDBElementTest.php b/tests/Entity/StructuralDBElementTest.php index da782316..496a538b 100644 --- a/tests/Entity/StructuralDBElementTest.php +++ b/tests/Entity/StructuralDBElementTest.php @@ -46,7 +46,6 @@ use App\Entity\Attachments\AttachmentType; use App\Entity\Parts\Category; use InvalidArgumentException; use PHPUnit\Framework\TestCase; -use Symfony\Component\Yaml\Tests\A; /** * Test StructuralDBElement entities. diff --git a/tests/Entity/UserSystem/PermissionsEmbedTest.php b/tests/Entity/UserSystem/PermissionsEmbedTest.php index 94aee84c..92d61e92 100644 --- a/tests/Entity/UserSystem/PermissionsEmbedTest.php +++ b/tests/Entity/UserSystem/PermissionsEmbedTest.php @@ -43,7 +43,6 @@ declare(strict_types=1); namespace App\Tests\Entity\UserSystem; use App\Entity\UserSystem\PermissionsEmbed; -use Doctrine\ORM\Mapping\Embedded; use InvalidArgumentException; use PHPUnit\Framework\TestCase; use ReflectionClass; @@ -137,7 +136,7 @@ class PermissionsEmbedTest extends TestCase $embed->getPermissionValue('parts', 1); } - public function getStatesBINARY() + public function getStatesBINARY(): array { return [ 'ALLOW' => [PermissionsEmbed::ALLOW], @@ -147,7 +146,7 @@ class PermissionsEmbedTest extends TestCase ]; } - public function getStatesBOOL() + public function getStatesBOOL(): array { return [ 'ALLOW' => [true], diff --git a/tests/Helpers/BBCodeToMarkdownConverterTest.php b/tests/Helpers/BBCodeToMarkdownConverterTest.php index 9b6a93bb..50626fb0 100644 --- a/tests/Helpers/BBCodeToMarkdownConverterTest.php +++ b/tests/Helpers/BBCodeToMarkdownConverterTest.php @@ -54,7 +54,7 @@ class BBCodeToMarkdownConverterTest extends TestCase $this->converter = new BBCodeToMarkdownConverter(); } - public function dataProvider() + public function dataProvider(): array { return [ ['[b]Bold[/b]', '**Bold**'], diff --git a/tests/Services/Attachments/AttachmentPathResolverTest.php b/tests/Services/Attachments/AttachmentPathResolverTest.php index 35d338c4..2ce6957f 100644 --- a/tests/Services/Attachments/AttachmentPathResolverTest.php +++ b/tests/Services/Attachments/AttachmentPathResolverTest.php @@ -95,7 +95,7 @@ class AttachmentPathResolverTest extends WebTestCase $this->assertNull(self::$service->parameterToAbsolutePath('/./this/one/too')); } - public function placeholderDataProvider() + public function placeholderDataProvider(): array { return [ ['%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 [ [self::$media_path.'/test/img.jpg', '%MEDIA%/test/img.jpg'], diff --git a/tests/Services/Attachments/AttachmentURLGeneratorTest.php b/tests/Services/Attachments/AttachmentURLGeneratorTest.php index 3f2ea81f..b2798756 100644 --- a/tests/Services/Attachments/AttachmentURLGeneratorTest.php +++ b/tests/Services/Attachments/AttachmentURLGeneratorTest.php @@ -58,7 +58,7 @@ class AttachmentURLGeneratorTest extends WebTestCase self::$service = self::$container->get(AttachmentURLGenerator::class); } - public function dataProvider() + public function dataProvider(): array { return [ ['/public/test.jpg', 'test.jpg'], diff --git a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php index a0778c2b..a084af66 100644 --- a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php +++ b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php @@ -63,7 +63,7 @@ class BuiltinAttachmentsFinderTest extends WebTestCase self::$service = self::$container->get(BuiltinAttachmentsFinder::class); } - public function dataProvider() + public function dataProvider(): array { return [ //No value should return empty array diff --git a/tests/Services/PermissionResolverTest.php b/tests/Services/PermissionResolverTest.php index b511ecf5..1ca02b6d 100644 --- a/tests/Services/PermissionResolverTest.php +++ b/tests/Services/PermissionResolverTest.php @@ -109,7 +109,7 @@ class PermissionResolverTest extends WebTestCase $this->group->method('getParent')->willReturn($parent_group); } - public function getPermissionNames() + public function getPermissionNames(): array { //List all possible operation names. return [ diff --git a/tests/Services/PricedetailHelperTest.php b/tests/Services/PricedetailHelperTest.php index 2137cba4..94089ff0 100644 --- a/tests/Services/PricedetailHelperTest.php +++ b/tests/Services/PricedetailHelperTest.php @@ -64,7 +64,7 @@ class PricedetailHelperTest extends WebTestCase $this->service = self::$container->get(PricedetailHelper::class); } - public function maxDiscountAmountDataProvider() + public function maxDiscountAmountDataProvider(): ?\Generator { $part = new Part(); yield [$part, null, 'Part without any orderdetails failed!']; diff --git a/tests/Services/TFA/BackupCodeGeneratorTest.php b/tests/Services/TFA/BackupCodeGeneratorTest.php index c25ce932..e343fc45 100644 --- a/tests/Services/TFA/BackupCodeGeneratorTest.php +++ b/tests/Services/TFA/BackupCodeGeneratorTest.php @@ -66,7 +66,7 @@ class BackupCodeGeneratorTest extends TestCase new BackupCodeGenerator(4, 10); } - public function codeLengthDataProvider() + public function codeLengthDataProvider(): array { return [[6], [8], [10], [16]]; } @@ -80,7 +80,7 @@ class BackupCodeGeneratorTest extends TestCase $this->assertRegExp("/^([a-f0-9]){{$code_length}}\$/", $generator->generateSingleCode()); } - public function codeCountDataProvider() + public function codeCountDataProvider(): array { return [[2], [8], [10]]; }