forked from GNUsocial/gnu-social
		
	[TOOLS] Add explicit return types to fix deprecation warnings raised by PHPUnit
This commit is contained in:
		| @@ -187,7 +187,7 @@ class Client extends Entity implements ClientEntityInterface | ||||
|     // @codeCoverageIgnoreEnd | ||||
|     // }}} Autocode | ||||
|  | ||||
|     public function getIdentifier() | ||||
|     public function getIdentifier(): string | ||||
|     { | ||||
|         return $this->getId(); | ||||
|     } | ||||
|   | ||||
| @@ -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]); | ||||
|     } | ||||
|   | ||||
| @@ -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']; | ||||
|     } | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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(); | ||||
|  | ||||
|   | ||||
| @@ -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()); | ||||
|     } | ||||
|   | ||||
| @@ -194,7 +194,7 @@ class Authenticator extends AbstractFormLoginAuthenticator implements Authentica | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|     protected function getLoginUrl() | ||||
|     protected function getLoginUrl(): string | ||||
|     { | ||||
|         return Router::url(self::LOGIN_ROUTE); | ||||
|     } | ||||
|   | ||||
| @@ -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']), | ||||
|   | ||||
| @@ -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']; | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user