Skip to content

Commit

Permalink
Remove @param Something&MockObject annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Jul 15, 2020
1 parent eb3fbb4 commit 2584d3d
Show file tree
Hide file tree
Showing 22 changed files with 8 additions and 90 deletions.
5 changes: 0 additions & 5 deletions core-bundle/tests/Cache/ContaoCacheWarmerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Contao\CoreBundle\Tests\TestCase;
use Contao\System;
use Doctrine\DBAL\Connection;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Filesystem\Filesystem;

Expand Down Expand Up @@ -126,10 +125,6 @@ public function testDoesNotCreateTheCacheFolderIfTheInstallationIsIncomplete():
$this->assertFileNotExists($this->getFixturesDir().'/var/cache/contao');
}

/**
* @param Connection&MockObject $connection
* @param ContaoFramework&MockObject $framework
*/
private function getCacheWarmer(Connection $connection = null, ContaoFramework $framework = null, string $bundle = 'test-bundle'): ContaoCacheWarmer
{
if (null === $connection) {
Expand Down
2 changes: 0 additions & 2 deletions core-bundle/tests/Command/MigrateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Contao\CoreBundle\Migration\MigrationResult;
use Contao\CoreBundle\Tests\TestCase;
use Contao\InstallationBundle\Database\Installer;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Filesystem\Filesystem;
Expand Down Expand Up @@ -177,7 +176,6 @@ public function testDoesNotAbortIfMigrationFails(): void
* @param array<array<string>> $pendingMigrations
* @param array<array<MigrationResult>> $migrationResults
* @param array<array<string>> $runonceFiles
* @param Installer&MockObject $installer
*/
private function getCommand(array $pendingMigrations = [], array $migrationResults = [], array $runonceFiles = [], Installer $installer = null): MigrateCommand
{
Expand Down
6 changes: 0 additions & 6 deletions core-bundle/tests/Command/ResizeImagesCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Contao\Image\DeferredImageStorageInterface;
use Contao\Image\DeferredResizerInterface;
use Contao\Image\ImageInterface;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Bridge\PhpUnit\ClockMock;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Filesystem\Filesystem;
Expand Down Expand Up @@ -133,11 +132,6 @@ function () {
$this->assertNotRegExp('/All images resized/', $display);
}

/**
* @param ImageFactoryInterface&MockObject $factory
* @param DeferredResizerInterface&MockObject $resizer
* @param DeferredImageStorageInterface&MockObject $storage
*/
private function getCommand(ImageFactoryInterface $factory = null, DeferredResizerInterface $resizer = null, DeferredImageStorageInterface $storage = null): ResizeImagesCommand
{
return new ResizeImagesCommand(
Expand Down
3 changes: 0 additions & 3 deletions core-bundle/tests/Command/UserPasswordCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,6 @@ public function testResetsPasswordWithRequiredChangeOnNextLogin(): void
(new CommandTester($command))->execute($input, ['interactive' => false]);
}

/**
* @param Connection&MockObject $connection
*/
private function getCommand(Connection $connection = null, string $password = null): UserPasswordCommand
{
if (null === $connection) {
Expand Down
10 changes: 6 additions & 4 deletions core-bundle/tests/Contao/Database/ResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

use Contao\CoreBundle\Tests\Fixtures\Database\DoctrineArrayStatement;
use Contao\Database\Result;
use PHPUnit\Framework\Error\Notice;
use PHPUnit\Framework\TestCase;

class ResultTest extends TestCase
Expand Down Expand Up @@ -52,7 +51,8 @@ public function testEmptyResult(): void
}
}

$this->expectException(Notice::class);
$this->expectNotice();

$resultStatement->fetchField();
}

Expand Down Expand Up @@ -95,7 +95,8 @@ public function testSingleRow(): void
$this->assertSame('value1', $result->fetchField(0));
}

$this->expectException(Notice::class);
$this->expectNotice();

$result->fetchField(1);
}

Expand Down Expand Up @@ -143,7 +144,8 @@ public function testMultipleRows(): void
$this->assertSame('value2', $result->fetchField(0));
}

$this->expectException(Notice::class);
$this->expectNotice();

$result->fetchField(1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
use Contao\CoreBundle\Fixtures\Exception\PageErrorResponseException;
use Contao\CoreBundle\Tests\TestCase;
use Lexik\Bundle\MaintenanceBundle\Exception\ServiceUnavailableException;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
Expand Down Expand Up @@ -308,9 +307,6 @@ public function testDoesNotLogUnloggableExceptions(): void
$this->assertSame(500, $event->getResponse()->getStatusCode());
}

/**
* @param Environment&MockObject $twig
*/
private function getListener(bool $isBackendUser = false, bool $expectLogging = false, Environment $twig = null): PrettyErrorScreenListener
{
if (null === $twig) {
Expand Down
7 changes: 0 additions & 7 deletions core-bundle/tests/EventListener/UserSessionListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,6 @@ public function testFailsToStoreTheSessionIfThereIsNoSession(): void
$listener->write($this->getResponseEvent($request));
}

/**
* Mocks a session listener.
*
* @param Connection&MockObject $connection
* @param Security&MockObject $security
* @param EventDispatcherInterface&MockObject $eventDispatcher
*/
private function getListener(Connection $connection = null, Security $security = null, EventDispatcherInterface $eventDispatcher = null): UserSessionListener
{
if (null === $connection) {
Expand Down
3 changes: 0 additions & 3 deletions core-bundle/tests/Fragment/FragmentHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ public function testConvertsExceptionsToResponseExceptions(): void
$fragmentHandler->render($uri);
}

/**
* @param BaseFragmentHandler&MockObject $fragmentHandler
*/
private function getFragmentHandler(FragmentRegistry $registry = null, ServiceLocator $renderers = null, ServiceLocator $preHandlers = null, Request $request = null, BaseFragmentHandler $fragmentHandler = null): FragmentHandler
{
if (null === $registry) {
Expand Down
3 changes: 0 additions & 3 deletions core-bundle/tests/Framework/ContaoFrameworkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,6 @@ public function testDelegatesTheResetCalls(): void
$this->assertCount(0, $registry);
}

/**
* @param TokenChecker&MockObject $tokenChecker
*/
private function mockFramework(Request $request = null, ScopeMatcher $scopeMatcher = null, TokenChecker $tokenChecker = null): ContaoFramework
{
$requestStack = new RequestStack();
Expand Down
6 changes: 0 additions & 6 deletions core-bundle/tests/Image/ImageFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,6 @@ public static function emptyHookCallback(): void
{
}

/**
* @param ResizerInterface&MockObject $resizer
* @param ImagineInterface&MockObject $imagine
* @param ImagineInterface&MockObject $imagineSvg
* @param ContaoFramework&MockObject $framework
*/
private function getImageFactory(ResizerInterface $resizer = null, ImagineInterface $imagine = null, ImagineInterface $imagineSvg = null, Filesystem $filesystem = null, ContaoFramework $framework = null, bool $bypassCache = null, array $imagineOptions = null, array $validExtensions = null, string $uploadDir = null): ImageFactory
{
if (null === $resizer) {
Expand Down
5 changes: 0 additions & 5 deletions core-bundle/tests/Image/PictureFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,11 +628,6 @@ public function getAspectRatios(): \Generator
yield [false, 20, 100, 22, 100];
}

/**
* @param PictureGeneratorInterface&MockObject $pictureGenerator
* @param ImageFactoryInterface&MockObject $imageFactory
* @param ContaoFramework&MockObject $framework
*/
private function getPictureFactory(PictureGeneratorInterface $pictureGenerator = null, ImageFactoryInterface $imageFactory = null, ContaoFramework $framework = null, bool $bypassCache = null, array $imagineOptions = null): PictureFactory
{
if (null === $pictureGenerator) {
Expand Down
5 changes: 0 additions & 5 deletions core-bundle/tests/Monolog/ContaoTableProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Contao\CoreBundle\Monolog\ContaoTableProcessor;
use Contao\CoreBundle\Tests\TestCase;
use Monolog\Logger;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
Expand Down Expand Up @@ -232,10 +231,6 @@ public function sourceProvider(): \Generator
yield [ContaoCoreBundle::SCOPE_BACKEND, null, 'BE'];
}

/**
* @param RequestStack&MockObject $requestStack
* @param TokenStorageInterface&MockObject $tokenStorage
*/
private function getContaoTableProcessor(RequestStack $requestStack = null, TokenStorageInterface $tokenStorage = null): ContaoTableProcessor
{
if (null === $requestStack) {
Expand Down
3 changes: 0 additions & 3 deletions core-bundle/tests/OptIn/OptInTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,6 @@ public function testDoesNotRequireSubjectAndTextToResendToken(): void
$this->assertTrue($token->hasBeenSent());
}

/**
* @param ContaoFramework&MockObject $framework
*/
private function getToken(OptInModel $model, ContaoFramework $framework = null): OptInTokenInterface
{
if (null === $framework) {
Expand Down
3 changes: 0 additions & 3 deletions core-bundle/tests/Routing/Matcher/LanguageFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,13 @@
use Contao\CoreBundle\Routing\Matcher\LanguageFilter;
use Contao\CoreBundle\Tests\TestCase;
use Contao\PageModel;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

class LanguageFilterTest extends TestCase
{
/**
* @param PageModel&MockObject $page
*
* @dataProvider getRoutesAndLanguages
*/
public function testRemovesARouteIfTheAcceptedLanguagesDoNotMatch(string $name, ?PageModel $page, string $acceptLanguage, bool $expectPageModel, bool $expectRemoval, bool $prependLocale = false): void
Expand Down
3 changes: 0 additions & 3 deletions core-bundle/tests/Routing/RouteProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -749,9 +749,6 @@ private function createRootPage(string $language, string $alias, bool $fallback
return $page;
}

/**
* @param ContaoFramework&MockObject $framework
*/
private function getRouteProvider(ContaoFramework $framework = null, string $urlSuffix = '.html', bool $prependLocale = false): RouteProvider
{
if (null === $framework) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,10 +449,6 @@ public function testRemovesTheTargetPathInTheSessionOnLogin(): void
$this->getHandler()->onAuthenticationSuccess($request, $token);
}

/**
* @param ContaoFramework&MockObject $framework
* @param LoggerInterface&MockObject $logger
*/
private function getHandler(ContaoFramework $framework = null, LoggerInterface $logger = null): AuthenticationSuccessHandler
{
if (null === $framework) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,6 @@ public function testDoesNotRemoveTheAuthenticationIfTheSessionDoesNotContainATok
$this->assertFalse($authenticator->removeFrontendAuthentication());
}

/**
* @param Security&MockObject $security
* @param SessionInterface&MockObject $session
* @param UserProviderInterface&MockObject $userProvider
* @param LoggerInterface&MockObject $logger
*/
private function getAuthenticator(Security $security = null, SessionInterface $session = null, UserProviderInterface $userProvider = null, LoggerInterface $logger = null): FrontendPreviewAuthenticator
{
if (null === $security) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,6 @@ public function onInvalidCredentials($username): bool
return false;
}

/**
* @param ContaoFramework&MockObject $framework
* @param AuthenticationHandlerInterface&MockObject $twoFactorHandler
* @param TrustedDeviceManagerInterface&MockObject $trustedDeviceManager
*/
private function createUsernamePasswordProvider(ContaoFramework $framework = null, AuthenticationHandlerInterface $twoFactorHandler = null, TrustedDeviceManagerInterface $trustedDeviceManager = null): AuthenticationProvider
{
$userProvider = $this->createMock(UserProviderInterface::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@ private function mockUser(string $class): User
}

/**
* @param Request&MockObject $request
*
* @return RequestStack&MockObject
*/
private function mockRequestStack(Request $request = null): RequestStack
Expand Down
3 changes: 0 additions & 3 deletions core-bundle/tests/Security/User/ContaoUserProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,6 @@ public function onPostAuthenticate(): void
// Dummy method to test the postAuthenticate hook
}

/**
* @param ContaoFramework&MockObject $framework
*/
private function getProvider(ContaoFramework $framework = null, string $userClass = BackendUser::class): ContaoUserProvider
{
if (null === $framework) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Contao\CoreBundle\Framework\ContaoFramework;
use Contao\CoreBundle\Tests\TestCase;
use Contao\CoreBundle\Twig\Extension\ContaoTemplateExtension;
use PHPUnit\Framework\MockObject\MockObject;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -75,9 +74,6 @@ public function testDoesNotRenderTheBackEndTemplateIfNotInBackEndScope(): void
$this->assertEmpty($this->getExtension(null, 'frontend')->renderContaoBackendTemplate());
}

/**
* @param ContaoFramework&MockObject $framework
*/
private function getExtension(ContaoFramework $framework = null, string $scope = 'backend'): ContaoTemplateExtension
{
$request = new Request();
Expand Down
6 changes: 2 additions & 4 deletions core-bundle/tests/Util/SimpleTokenParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,9 @@ public function parseSimpleTokensInvalidComparison(): \Generator
public function testParseSimpleTokenWithCustomExtensionProvider(): void
{
$stringExtensionProvider = new class() implements ExpressionFunctionProviderInterface {
public function getFunctions()
public function getFunctions(): array
{
return [
ExpressionFunction::fromPhp('strtoupper'),
];
return [ExpressionFunction::fromPhp('strtoupper')];
}
};

Expand Down

0 comments on commit 2584d3d

Please sign in to comment.