From 0d9024ed74e68725e1199bd18d661edf744d9b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edi=20Modri=C4=87?= Date: Fri, 24 Apr 2020 09:20:45 +0200 Subject: [PATCH] Import all global functions and constants --- .php_cs | 9 ++++++++- Core/FieldType/ContentTypeList/Type.php | 2 ++ Core/FieldType/ContentTypeList/Value.php | 1 + .../FieldValue/Converter/ContentTypeListConverter.php | 3 +++ DependencyInjection/NetgenContentTypeListExtension.php | 1 + Tests/Core/FieldType/ContentTypeList/TypeTest.php | 1 + 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.php_cs b/.php_cs index 9109f16..3245b12 100644 --- a/.php_cs +++ b/.php_cs @@ -10,8 +10,9 @@ return PhpCsFixer\Config::create() 'concat_space' => ['spacing' => 'one'], 'method_chaining_indentation' => false, 'multiline_whitespace_before_semicolons' => false, - 'native_function_invocation' => false, + 'native_function_invocation' => ['include' => ['@all']], 'no_superfluous_phpdoc_tags' => false, + 'ordered_imports' => ['imports_order' => ['class', 'function', 'const']], 'php_unit_internal_class' => false, 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], 'php_unit_test_class_requires_covers' => false, @@ -24,8 +25,14 @@ return PhpCsFixer\Config::create() // Additional rules 'date_time_immutable' => true, 'declare_strict_types' => true, + 'global_namespace_import' => [ + 'import_classes' => null, + 'import_constants' => true, + 'import_functions' => true, + ], 'list_syntax' => ['syntax' => 'short'], 'mb_str_functions' => true, + 'native_constant_invocation' => true, 'static_lambda' => true, 'ternary_to_null_coalescing' => true, ]) diff --git a/Core/FieldType/ContentTypeList/Type.php b/Core/FieldType/ContentTypeList/Type.php index 658179c..05373a1 100644 --- a/Core/FieldType/ContentTypeList/Type.php +++ b/Core/FieldType/ContentTypeList/Type.php @@ -9,6 +9,8 @@ use eZ\Publish\Core\FieldType\FieldType; use eZ\Publish\Core\FieldType\Value as BaseValue; use eZ\Publish\SPI\FieldType\Value as SPIValue; +use function is_array; +use function is_string; final class Type extends FieldType { diff --git a/Core/FieldType/ContentTypeList/Value.php b/Core/FieldType/ContentTypeList/Value.php index fe06229..2f46179 100644 --- a/Core/FieldType/ContentTypeList/Value.php +++ b/Core/FieldType/ContentTypeList/Value.php @@ -5,6 +5,7 @@ namespace Netgen\Bundle\ContentTypeListBundle\Core\FieldType\ContentTypeList; use eZ\Publish\Core\FieldType\Value as BaseValue; +use function implode; final class Value extends BaseValue { diff --git a/Core/Persistence/Legacy/Content/FieldValue/Converter/ContentTypeListConverter.php b/Core/Persistence/Legacy/Content/FieldValue/Converter/ContentTypeListConverter.php index c2af3bf..a34ca05 100644 --- a/Core/Persistence/Legacy/Content/FieldValue/Converter/ContentTypeListConverter.php +++ b/Core/Persistence/Legacy/Content/FieldValue/Converter/ContentTypeListConverter.php @@ -9,6 +9,9 @@ use eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue; use eZ\Publish\SPI\Persistence\Content\FieldValue; use eZ\Publish\SPI\Persistence\Content\Type\FieldDefinition; +use function explode; +use function implode; +use function trim; final class ContentTypeListConverter implements Converter { diff --git a/DependencyInjection/NetgenContentTypeListExtension.php b/DependencyInjection/NetgenContentTypeListExtension.php index d1f2235..cb70572 100644 --- a/DependencyInjection/NetgenContentTypeListExtension.php +++ b/DependencyInjection/NetgenContentTypeListExtension.php @@ -11,6 +11,7 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\Yaml\Yaml; +use function file_get_contents; final class NetgenContentTypeListExtension extends Extension implements PrependExtensionInterface { diff --git a/Tests/Core/FieldType/ContentTypeList/TypeTest.php b/Tests/Core/FieldType/ContentTypeList/TypeTest.php index 68f9365..547ab44 100644 --- a/Tests/Core/FieldType/ContentTypeList/TypeTest.php +++ b/Tests/Core/FieldType/ContentTypeList/TypeTest.php @@ -10,6 +10,7 @@ use Netgen\Bundle\ContentTypeListBundle\Core\FieldType\ContentTypeList\Type; use Netgen\Bundle\ContentTypeListBundle\Core\FieldType\ContentTypeList\Value; use PHPUnit\Framework\TestCase; +use function implode; final class TypeTest extends TestCase {