Skip to content

Commit 81ea854

Browse files
committed
Fixed CS
1 parent 6e685b6 commit 81ea854

File tree

13 files changed

+107
-110
lines changed

13 files changed

+107
-110
lines changed

.php_cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ return PhpCsFixer\Config::create()
4242
'ternary_to_null_coalescing' => true,
4343
'visibility_required' => ['elements' => ['property', 'method', 'const']],
4444
'yoda_style' => false,
45+
'single_blank_line_at_eof' => true,
4546
])
4647
->setFinder(
4748
PhpCsFixer\Finder::create()

bundle/Core/FieldType/EnhancedBinaryFile/FormMapper.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Netgen\Bundle\EnhancedBinaryFileBundle\Core\FieldType\EnhancedBinaryFile;
44

55
use EzSystems\RepositoryForms\Data\FieldDefinitionData;
6-
use EzSystems\RepositoryForms\FieldType\FieldDefinitionFormMapperInterface;
76
use EzSystems\RepositoryForms\FieldType\Mapper\BinaryFileFormMapper;
87
use Symfony\Component\Form\Extension\Core\Type\TextType;
98
use Symfony\Component\Form\FormInterface;

bundle/Core/FieldType/EnhancedBinaryFile/Type.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ class Type extends BinaryFileType
2424
*
2525
* @var array
2626
*/
27-
protected $settingsSchema = array(
28-
'allowedTypes' => array(
27+
protected $settingsSchema = [
28+
'allowedTypes' => [
2929
'type' => 'string',
3030
'default' => null,
31-
),
32-
'mimeTypesMessage' => array(
31+
],
32+
'mimeTypesMessage' => [
3333
'type' => 'string',
34-
'default' => null
35-
)
36-
);
34+
'default' => null,
35+
],
36+
];
3737

3838
/**
3939
* @var \eZ\Publish\SPI\IO\MimeTypeDetector
@@ -89,7 +89,7 @@ public function getFieldTypeIdentifier()
8989
*/
9090
public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue)
9191
{
92-
$errors = array();
92+
$errors = [];
9393

9494
if ($this->isEmptyValue($fieldValue)) {
9595
return $errors;
@@ -110,15 +110,15 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue)
110110
}
111111
}
112112

113-
return array(
113+
return [
114114
new ValidationError(
115115
'This mimeType is not allowed %mimeType%.',
116116
'These mimeTypes are not allowed %mimeType%.',
117-
array(
117+
[
118118
'mimeType' => $mimeType,
119-
)
119+
]
120120
),
121-
);
121+
];
122122
}
123123

124124
/**
@@ -133,7 +133,7 @@ public function validate(FieldDefinition $fieldDefinition, SPIValue $fieldValue)
133133
*/
134134
public function validateFieldSettings($fieldSettings)
135135
{
136-
$validationErrors = array();
136+
$validationErrors = [];
137137

138138
if (!is_array($fieldSettings)) {
139139
$validationErrors[] = new ValidationError('Field settings must be in form of an array');
@@ -151,9 +151,9 @@ public function validateFieldSettings($fieldSettings)
151151
$validationErrors[] = new ValidationError(
152152
"Setting '%setting%' is unknown",
153153
null,
154-
array(
154+
[
155155
'setting' => $name,
156-
)
156+
]
157157
);
158158
break;
159159
}

bundle/Core/Persistence/Legacy/Content/FieldValue/Converter/Converter.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,19 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField
6060
public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef)
6161
{
6262
$fieldDef->fieldTypeConstraints = new FieldTypeConstraints(
63-
array(
64-
'validators' => array(
65-
'FileSizeValidator' => array(
63+
[
64+
'validators' => [
65+
'FileSizeValidator' => [
6666
'maxFileSize' => (0 !== $storageDef->dataInt1
6767
? $storageDef->dataInt1
6868
: null),
69-
),
70-
),
71-
'fieldSettings' => new FieldSettings(array(
69+
],
70+
],
71+
'fieldSettings' => new FieldSettings([
7272
'allowedTypes' => $storageDef->dataText1,
7373
'mimeTypesMessage' => $storageDef->dataText2,
74-
)),
75-
)
74+
]),
75+
]
7676
);
7777
}
7878

bundle/DependencyInjection/NetgenEnhancedBinaryFileExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ class NetgenEnhancedBinaryFileExtension extends Extension implements PrependExte
1414
{
1515
/**
1616
* Preprend ezpublish configuration to make the field templates
17-
* visibile to the admin template engine
17+
* visibile to the admin template engine.
1818
*
1919
* @param ContainerBuilder $container
2020
*/
21-
public function prepend( ContainerBuilder $container )
21+
public function prepend(ContainerBuilder $container)
2222
{
23-
$fileName = "ez_field_templates.yml";
23+
$fileName = 'ez_field_templates.yml';
2424
$configFile = __DIR__ . '/../Resources/config/' . $fileName;
2525
$config = Yaml::parse(file_get_contents($configFile));
2626

27-
$container->prependExtensionConfig("ezpublish", $config);
27+
$container->prependExtensionConfig('ezpublish', $config);
2828
$container->addResource(new FileResource($configFile));
2929
}
3030

bundle/FieldHandler/EnhancedBinaryFileHandler.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Netgen\Bundle\EnhancedBinaryFileBundle\FieldHandler;
44

5+
use DOMDocument;
56
use eZ\Publish\API\Repository\Values\ContentType\FieldDefinition;
67
use eZ\Publish\Core\FieldType\Value;
7-
use Netgen\Bundle\EnhancedBinaryFileBundle\Core\FieldType\EnhancedBinaryFile\Value as EnhancedBinaryFileValue;
88
use eZ\Publish\Core\IO\IOServiceInterface;
9+
use Netgen\Bundle\EnhancedBinaryFileBundle\Core\FieldType\EnhancedBinaryFile\Value as EnhancedBinaryFileValue;
910
use Netgen\Bundle\InformationCollectionBundle\FieldHandler\Custom\CustomLegacyFieldHandlerInterface;
1011
use Netgen\Bundle\InformationCollectionBundle\Value\LegacyData;
11-
use DOMDocument;
1212

1313
class EnhancedBinaryFileHandler implements CustomLegacyFieldHandlerInterface
1414
{
@@ -28,23 +28,23 @@ public function __construct(IOServiceInterface $IOService)
2828
}
2929

3030
/**
31-
* @inheritDoc
31+
* {@inheritdoc}
3232
*/
3333
public function supports(Value $value)
3434
{
3535
return $value instanceof EnhancedBinaryFileValue;
3636
}
3737

3838
/**
39-
* @inheritDoc
39+
* {@inheritdoc}
4040
*/
4141
public function toString(Value $value, FieldDefinition $fieldDefinition)
4242
{
43-
return (string)$value;
43+
return (string) $value;
4444
}
4545

4646
/**
47-
* @inheritDoc
47+
* {@inheritdoc}
4848
*/
4949
public function getLegacyValue(Value $value, FieldDefinition $fieldDefinition)
5050
{
@@ -58,7 +58,7 @@ public function getLegacyValue(Value $value, FieldDefinition $fieldDefinition)
5858

5959
/**
6060
* Create XML doc string
61-
* and save file to filesystem
61+
* and save file to filesystem.
6262
*
6363
* @param EnhancedBinaryFileValue $value
6464
* @param FieldDefinition $fieldDefinition
@@ -69,19 +69,19 @@ protected function store(EnhancedBinaryFileValue $value, FieldDefinition $fieldD
6969
{
7070
$binaryFile = $this->storeBinaryFileToPath($value);
7171

72-
$doc = new DOMDocument( '1.0', 'utf-8' );
73-
$root = $doc->createElement( 'binaryfile-info' );
74-
$binaryFileList = $doc->createElement( 'binaryfile-attributes' );
72+
$doc = new DOMDocument('1.0', 'utf-8');
73+
$root = $doc->createElement('binaryfile-info');
74+
$binaryFileList = $doc->createElement('binaryfile-attributes');
7575

7676
$fileInfo = [
7777
'Filename' => htmlentities($binaryFile->uri),
7878
'OriginalFilename' => htmlentities($value->fileName),
7979
'Size' => $value->fileSize,
8080
];
8181

82-
foreach($fileInfo as $key => $binaryFileItem) {
82+
foreach ($fileInfo as $key => $binaryFileItem) {
8383
$binaryFileElement = $doc->createElement($key, $binaryFileItem);
84-
$binaryFileList->appendChild( $binaryFileElement );
84+
$binaryFileList->appendChild($binaryFileElement);
8585
}
8686

8787
$root->appendChild($binaryFileList);
@@ -91,7 +91,7 @@ protected function store(EnhancedBinaryFileValue $value, FieldDefinition $fieldD
9191
}
9292

9393
/**
94-
* Stores file to filesystem
94+
* Stores file to filesystem.
9595
*
9696
* @param EnhancedBinaryFileValue $value
9797
* @param string $storagePrefix
@@ -110,5 +110,3 @@ protected function storeBinaryFileToPath(EnhancedBinaryFileValue $value, $storag
110110
return $binaryFile;
111111
}
112112
}
113-
114-

bundle/Form/FieldTypeHandler/EnhancedFile.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use eZ\Publish\API\Repository\Values\ContentType\FieldDefinition;
77
use eZ\Publish\Core\MVC\ConfigResolverInterface;
88
use eZ\Publish\SPI\FieldType\Value;
9-
use Netgen\Bundle\EzFormsBundle\Form\FieldTypeHandler;
109
use Netgen\Bundle\EnhancedBinaryFileBundle\Core\FieldType\EnhancedBinaryFile\Value as EnhancedFileValue;
10+
use Netgen\Bundle\EzFormsBundle\Form\FieldTypeHandler;
1111
use Symfony\Component\Form\Extension\Core\Type\FileType;
1212
use Symfony\Component\Form\FormBuilderInterface;
1313
use Symfony\Component\HttpFoundation\File\UploadedFile;
@@ -71,16 +71,16 @@ protected function buildFieldForm(
7171
$mimeTypesMessage = $fieldDefinition->fieldSettings['mimeTypesMessage'];
7272

7373
if (null !== $maxFileSize || !empty($allowedExtensions)) {
74-
$constraints = array();
74+
$constraints = [];
7575

7676
if (null !== $maxFileSize && !empty($maxFileSize)) {
77-
$constraints['maxSize'] = strval($maxFileSize) . "M";
77+
$constraints['maxSize'] = (string) $maxFileSize . 'M';
7878
}
7979

8080
if (!empty($allowedExtensions)) {
8181
$allowedExtensions = explode('|', $allowedExtensions);
8282

83-
$allowedMimeTypes = array();
83+
$allowedMimeTypes = [];
8484

8585
foreach ($allowedExtensions as $allowedExtension) {
8686
if ($this->configResolver->hasParameter("{$allowedExtension}.Types", 'mime')) {
@@ -90,8 +90,7 @@ protected function buildFieldForm(
9090
$constraints['mimeTypes'] = $allowedMimeTypes;
9191
}
9292

93-
if (!empty($mimeTypesMessage))
94-
{
93+
if (!empty($mimeTypesMessage)) {
9594
$constraints['mimeTypesMessage'] = $mimeTypesMessage;
9695
}
9796

0 commit comments

Comments
 (0)