Skip to content

Commit

Permalink
chore: remove deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Jürgen Kußmann committed Oct 7, 2024
1 parent 00780aa commit 7e4b713
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Classes/Domain/Service/RestrictionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function hasEntry(): bool
public function getEntry(): ?Entry
{
if (!isset($this->entry)) {
$entry = $this->entryRepository->findOneByIdentifier($this->getClientIdentifier());
$entry = $this->entryRepository->findOneBy(['identifier' => $this->getClientIdentifier()]);
if ($entry instanceof Entry) {
$this->entry = $entry;
if ($this->isOutdated($entry)) {
Expand Down
16 changes: 0 additions & 16 deletions Tests/Fixtures/Classes/EntryRepositoryMock.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
use Aoe\FeloginBruteforceProtection\Domain\Service\RestrictionService;
use Aoe\FeloginBruteforceProtection\Service\Logger\Logger;
use Aoe\FeloginBruteforceProtection\System\Configuration;
use Aoe\FeloginBruteforceProtection\Tests\Fixtures\Classes\EntryRepositoryMock;
use PHPUnit\Framework\MockObject\MockObject;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
Expand Down Expand Up @@ -139,13 +138,13 @@ public function testIsNotClientRestrictedWhenMaximumNumbersOfFailureNotReached()
->willReturn(time() - 200);

$entryRepository = $this->getAccessibleMock(
EntryRepositoryMock::class,
['findOneByIdentifier', 'remove'],
EntryRepository::class,
['findOneBy', 'remove'],
[],
'',
false
);
$entryRepository->method('findOneByIdentifier')
$entryRepository->method('findOneBy')
->willReturn($entry);

GeneralUtility::setSingletonInstance(EntryRepository::class, $entryRepository);
Expand Down Expand Up @@ -178,13 +177,13 @@ public function testIsClientRestrictedWithFailures(): void
->willReturn(time() - 400);

$entryRepository = $this->getAccessibleMock(
EntryRepositoryMock::class,
['findOneByIdentifier', 'remove'],
EntryRepository::class,
['findOneBy', 'remove'],
[],
'',
false
);
$entryRepository->method('findOneByIdentifier')
$entryRepository->method('findOneBy')
->willReturn($entry);

GeneralUtility::setSingletonInstance(EntryRepository::class, $entryRepository);
Expand Down Expand Up @@ -216,13 +215,13 @@ public function testIsClientRestrictedWithFailuresAndTimeout(): void
->willReturn(time() - 4000);

$entryRepository = $this->getAccessibleMock(
EntryRepositoryMock::class,
['findOneByIdentifier', 'remove'],
EntryRepository::class,
['findOneBy', 'remove'],
[],
'',
false
);
$entryRepository->method('findOneByIdentifier')
$entryRepository->method('findOneBy')
->willReturn($entry);

GeneralUtility::setSingletonInstance(EntryRepository::class, $entryRepository);
Expand Down Expand Up @@ -254,13 +253,13 @@ public function testIsClientRestrictedWithLessFailures(): void
->willReturn(time() - 400);

$entryRepository = $this->getAccessibleMock(
EntryRepositoryMock::class,
['findOneByIdentifier', 'remove'],
EntryRepository::class,
['findOneBy', 'remove'],
[],
'',
false
);
$entryRepository->method('findOneByIdentifier')
$entryRepository->method('findOneBy')
->willReturn($entry);

GeneralUtility::setSingletonInstance(EntryRepository::class, $entryRepository);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
use Aoe\FeloginBruteforceProtection\Domain\Service\RestrictionService;
use Aoe\FeloginBruteforceProtection\Service\Logger\Logger;
use Aoe\FeloginBruteforceProtection\System\Configuration;
use Aoe\FeloginBruteforceProtection\Tests\Fixtures\Classes\EntryRepositoryMock;
use PHPUnit\Framework\MockObject\MockObject;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
Expand Down Expand Up @@ -123,8 +122,8 @@ public function testIsClientRestricted(): void
->willReturn(3000);

$entryRepository = $this->getAccessibleMock(
EntryRepositoryMock::class,
['findOneByIdentifier', 'remove'],
EntryRepository::class,
['findOneBy', 'remove'],
[],
'',
false
Expand All @@ -135,7 +134,7 @@ public function testIsClientRestricted(): void
->willReturn(0);
$entry->method('getCrdate')
->willReturn(time() - 400);
$entryRepository->method('findOneByIdentifier')
$entryRepository->method('findOneBy')
->willReturn($entry);

GeneralUtility::setSingletonInstance(EntryRepository::class, $entryRepository);
Expand Down Expand Up @@ -163,13 +162,13 @@ public function testIsClientRestrictedWithFailures(): void
$entry->method('getTstamp')
->willReturn(time() - 400);
$entryRepository = $this->getAccessibleMock(
EntryRepositoryMock::class,
['findOneByIdentifier', 'remove'],
EntryRepository::class,
['findOneBy', 'remove'],
[],
'',
false
);
$entryRepository->method('findOneByIdentifier')
$entryRepository->method('findOneBy')
->willReturn($entry);

GeneralUtility::setSingletonInstance(EntryRepository::class, $entryRepository);
Expand Down Expand Up @@ -197,13 +196,13 @@ public function testIsClientRestrictedWithFailuresAndTimeout(): void
$entry->method('getTstamp')
->willReturn(time() - 4000);
$entryRepository = $this->getAccessibleMock(
EntryRepositoryMock::class,
['findOneByIdentifier', 'remove'],
EntryRepository::class,
['findOneBy', 'remove'],
[],
'',
false
);
$entryRepository->method('findOneByIdentifier')
$entryRepository->method('findOneBy')
->willReturn($entry);

GeneralUtility::setSingletonInstance(EntryRepository::class, $entryRepository);
Expand Down Expand Up @@ -231,13 +230,13 @@ public function testIsClientRestrictedWithLessFailures(): void
$entry->method('getTstamp')
->willReturn(time() - 400);
$entryRepository = $this->getAccessibleMock(
EntryRepositoryMock::class,
['findOneByIdentifier', 'remove'],
EntryRepository::class,
['findOneBy', 'remove'],
[],
'',
false
);
$entryRepository->method('findOneByIdentifier')
$entryRepository->method('findOneBy')
->willReturn($entry);

GeneralUtility::setSingletonInstance(EntryRepository::class, $entryRepository);
Expand Down
9 changes: 0 additions & 9 deletions code-quality/phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^On passing a constant, the method should have an enum type\\. See https\\://phpstan\\.org/writing\\-php\\-code/phpdoc\\-types\\#literals\\-and\\-constants$#"
count: 3
path: ../Classes/Command/CleanUpCommand.php

-
message: "#^Class Aoe\\\\FeloginBruteforceProtection\\\\Domain\\\\Repository\\\\Entry extends generic class TYPO3\\\\CMS\\\\Extbase\\\\Persistence\\\\Repository but does not specify its types\\: T$#"
Expand Down Expand Up @@ -80,11 +76,6 @@ parameters:
count: 1
path: ../Classes/Domain/Service/RestrictionIdentifierFrontendName.php

-
message: "#^Call to an undefined method Aoe\\\\FeloginBruteforceProtection\\\\Domain\\\\Repository\\\\EntryRepository\\:\\:findOneByIdentifier\\(\\)\\.$#"
count: 1
path: ../Classes/Domain/Service/RestrictionService.php

-
message: "#^Access to protected property TYPO3\\\\CMS\\\\Core\\\\Authentication\\\\AbstractUserAuthentication\\:\\:\\$loginSessionStarted\\.$#"
count: 1
Expand Down

0 comments on commit 7e4b713

Please sign in to comment.