Skip to content

Commit 511d1ff

Browse files
authored
Merge pull request #285 from symfony-cmf/sf6
allow installation with symfony 6
2 parents 43c99e0 + 64234eb commit 511d1ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+457
-960
lines changed

.github/workflows/test-application.yaml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,24 @@ jobs:
1414
name: 'PHP ${{ matrix.php-version }}, Symfony ${{ matrix.symfony-version }} ${{ matrix.dependencies}}'
1515
runs-on: ubuntu-20.04
1616
env:
17-
SYMFONY_PHPUNIT_VERSION: 8
17+
SYMFONY_PHPUNIT_VERSION: 9
1818
SYMFONY_DEPRECATIONS_HELPER: "/.*each.*/"
1919
SYMFONY_REQUIRE: ${{ matrix.symfony-version }}
2020

2121
strategy:
2222
fail-fast: false
2323
matrix:
2424
include:
25-
- php-version: '7.4'
25+
- php-version: '8.1'
2626
dependencies: 'lowest'
27-
- php-version: '7.4'
28-
symfony-version: 4.4.*
29-
test-installation: true
30-
- php-version: '7.4'
31-
symfony-version: 5.0.*
32-
test-installation: true
33-
- php-version: '8.0'
34-
symfony-version: 5.1.*
35-
test-installation: true
27+
- php-version: '8.1'
28+
- php-version: '8.2'
29+
- php-version: '8.3'
30+
symfony-version: 6.4.*
3631

3732
steps:
3833
- name: Checkout project
39-
uses: actions/checkout@v2
34+
uses: actions/checkout@v4
4035

4136
- name: Install and configure PHP
4237
uses: shivammathur/setup-php@v2
@@ -45,17 +40,15 @@ jobs:
4540
tools: 'composer:v2'
4641

4742
- name: Install Symfony Flex
48-
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
43+
run: |
44+
composer global require --no-progress --no-scripts --no-plugins symfony/flex
45+
composer global config --no-plugins allow-plugins.symfony/flex true
4946
5047
- name: Install dependencies with Composer
51-
uses: ramsey/composer-install@v1
48+
uses: ramsey/composer-install@v2
5249
with:
5350
dependency-versions: ${{ matrix.dependencies }}
5451
composer-options: --prefer-dist
5552

5653
- name: Execute test cases
5754
run: make test
58-
59-
- name: Test installation
60-
if: ${{ matrix.test-installation == true }}
61-
run: make test

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Changelog
44
3.0.0 (unreleased)
55
-----
66

7+
* Support Symfony 6
8+
* Use DateTimeInterface instead of DateTime.
79
* Adjust to doctrine and twig BC breaks. If you extended classes or customized services, check for old `Twig_*` classes or `Doctrine\Common\Persistence` namespace.
810
* Drop support for old Symfony versions
911
* Drop support for old PHP versions
@@ -41,7 +43,7 @@ Released 2.0.0
4143
2.0.0-RC1
4244
---------
4345

44-
* **2017-01-17**: [BC BREAK] Removed DoctrineOrmMappingsPass - all active Doctrine versions contain the mapping pass. Use `Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass` instead.
46+
* **2017-01-17**: [BC BREAK] Removed DoctrineOrmMappingsPass - all active Doctrine versions contain the mapping pass. Use `Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass` instead.
4547
* **2017-01-13**: [BC BREAK] Removed the `Slugifier` classes and the
4648
dependency on `symfony-cmf/slugifier-api`.
4749
* **2016-12-03**: [BC BREAK] Moved sonata admin related classes and

composer.json

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,37 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^7.4 || ^8.0",
18-
"symfony/framework-bundle": "^4.4 || ^5.0",
19-
"symfony/security-core": "^4.4 || ^5.0"
17+
"php": "^8.1",
18+
"symfony/framework-bundle": "^6.4",
19+
"symfony/security-core": "^6.4"
2020
},
2121
"require-dev": {
22-
"jackalope/jackalope-doctrine-dbal": "^1.3",
23-
"symfony/security-bundle": "^4.4 || ^5.0",
24-
"symfony/phpunit-bridge": "^4.4.34 || ^5.0",
22+
"ext-dom": "*",
23+
"jackalope/jackalope-doctrine-dbal": "^1.12 || ^2.0",
2524
"mockery/mockery": "^1.4.1",
26-
"symfony-cmf/routing-bundle": "^2.1.0",
27-
"symfony-cmf/testing": "^4.0.0",
28-
"doctrine/dbal": "^2.5",
25+
"symfony-cmf/routing-bundle": "3.1.0",
26+
"symfony-cmf/testing": "5.0.2",
27+
"doctrine/dbal": "^3.8.4 || ^4.0",
2928
"doctrine/doctrine-bundle": "^2.0",
30-
"doctrine/phpcr-odm": "^1.4|^2.0 ",
31-
"doctrine/phpcr-bundle": "^2.3.0",
32-
"symfony/browser-kit": "^4.4 || ^5.0",
33-
"symfony/form": "^4.4 || ^5.0",
34-
"symfony/monolog-bridge": "^4.4 || ^5.0",
29+
"doctrine/phpcr-bundle": "^3.0",
30+
"doctrine/phpcr-odm": "^1.4 || ^2.0 ",
31+
"symfony/browser-kit": "^6.4",
32+
"symfony/form": "^6.4",
33+
"symfony/monolog-bridge": "^6.4",
3534
"symfony/monolog-bundle": "^3.0",
36-
"symfony/templating": "^4.4 || ^5.0",
37-
"symfony/translation": "^4.4 || ^5.0",
38-
"symfony/twig-bundle": "^4.4 || ^5.0",
39-
"symfony/validator": "^4.4 || ^5.0",
40-
"symfony/yaml": "^4.4 || ^5.0",
41-
"symfony/asset": "^4.4 || ^5.0"
35+
"symfony/phpunit-bridge": "^7.0.3",
36+
"symfony/security-bundle": "^6.4",
37+
"symfony/templating": "^6.4",
38+
"symfony/translation": "^6.4",
39+
"symfony/twig-bundle": "^6.4",
40+
"symfony/validator": "^6.4",
41+
"symfony/yaml": "^6.4",
42+
"symfony/asset": "^6.4"
4243
},
4344
"suggest": {
44-
"symfony/twig-bundle": "To get access to the CMF twig extension (^4.4 || ^5.0)",
45-
"doctrine/phpcr-bundle": "To be able to use the CMF twig extension (^1.0)",
46-
"doctrine/phpcr-odm": "To be able to use the CMF twig extension (^1.0)",
47-
"symfony/security-bundle": "To be able to use the publish workflow system (^4.4 || ^5.0)",
48-
"symfony-cmf/routing": "To be able to use the CMF twig extension functions cmf_prev_linkable/cmf_next_linkable (^2.1)",
49-
"symfony-cmf/routing-bundle": "To be able to enable the publish_workflow_listener (^2.1)",
45+
"symfony/twig-bundle": "To get access to the CMF twig extension",
46+
"symfony/security-bundle": "To be able to use the publish workflow system",
47+
"symfony-cmf/routing-bundle": "For the wtig extension functions cmf_prev_linkable/cmf_next_linkable and the publish_workflow_listener",
5048
"symfony-cmf/sonata-admin-integration-bundle": "To provide an admin interface for the PHPCR ODM documents."
5149
},
5250
"autoload": {
@@ -63,5 +61,6 @@
6361
"branch-alias": {
6462
"dev-master": "3.x-dev"
6563
}
66-
}
64+
},
65+
"minimum-stability": "dev"
6766
}

src/CmfCoreBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class CmfCoreBundle extends Bundle
1919
{
20-
public function build(ContainerBuilder $container)
20+
public function build(ContainerBuilder $container): void
2121
{
2222
$container->addCompilerPass(new AddPublishedVotersPass());
2323
}

src/DependencyInjection/CmfCoreExtension.php

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CmfCoreExtension extends Extension implements PrependExtensionInterface
2929
*
3030
* {@inheritdoc}
3131
*/
32-
public function prepend(ContainerBuilder $container)
32+
public function prepend(ContainerBuilder $container): void
3333
{
3434
// process the configuration of CmfCoreExtension
3535
$configs = $container->getExtensionConfig($this->getAlias());
@@ -243,10 +243,7 @@ public function prepend(ContainerBuilder $container)
243243
}
244244
}
245245

246-
/**
247-
* {@inheritdoc}
248-
*/
249-
public function load(array $configs, ContainerBuilder $container)
246+
public function load(array $configs, ContainerBuilder $container): void
250247
{
251248
$config = $this->processConfiguration(new Configuration(), $configs);
252249

@@ -283,7 +280,7 @@ public function load(array $configs, ContainerBuilder $container)
283280
/**
284281
* Setup the cmf_core_checkbox_url_label form type if the routing bundle is there.
285282
*/
286-
public function setupFormTypes(ContainerBuilder $container, LoaderInterface $loader)
283+
public function setupFormTypes(ContainerBuilder $container, LoaderInterface $loader): void
287284
{
288285
$bundles = $container->getParameter('kernel.bundles');
289286
if (isset($bundles['CmfRoutingBundle'])) {
@@ -302,7 +299,7 @@ public function setupFormTypes(ContainerBuilder $container, LoaderInterface $loa
302299
*
303300
* @throws InvalidConfigurationException
304301
*/
305-
private function loadPublishWorkflow($config, XmlFileLoader $loader, ContainerBuilder $container)
302+
private function loadPublishWorkflow($config, XmlFileLoader $loader, ContainerBuilder $container): void
306303
{
307304
$bundles = $container->getParameter('kernel.bundles');
308305

@@ -336,18 +333,12 @@ private function loadPublishWorkflow($config, XmlFileLoader $loader, ContainerBu
336333
}
337334
}
338335

339-
/**
340-
* {@inheritdoc}
341-
*/
342-
public function getXsdValidationBasePath()
336+
public function getXsdValidationBasePath(): bool|string
343337
{
344338
return __DIR__.'/../Resources/config/schema';
345339
}
346340

347-
/**
348-
* {@inheritdoc}
349-
*/
350-
public function getNamespace()
341+
public function getNamespace(): string
351342
{
352343
return 'http://cmf.symfony.com/schema/dic/core';
353344
}

src/DependencyInjection/Compiler/AddPublishedVotersPass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AddPublishedVotersPass implements CompilerPassInterface
3131
*
3232
* {@inheritdoc}
3333
*/
34-
public function process(ContainerBuilder $container)
34+
public function process(ContainerBuilder $container): void
3535
{
3636
if (!$container->hasDefinition('cmf_core.publish_workflow.access_decision_manager')) {
3737
return;

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616

1717
class Configuration implements ConfigurationInterface
1818
{
19-
/**
20-
* {@inheritdoc}
21-
*/
22-
public function getConfigTreeBuilder()
19+
public function getConfigTreeBuilder(): TreeBuilder
2320
{
2421
$treeBuilder = new TreeBuilder('cmf_core');
2522
$rootNode = $treeBuilder->getRootNode();

src/Doctrine/Phpcr/NonTranslatableMetadataListener.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
*/
2424
class NonTranslatableMetadataListener implements EventSubscriber
2525
{
26-
/**
27-
* @return array
28-
*/
29-
public function getSubscribedEvents()
26+
public function getSubscribedEvents(): array
3027
{
3128
return [
3229
'loadClassMetadata',
@@ -37,9 +34,9 @@ public function getSubscribedEvents()
3734
* Handle the load class metadata event: remove translated attribute from
3835
* fields and remove the locale mapping if present.
3936
*/
40-
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
37+
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
4138
{
42-
/** @var $meta ClassMetadata */
39+
/** @var ClassMetadata $meta */
4340
$meta = $eventArgs->getClassMetadata();
4441

4542
if (!$meta->translator) {

src/Doctrine/Phpcr/TranslatableMetadataListener.php

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,12 @@
2323
*/
2424
class TranslatableMetadataListener implements EventSubscriber
2525
{
26-
/**
27-
* @var string
28-
*/
29-
private $translationStrategy;
30-
31-
/**
32-
* @param string $translationStrategy
33-
*/
34-
public function __construct($translationStrategy)
35-
{
36-
$this->translationStrategy = $translationStrategy;
26+
public function __construct(
27+
private string $translationStrategy
28+
) {
3729
}
3830

39-
/**
40-
* @return array
41-
*/
42-
public function getSubscribedEvents()
31+
public function getSubscribedEvents(): array
4332
{
4433
return [
4534
'loadClassMetadata',
@@ -49,9 +38,9 @@ public function getSubscribedEvents()
4938
/**
5039
* Handle the load class metadata event: set the translation strategy.
5140
*/
52-
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
41+
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
5342
{
54-
/** @var $meta ClassMetadata */
43+
/** @var ClassMetadata $meta */
5544
$meta = $eventArgs->getClassMetadata();
5645

5746
if ($meta->getReflectionClass()->implementsInterface(TranslatableInterface::class)) {

src/EventListener/PublishWorkflowListener.php

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,47 +26,29 @@
2626
*/
2727
class PublishWorkflowListener implements EventSubscriberInterface
2828
{
29-
/**
30-
* @var PublishWorkflowChecker
31-
*/
32-
protected $publishWorkflowChecker;
33-
34-
/**
35-
* The attribute to check with the workflow checker, typically VIEW or VIEW_ANONYMOUS.
36-
*
37-
* @var string
38-
*/
39-
private $publishWorkflowPermission;
40-
41-
/**
42-
* @param string $attribute the attribute name to check
43-
*/
44-
public function __construct(PublishWorkflowChecker $publishWorkflowChecker, $attribute = PublishWorkflowChecker::VIEW_ATTRIBUTE)
29+
public function __construct(
30+
private PublishWorkflowChecker $publishWorkflowChecker,
31+
/**
32+
* The attribute to check with the workflow checker, typically VIEW or VIEW_ANONYMOUS.
33+
*/
34+
private string $publishWorkflowPermission = PublishWorkflowChecker::VIEW_ATTRIBUTE)
4535
{
46-
$this->publishWorkflowChecker = $publishWorkflowChecker;
47-
$this->publishWorkflowPermission = $attribute;
4836
}
4937

50-
/**
51-
* @return string
52-
*/
53-
public function getPublishWorkflowPermission()
38+
public function getPublishWorkflowPermission(): string
5439
{
5540
return $this->publishWorkflowPermission;
5641
}
5742

58-
/**
59-
* @param string $attribute specify what permission to check, typically VIEW or VIEW_ANONYMOUS
60-
*/
61-
public function setPublishWorkflowPermission($attribute)
43+
public function setPublishWorkflowPermission(string $attribute): void
6244
{
6345
$this->publishWorkflowPermission = $attribute;
6446
}
6547

6648
/**
6749
* Handling the request event.
6850
*/
69-
public function onKernelRequest(RequestEvent $event)
51+
public function onKernelRequest(RequestEvent $event): void
7052
{
7153
$request = $event->getRequest();
7254

@@ -83,10 +65,8 @@ public function onKernelRequest(RequestEvent $event)
8365

8466
/**
8567
* We are only interested in request events.
86-
*
87-
* @return array
8868
*/
89-
public static function getSubscribedEvents()
69+
public static function getSubscribedEvents(): array
9070
{
9171
return [
9272
KernelEvents::REQUEST => [['onKernelRequest', 1]],

0 commit comments

Comments
 (0)