Skip to content

Commit 19a27d0

Browse files
authored
Merge pull request #98 from sherlockode/feature/sf-4-sf-5-compatibility
Symfony 4.4 & Symfony 5.0 compatibility
2 parents dd21304 + fcaa0b2 commit 19a27d0

25 files changed

+181
-160
lines changed

DependencyInjection/Configuration.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ class Configuration implements ConfigurationInterface
2020
/**
2121
* {@inheritdoc}
2222
*/
23-
public function getConfigTreeBuilder()
23+
public function getConfigTreeBuilder(): TreeBuilder
2424
{
2525
$tb = new TreeBuilder('sherlockode_advanced_form');
26-
// BC layer for symfony/config < 4.2
27-
$root = \method_exists($tb, 'getRootNode') ? $tb->getRootNode() : $tb->root('sherlockode_advanced_form');
26+
$root = $tb->getRootNode();
2827

2928
$this->addStorageSection($root);
3029
$this->addUploaderSection($root);

DependencyInjection/SherlockodeAdvancedFormExtension.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Symfony\Component\Config\FileLocator;
88
use Symfony\Component\DependencyInjection\ContainerBuilder;
99
use Symfony\Component\DependencyInjection\Definition;
10-
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
10+
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1111
use Symfony\Component\DependencyInjection\Reference;
1212
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1313

@@ -76,12 +76,12 @@ private function getStorageDefinition($name, $config)
7676
*/
7777
private function loadServices(ContainerBuilder $container)
7878
{
79-
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
79+
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
8080
$toBeLoaded = [
81-
'command.yml',
82-
'controller.yml',
83-
'form.yml',
84-
'manager.yml',
81+
'command.xml',
82+
'controller.xml',
83+
'form.xml',
84+
'manager.xml',
8585
];
8686
foreach ($toBeLoaded as $file) {
8787
$loader->load($file);

Form/DataTransformer/TemporaryUploadFileTransformer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public function reverseTransform($data)
6565
$data->getFilename(),
6666
null,
6767
null,
68-
null,
6968
true
7069
);
7170
}

Form/Type/DependentEntityType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(
6161
$this->router = $router;
6262
}
6363

64-
public function getParent()
64+
public function getParent(): ?string
6565
{
6666
return EntityType::class;
6767
}

Form/Type/FileCollectionType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function configureOptions(OptionsResolver $resolver)
5959
$resolver->setRequired('mapping');
6060
}
6161

62-
public function getParent()
62+
public function getParent(): ?string
6363
{
6464
return CollectionType::class;
6565
}

Form/Type/FileType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
168168
/**
169169
* {@inheritdoc}
170170
*/
171-
public function getBlockPrefix()
171+
public function getBlockPrefix(): string
172172
{
173173
return 'afb_file';
174174
}

Form/Type/RemoveFileType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
3838
/**
3939
* @return string
4040
*/
41-
public function getBlockPrefix()
41+
public function getBlockPrefix(): string
4242
{
4343
return 'afb_remove_file';
4444
}

Form/Type/TemporaryUploadedFileType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function configureOptions(OptionsResolver $resolver)
7676
/**
7777
* @return string
7878
*/
79-
public function getBlockPrefix()
79+
public function getBlockPrefix(): string
8080
{
8181
return 'afb_temporary_uploaded_file';
8282
}

Form/Type/UploadFileType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function configureOptions(OptionsResolver $optionsResolver)
115115
/**
116116
* @return string
117117
*/
118-
public function getBlockPrefix()
118+
public function getBlockPrefix(): string
119119
{
120120
return 'afb_upload_file';
121121
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Import the routing in `config/routes.yml`
3737

3838
```yaml
3939
sherlockode_advanced_form:
40-
resource: "@SherlockodeAdvancedFormBundle/Resources/config/routing/all.yml"
40+
resource: "@SherlockodeAdvancedFormBundle/Resources/config/routing/all.xml"
4141
```
4242
4343
### Step 4: Publish assets

0 commit comments

Comments
 (0)