Skip to content

Commit

Permalink
Check method existence without initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
bvrbanec authored and pspanja committed Dec 20, 2019
1 parent 49aa0f7 commit 1c78613
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/Container/Compiler/FieldTypeRegistryPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Netgen\EzPlatformSearchExtra\Container\Compiler;

use eZ\Publish\Core\FieldType\Null\Type as NullType;
use eZ\Publish\Core\Persistence\FieldType as eZFieldType;
use eZ\Publish\SPI\FieldType\Generic\Type as GenericFieldType;
use Netgen\EzPlatformSearchExtra\Core\Persistence\FieldTypeRegistry;
Expand All @@ -18,9 +17,7 @@ public function process(ContainerBuilder $container)
return;
}

$testNullType = new NullType('test_is_empty');
$eZFieldType = new eZFieldType($testNullType);
if (method_exists($eZFieldType, 'isEmptyValue')) {
if (method_exists(eZFieldType::class, 'isEmptyValue')) {
return;
}

Expand All @@ -33,7 +30,7 @@ public function process(ContainerBuilder $container)
$fieldTypeRegistry = $container->findDefinition('ezpublish.persistence.field_type_registry');
$fieldTypeRegistry->setClass($fieldTypeRegistryClass);

if (count($fieldTypeRegistry->getArguments()) > 0) {
if (\count($fieldTypeRegistry->getArguments()) > 0) {
$fieldTypeRegistry->setArgument(0, $fieldTypeRegistryClass);
}
}
Expand Down

0 comments on commit 1c78613

Please sign in to comment.