Skip to content

Commit

Permalink
Add more type safety
Browse files Browse the repository at this point in the history
  • Loading branch information
ipf committed Sep 1, 2021
1 parent 9f774bf commit f55c5bb
Show file tree
Hide file tree
Showing 21 changed files with 267 additions and 420 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# PHPUnit
/app/phpunit.xml
/phpunit.xml
.phpunit.result.cache

# Build data
/build/
Expand All @@ -47,5 +48,6 @@
# Backup entities generated with doctrine:generate:entities command
*/Entity/*~
/.php_cs.cache
/.php-cs-fixer.cache
composer.lock
.phpunit.result.cache
36 changes: 36 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('build')
->exclude('cache')
->exclude('var')
->exclude('vendor')
->in(__DIR__);

$config = new PhpCsFixer\Config();
$config
->setRules([
'@Symfony' => true,
'ordered_class_elements' => [
'order' => [
'use_trait',
'constant_public',
'constant_protected',
'constant_private',
'property_public',
'property_protected',
'property_private',
'construct',
'destruct',
'magic',
'phpunit',
'method_public',
'method_protected',
'method_private'
]
],
'array_syntax' => ['syntax' => 'short'],
])
->setFinder($finder);

return $config;
19 changes: 0 additions & 19 deletions .php_cs

This file was deleted.

4 changes: 2 additions & 2 deletions DependencyInjection/SubugoeIIIFExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Subugoe\IIIFBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* This is the class that loads and manages your bundle configuration.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# IIIF Bundle

This is a Symfony 3.x Bundle to get an IIIF Representation out of arbitrary data structures.
This is a Symfony 5.x Bundle to get an IIIF Representation out of arbitrary data structures.

## Example configuration

Expand Down
18 changes: 3 additions & 15 deletions Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,23 @@
/**
* Wrapper around cache and source filesystems.
*/
class FileService
class FileService implements FileServiceInterface
{
/**
* @var Filesystem
*/
private $cacheFilesystem;
private Filesystem $cacheFilesystem;

/**
* @var Filesystem
*/
private $sourceFilesystem;
private Filesystem $sourceFilesystem;

public function __construct(Filesystem $cacheFilesystem, Filesystem $sourceFilesystem)
{
$this->cacheFilesystem = $cacheFilesystem;
$this->sourceFilesystem = $sourceFilesystem;
}

/**
* @return Filesystem
*/
public function getCacheFilesystem(): Filesystem
{
return $this->cacheFilesystem;
}

/**
* @return Filesystem
*/
public function getSourceFilesystem(): Filesystem
{
return $this->sourceFilesystem;
Expand Down
15 changes: 15 additions & 0 deletions Service/FileServiceInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Subugoe\IIIFBundle\Service;

use League\Flysystem\Filesystem;

/**
* Wrapper around cache and source filesystems.
*/
interface FileServiceInterface
{
public function getCacheFilesystem(): Filesystem;

public function getSourceFilesystem(): Filesystem;
}
Loading

0 comments on commit f55c5bb

Please sign in to comment.