Skip to content

Commit

Permalink
Merge pull request #77 from szymach/2.1
Browse files Browse the repository at this point in the history
Fixed class use in FSIDataSourceExtension
  • Loading branch information
rn0 authored Aug 20, 2019
2 parents f912147 + fa70c2c commit 40166d3
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle\DataSource\Extension\Configuration\EventSubscriber;

use FSi\Component\DataSource\DataSourceInterface;
Expand Down
6 changes: 2 additions & 4 deletions DataSource/Extension/Symfony/Core/CoreExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\Core;

use FSi\Component\DataSource\DataSourceAbstractExtension;

/**
* Main extension for all Symfony based extensions. Its main purpose is to
* replace binded Request object into array.
*/
class CoreExtension extends DataSourceAbstractExtension
{
public function loadSubscribers()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\Core\EventSubscriber;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\DependencyInjection\Driver;

use FSi\Component\DataSource\Driver\DriverExtensionInterface;
use FSi\Component\DataSource\Field\FieldExtensionInterface;
use FSi\Component\DataSource\Field\FieldTypeInterface;
use InvalidArgumentException;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
* DependencyInjection extension loads various types of extensions from Symfony's service container.
*/
class DriverExtension implements DriverExtensionInterface
{
/**
Expand Down Expand Up @@ -49,7 +49,7 @@ public function __construct(string $driverType, array $fieldTypes, array $fieldE

foreach ($fieldExtensions as $fieldExtension) {
foreach ($fieldExtension->getExtendedFieldTypes() as $extendedFieldType) {
if (!array_key_exists($extendedFieldType, $this->fieldExtensions)) {
if (false === array_key_exists($extendedFieldType, $this->fieldExtensions)) {
$this->fieldExtensions[$extendedFieldType] = [];
}

Expand All @@ -72,8 +72,8 @@ public function hasFieldType($type)

public function getFieldType($type)
{
if (!array_key_exists($type, $this->fieldTypes)) {
throw new \InvalidArgumentException(sprintf('The field type "%s" is not registered within the service container.', $type));
if (false === array_key_exists($type, $this->fieldTypes)) {
throw new InvalidArgumentException(sprintf('The field type "%s" is not registered within the service container.', $type));
}

return $this->fieldTypes[$type];
Expand All @@ -86,7 +86,7 @@ public function hasFieldTypeExtensions($type)

public function getFieldTypeExtensions($type)
{
if (!array_key_exists($type, $this->fieldExtensions)) {
if (false === array_key_exists($type, $this->fieldExtensions)) {
return [];
}

Expand Down
2 changes: 2 additions & 0 deletions DataSourceBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;
Expand Down
6 changes: 4 additions & 2 deletions DependencyInjection/Compiler/DataSourcePass.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Reference;

class DataSourcePass implements CompilerPassInterface
final class DataSourcePass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('datasource.extension')) {
if (false === $container->hasDefinition('datasource.extension')) {
return;
}

Expand Down
4 changes: 3 additions & 1 deletion DependencyInjection/Compiler/TemplatePathPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle\DependencyInjection\Compiler;

use FSi\Bundle\DataSourceBundle\DataSourceBundle;
use ReflectionClass;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class TemplatePathPass implements CompilerPassInterface
final class TemplatePathPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
Expand Down
2 changes: 2 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand Down
11 changes: 6 additions & 5 deletions DependencyInjection/FSIDataSourceExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace FSi\Bundle\DataSourceBundle\DependencyInjection;

use FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\DependencyInjection\Driver\Collection\EventSubscriberInterface;
use FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\DependencyInjection\Driver\Collection\FieldEventSubscriberInterface;
use FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\DependencyInjection\Driver\Doctrine\DBAL\EventSubscriberInterface;
use FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\DependencyInjection\Driver\Collection;
use FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\DependencyInjection\Driver\Doctrine\DBAL;
use FSi\Bundle\DataSourceBundle\DataSource\Extension\Symfony\DependencyInjection\Driver\Doctrine\ORM;
use FSi\Component\DataSource\Driver\Collection\CollectionAbstractField;
use FSi\Component\DataSource\Driver\Doctrine\DBAL\DBALAbstractField;
Expand Down Expand Up @@ -66,10 +67,10 @@ private function registerForAutoconfiguration(ContainerBuilder $container): void
$container->registerForAutoconfiguration(DriverFactoryInterface::class)->addTag('datasource.driver.factory');
$container->registerForAutoconfiguration(DriverExtensionInterface::class)->addTag('datasource.driver.extension');
$container->registerForAutoconfiguration(CollectionAbstractField::class)->addTag('datasource.driver.collection.field');
$container->registerForAutoconfiguration(FieldEventSubscriberInterface::class)
$container->registerForAutoconfiguration(Collection\FieldEventSubscriberInterface::class)
->addTag('datasource.driver.collection.field.subscriber')
;
$container->registerForAutoconfiguration(EventSubscriberInterface::class)
$container->registerForAutoconfiguration(Collection\EventSubscriberInterface::class)
->addTag('datasource.driver.collection.subscriber')
;
$container->registerForAutoconfiguration(DoctrineAbstractField::class)
Expand Down

0 comments on commit 40166d3

Please sign in to comment.