[TOOLS] Add explicit return types to fix deprecation warnings raised by PHPUnit

This commit is contained in:
Hugo Sales 2022-03-06 23:50:40 +00:00 committed by Diogo Peralta Cordeiro
parent 372cf91fbc
commit 46de2d47e9
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0
9 changed files with 13 additions and 11 deletions

View File

@ -187,7 +187,7 @@ class Client extends Entity implements ClientEntityInterface
// @codeCoverageIgnoreEnd
// }}} Autocode
public function getIdentifier()
public function getIdentifier(): string
{
return $this->getId();
}

View File

@ -35,6 +35,7 @@ namespace Plugin\OAuth2\Repository;
use App\Core\DB\DB;
use App\Util\Exception\NotFoundException;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
use Plugin\OAuth2\Entity;
@ -63,7 +64,7 @@ class Client implements ClientRepositoryInterface
* @throws \App\Util\Exception\DuplicateFoundException
* @throws NotFoundException
*/
public function getClientEntity($clientIdentifier)
public function getClientEntity($clientIdentifier): ?ClientEntityInterface
{
return DB::findOneBy(Entity\Client::class, ['id' => $clientIdentifier]);
}

View File

@ -36,7 +36,7 @@ class FormTypeNonceExtension extends AbstractTypeExtension implements EventSubsc
$builder->addEventSubscriber($this);
}
public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [FormEvents::PRE_SUBMIT => 'preSubmit'];
}

View File

@ -187,7 +187,7 @@ class TransExtractor extends AbstractFileExtractor implements ExtractorInterface
/**
* {@inheritDoc}
*/
protected function extractFromDirectory($directory)
protected function extractFromDirectory($directory): iterable
{
$finder = new Finder();
return $finder->files()->name('*.php')->in($directory);

View File

@ -96,7 +96,7 @@ class SchemaDefDriver extends StaticPHPDriver implements CompilerPassInterface
* @param class-string $class_name
* @param ClassMetadataInfo $metadata ClassMetadataInfo is the real type, but we need to override the method
*/
public function loadMetadataForClass($class_name, ClassMetadata $metadata)
public function loadMetadataForClass($class_name, ClassMetadata $metadata): void
{
$schema = $class_name::schemaDef();

View File

@ -408,7 +408,7 @@ class LocalUser extends Entity implements UserInterface, PasswordAuthenticatedUs
/**
* Returns the roles granted to the user
*/
public function getRoles()
public function getRoles(): array
{
return ActorLocalRoles::toArray($this->getActor()->getRoles());
}

View File

@ -194,7 +194,7 @@ class Authenticator extends AbstractFormLoginAuthenticator implements Authentica
);
}
protected function getLoginUrl()
protected function getLoginUrl(): string
{
return Router::url(self::LOGIN_ROUTE);
}

View File

@ -38,14 +38,14 @@ use Twig\TwigTest;
class Extension extends AbstractExtension
{
public function getFilters()
public function getFilters(): array
{
return [
// new TwigFilter('foo', [GSRuntime::class, 'foo']),
];
}
public function getTests()
public function getTests(): array
{
return [
new TwigTest('instanceof', [Runtime::class, 'isInstanceOf']),

View File

@ -219,16 +219,17 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
/**
* @codeCoverageIgnore
*/
public function onKernelRequest(RequestEvent $event)
public function onKernelRequest(RequestEvent $event): RequestEvent
{
// Request is not a service, can't find a better way to get it
$this->request = $event->getRequest();
return $event;
}
/**
* @codeCoverageIgnore
*/
public static function getSubscribedEvents()
public static function getSubscribedEvents(): array
{
return [KernelEvents::REQUEST => 'onKernelRequest'];
}