Skip to content

Commit

Permalink
add missing typehints
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-sainthillier committed Jan 20, 2025
1 parent 74a7432 commit 3c90cda
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/Exception/MissingPackageException.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
final class MissingPackageException extends \RuntimeException
{
public function __construct($message = '', \Throwable $previous = null)
public function __construct(string $message = '', \Throwable $previous = null)
{
parent::__construct($message, 0, $previous);
}
Expand Down
5 changes: 4 additions & 1 deletion src/Lazy/LazyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

namespace League\FlysystemBundle\Lazy;

use League\Flysystem\Filesystem;
use League\Flysystem\FilesystemAdapter;
use League\Flysystem\FilesystemOperator;
use Psr\Container\ContainerInterface;

/**
Expand All @@ -27,7 +30,7 @@ public function __construct(ContainerInterface $storages)
$this->storages = $storages;
}

public function createStorage(string $source, string $storageName)
public function createStorage(string $source, string $storageName): FilesystemOperator
{
if ($source === $storageName) {
throw new \InvalidArgumentException('The "lazy" adapter source is referring to itself as "'.$source.'", which would lead to infinite recursion.');
Expand Down
2 changes: 1 addition & 1 deletion tests/Adapter/AdapterDefinitionFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function provideConfigOptions(): \Generator
/**
* @dataProvider provideConfigOptions
*/
public function testCreateDefinition($name, $options)
public function testCreateDefinition($name, $options): void
{
$factory = new AdapterDefinitionFactory();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function provideValidOptions(): \Generator
/**
* @dataProvider provideValidOptions
*/
public function testCreateDefinition($options)
public function testCreateDefinition($options): void
{
$definition = $this->createBuilder()->createDefinition($options, Visibility::PRIVATE);
$this->assertSame(AsyncAwsS3Adapter::class, $definition->getClass());
Expand Down
4 changes: 2 additions & 2 deletions tests/Adapter/Builder/AwsAdapterDefinitionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public function provideValidOptions(): \Generator
/**
* @dataProvider provideValidOptions
*/
public function testCreateDefinition($options)
public function testCreateDefinition($options): void
{
$this->assertSame(AwsS3V3Adapter::class, $this->createBuilder()->createDefinition($options, null)->getClass());
}

public function testOptionsBehavior()
public function testOptionsBehavior(): void
{
$definition = $this->createBuilder()->createDefinition([
'client' => 'my_client',
Expand Down
4 changes: 2 additions & 2 deletions tests/Adapter/Builder/AzureAdapterDefinitionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ public function provideValidOptions(): \Generator
/**
* @dataProvider provideValidOptions
*/
public function testCreateDefinition($options)
public function testCreateDefinition($options): void
{
$this->assertSame(AzureBlobStorageAdapter::class, $this->createBuilder()->createDefinition($options, null)->getClass());
}

public function testOptionsBehavior()
public function testOptionsBehavior(): void
{
$definition = $this->createBuilder()->createDefinition([
'client' => 'my_client',
Expand Down
4 changes: 2 additions & 2 deletions tests/Adapter/Builder/FtpAdapterDefinitionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public function provideValidOptions(): \Generator
/**
* @dataProvider provideValidOptions
*/
public function testCreateDefinition($options)
public function testCreateDefinition($options): void
{
$this->assertSame(FtpAdapter::class, $this->createBuilder()->createDefinition($options, null)->getClass());
}

public function testOptionsBehavior()
public function testOptionsBehavior(): void
{
$definition = $this->createBuilder()->createDefinition([
'host' => 'ftp.example.com',
Expand Down
4 changes: 2 additions & 2 deletions tests/Adapter/Builder/GcloudAdapterDefinitionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ public function provideValidOptions(): \Generator
/**
* @dataProvider provideValidOptions
*/
public function testCreateDefinition($options)
public function testCreateDefinition($options): void
{
$this->assertSame(GoogleCloudStorageAdapter::class, $this->createBuilder()->createDefinition($options, null)->getClass());
}

public function testOptionsBehavior()
public function testOptionsBehavior(): void
{
$definition = $this->createBuilder()->createDefinition([
'client' => 'my_client',
Expand Down
8 changes: 4 additions & 4 deletions tests/Adapter/Builder/GridFSAdapterDefinitionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static function provideValidOptions(): \Generator
/**
* @dataProvider provideValidOptions
*/
public function testCreateDefinition($options)
public function testCreateDefinition($options): void
{
$this->assertSame(GridFSAdapter::class, $this->createBuilder()->createDefinition($options, null)->getClass());
}
Expand All @@ -86,7 +86,7 @@ public static function provideInvalidOptions(): \Generator
/**
* @dataProvider provideInvalidOptions
*/
public function testInvalidOptions(array $options, string $message)
public function testInvalidOptions(array $options, string $message): void
{
$builder = $this->createBuilder();

Expand All @@ -96,7 +96,7 @@ public function testInvalidOptions(array $options, string $message)
$builder->createDefinition($options, null);
}

public function testInitializeBucketFromDocumentManager()
public function testInitializeBucketFromDocumentManager(): void
{
$client = new Client();
$config = new Configuration();
Expand All @@ -112,7 +112,7 @@ public function testInitializeBucketFromDocumentManager()
$this->assertSame('avatars', $bucket->getBucketName());
}

public function testInitializeBucketFromConfig()
public function testInitializeBucketFromConfig(): void
{
$bucket = GridFSAdapterDefinitionBuilder::initializeBucketFromConfig(
'mongodb://server:27017/',
Expand Down
4 changes: 2 additions & 2 deletions tests/Adapter/Builder/LocalAdapterDefinitionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ public function provideValidOptions(): \Generator
/**
* @dataProvider provideValidOptions
*/
public function testCreateDefinition($options)
public function testCreateDefinition($options): void
{
$this->assertSame(LocalFilesystemAdapter::class, $this->createBuilder()->createDefinition($options, null)->getClass());
}

public function testOptionsBehavior()
public function testOptionsBehavior(): void
{
$permissions = [
'file' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function createBuilder(): MemoryAdapterDefinitionBuilder
return new MemoryAdapterDefinitionBuilder();
}

public function testOptionsBehavior()
public function testOptionsBehavior(): void
{
$this->assertSame(InMemoryFilesystemAdapter::class, $this->createBuilder()->createDefinition([], null)->getClass());
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Adapter/Builder/SftpAdapterDefinitionBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ public function provideValidOptions(): \Generator
/**
* @dataProvider provideValidOptions
*/
public function testCreateDefinition($options)
public function testCreateDefinition($options): void
{
$this->assertSame(SftpAdapter::class, $this->createBuilder()->createDefinition($options, null)->getClass());
}

public function testOptionsBehavior()
public function testOptionsBehavior(): void
{
$definition = $this->createBuilder()->createDefinition([
'host' => 'ftp.example.com',
Expand Down
14 changes: 7 additions & 7 deletions tests/DependencyInjection/FlysystemExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class FlysystemExtensionTest extends TestCase
{
public function provideFilesystems()
public function provideFilesystems(): \Generator
{
$fsNames = [
'fs_aws',
Expand All @@ -45,7 +45,7 @@ public function provideFilesystems()
/**
* @dataProvider provideFilesystems
*/
public function testFilesystems(string $fsName)
public function testFilesystems(string $fsName): void
{
$kernel = $this->createFysystemKernel();
$container = $kernel->getContainer()->get('test.service_container');
Expand All @@ -58,7 +58,7 @@ public function testFilesystems(string $fsName)
/**
* @dataProvider provideFilesystems
*/
public function testTaggedCollection(string $fsName)
public function testTaggedCollection(string $fsName): void
{
$kernel = $this->createFysystemKernel();
$container = $kernel->getContainer()->get('test.service_container');
Expand All @@ -72,7 +72,7 @@ public function testTaggedCollection(string $fsName)
$this->assertInstanceOf(FilesystemOperator::class, $storages[$fsName]);
}

public function testPublicUrl()
public function testPublicUrl(): void
{
$kernel = $this->createFysystemKernel();
$container = $kernel->getContainer()->get('test.service_container');
Expand All @@ -82,7 +82,7 @@ public function testPublicUrl()
self::assertSame('https://example.org/assets/test1.txt', $fs->publicUrl('test1.txt'));
}

public function testPublicUrls()
public function testPublicUrls(): void
{
$kernel = $this->createFysystemKernel();
$container = $kernel->getContainer()->get('test.service_container');
Expand All @@ -94,7 +94,7 @@ public function testPublicUrls()
self::assertSame('https://cdn3.example.org/yww/test1.txt', $fs->publicUrl('yww/test1.txt'));
}

public function testUrlGenerators()
public function testUrlGenerators(): void
{
$kernel = $this->createFysystemKernel();
$container = $kernel->getContainer()->get('test.service_container');
Expand All @@ -105,7 +105,7 @@ public function testUrlGenerators()
self::assertSame('https://example.org/temporary/test1.txt?expiresAt=1670846026', $fs->temporaryUrl('test1.txt', new \DateTimeImmutable('@1670846026')));
}

public function testReadOnly()
public function testReadOnly(): void
{
$kernel = $this->createFysystemKernel();
$container = $kernel->getContainer()->get('test.service_container');
Expand Down
2 changes: 1 addition & 1 deletion tests/FlysystemBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function provideKernels(): \Generator
/**
* @dataProvider provideKernels
*/
public function testBootKernel(Kernel $kernel)
public function testBootKernel(Kernel $kernel): void
{
$kernel->boot();
$this->assertArrayHasKey('FlysystemBundle', $kernel->getBundles());
Expand Down

0 comments on commit 3c90cda

Please sign in to comment.