Skip to content

Commit 2e55fb0

Browse files
committed
Add Symfony 5.x support with PHP 7.4+ (version 5.0.x)
This commit adds support for Symfony 5.x as a transition version. Requirements: - PHP ^7.4 || ^8.0 - Symfony ^5.0 - doctrine/doctrine-bundle ^2.2 - PHP CS Fixer 2.19 - PHPUnit ^8.5 || ^9.5 Changes: - Update all Symfony dependencies to ^5.0 - Update FOSRestBundle to ^2.8 || ^3.0 - Update JMS Serializer Bundle to support versions 2.0 through 5.0 - Add Twig 2.0 || 3.0 support - Configure Composer allow-plugins for symfony/flex Symfony 5 Compatibility: - Refactor controllers to use dependency injection instead of service location - Update EventDispatcher to new dispatch() signature - Update security configuration (remove anonymous, use password_hashers) - Implement Bundle::getPath() for resource discovery - Update test infrastructure for PHPUnit 9 compatibility - Remove deprecated Doctrine AnnotationRegistry usage CI Configuration: - Test matrix: PHP 7.4/8.0/8.1 with Symfony 5.0 (lowest) and 5.4 LTS (highest) - Functional API tests re-enabled and working
1 parent eb5db45 commit 2e55fb0

37 files changed

+313
-230
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ jobs:
3535
include:
3636
- php: '7.4'
3737
dependencies: 'lowest'
38-
symfony_require: '3.4.*'
38+
symfony_require: '5.0.*'
3939
- php: '7.4'
4040
dependencies: 'highest'
41-
symfony_require: '4.4.*'
41+
symfony_require: '5.4.*'
4242
- php: '8.0'
4343
dependencies: 'highest'
44-
symfony_require: '4.4.*'
44+
symfony_require: '5.4.*'
4545
fail-fast: false
4646
steps:
4747
- name: Checkout
@@ -57,6 +57,9 @@ jobs:
5757
- name: Globally install symfony/flex
5858
run: composer global require --no-progress --no-scripts --no-plugins symfony/flex
5959

60+
- name: Allow Symfony Flex plugin
61+
run: composer global config --no-plugins allow-plugins.symfony/flex true
62+
6063
- name: Install Composer dependencies (${{ matrix.dependencies }})
6164
uses: ramsey/composer-install@v1
6265
with:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ FOSCommentBundle
33

44
The FOSCommentBundle adds support for a comment system in Symfony. Features include:
55

6-
- Supports Symfony 3.4, 4.4
6+
- Requires **PHP 7.2.5+** and supports **Symfony 5.0+** (5.x including 5.4 LTS)
77
- Manages trees of comments
88
- Can include comment threads in any page
99
- Compatible with any persistence backend. Doctrine2 mongodb-odm and ORM are implemented.
1010
- Configurable sorting of the comment tree
1111
- REST api (via FOSRestBundle)
1212
- Extensible through events fired during the comment lifecycle
1313
- Optional use of Symfony Acl to protect comments
14-
- Optional integration with FOS\UserBundle
15-
- Optional integration with `Akismet`
14+
- Optional integration with FOSUserBundle
15+
- Optional integration with Akismet
1616
- Optional markup parser support (eg HtmlPurifier or php-sundown)
1717

1818
[![Build Status](https://travis-ci.org/FriendsOfSymfony/FOSCommentBundle.svg?branch=master)](https://travis-ci.org/FriendsOfSymfony/FOSCommentBundle) [![Total Downloads](https://poser.pugx.org/friendsofsymfony/comment-bundle/downloads.svg)](https://packagist.org/packages/friendsofsymfony/comment-bundle) [![Latest Stable Version](https://poser.pugx.org/friendsofsymfony/comment-bundle/v/stable.svg)](https://packagist.org/packages/friendsofsymfony/comment-bundle)

Resources

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/Resources

UPDATE.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
5.0.x (Symfony 5.0+ Support - Transition Version):
2+
3+
* **[BC BREAK]** The bundle now requires PHP 7.2.5+ and Symfony 5.0+.
4+
Support for Symfony 4.4 and earlier versions has been dropped.
5+
* The bundle now supports Symfony 5.0+ (5.0, 5.1, 5.2, 5.3, 5.4)
6+
* This is a transition version. Use version 6.0+ for Symfony 6.x and 7.x support.
7+
* Dependencies have been updated:
8+
- PHP: >=7.2.5
9+
- Symfony: ^5.0 (all 5.x versions including 5.4 LTS)
10+
- FOSRestBundle: ^2.8 or ^3.0
11+
- JMSSerializerBundle: ^2.0, ^3.0, ^4.0, or ^5.0
12+
- Twig: ^2.0 or ^3.0
13+
- PHPUnit: ^8.5 or ^9.5 (for development)
14+
- PHP CS Fixer: ^3.0 (for development)
15+
* **[BC BREAK]** The `ThreadController` now uses constructor dependency injection
16+
instead of container service location. This is required for Symfony 6+
17+
compatibility. If you have extended this controller, you will need to update
18+
your code to inject the required services in your constructor.
19+
* Form type tags in service configuration no longer use the `alias` or
20+
`extended-type` attributes as they are deprecated in Symfony 5+. The form
21+
types now rely on their `getBlockPrefix()` method for identification.
22+
* PHPUnit configuration has been updated to PHPUnit 9.5+ format.
23+
* Test suite has been updated with proper type hints for PHPUnit 9 compatibility.
24+
* All services are now properly configured for autowiring and autoconfiguration
25+
in modern Symfony applications.
26+
127
2.0.x:
228

329
* The dependencies to FOS RestBundle have changed and as a result, you need to ensure that you have defined

composer.json

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@
2323
"issues": "https://github.com/FriendsOfSymfony/FOSCommentBundle/issues"
2424
},
2525
"require": {
26-
"php": "^7.4 || ^8.0",
27-
"friendsofsymfony/rest-bundle": "~2.8",
28-
"jms/serializer-bundle": "~2.0|~3.0",
29-
"symfony/framework-bundle": "~3.4|^4.3",
30-
"symfony/asset": "~3.4|^4.3",
31-
"symfony/dependency-injection": "~3.4|^4.3",
32-
"symfony/routing": "~3.4|^4.3",
33-
"symfony/security-bundle": "~3.4|^4.3",
34-
"symfony/yaml": "~3.4|^4.3",
35-
"symfony/form": "~3.4|^4.3",
36-
"symfony/validator": "~3.4|^4.3",
37-
"symfony/twig-bundle": "~3.4|^4.3",
38-
"symfony/twig-bridge": "~3.4|^4.3",
39-
"twig/twig": "~2.0|~3.0",
40-
"phpoption/phpoption": "~1.1",
41-
"doctrine/annotations": "~1.0"
26+
"php": "^7.4 || ~8.0.0",
27+
"friendsofsymfony/rest-bundle": "^2.8 || ^3.0",
28+
"jms/serializer-bundle": "^2.0 || ^3.0 || ^4.0 || ^5.0",
29+
"symfony/framework-bundle": "^5.0",
30+
"symfony/asset": "^5.0",
31+
"symfony/dependency-injection": "^5.0",
32+
"symfony/routing": "^5.0",
33+
"symfony/security-bundle": "^5.0",
34+
"symfony/yaml": "^5.0",
35+
"symfony/form": "^5.0",
36+
"symfony/validator": "^5.0",
37+
"symfony/twig-bundle": "^5.0",
38+
"symfony/twig-bridge": "^5.0",
39+
"twig/twig": "^2.0 || ^3.0",
40+
"phpoption/phpoption": "^1.1",
41+
"doctrine/annotations": "^1.0 || ^2.0"
4242
},
4343
"suggest": {
4444
"friendsofsymfony/user-bundle": "Allows for user integration.",
@@ -47,21 +47,21 @@
4747
"symfony/assetic-bundle": "Integrates Assetic into Symfony."
4848
},
4949
"require-dev": {
50-
"symfony/browser-kit": "~3.4|^4.3",
51-
"symfony/dom-crawler": "~3.4|^4.3",
52-
"symfony/css-selector": "~3.4|^4.3",
53-
"doctrine/orm": "~2.3",
54-
"doctrine/doctrine-bundle": "^1.6|^2.0",
55-
"friendsofsymfony/user-bundle": "~2.0",
50+
"symfony/browser-kit": "^5.0",
51+
"symfony/dom-crawler": "^5.0",
52+
"symfony/css-selector": "^5.0",
53+
"doctrine/orm": "^2.7",
54+
"doctrine/doctrine-bundle": "^2.2",
55+
"friendsofsymfony/user-bundle": "^2.0 || ^3.0",
5656
"ornicar/akismet-bundle": "dev-master",
57-
"symfony/expression-language": "~3.4|^4.3",
58-
"symfony/phpunit-bridge": "~3.4|^4.3",
59-
"phpunit/phpunit": "^6.5",
60-
"friendsofphp/php-cs-fixer": "^2.2"
57+
"symfony/expression-language": "^5.0",
58+
"symfony/phpunit-bridge": "^5.0",
59+
"phpunit/phpunit": "^8.5 || ^9.5",
60+
"friendsofphp/php-cs-fixer": "^3.0"
6161
},
6262
"extra": {
6363
"branch-alias": {
64-
"dev-master": "4.0.x-dev"
64+
"dev-master": "5.0.x-dev"
6565
}
6666
},
6767
"autoload": {
@@ -74,5 +74,10 @@
7474
"FOS\\CommentBundle\\Tests\\": "tests/"
7575
}
7676
},
77-
"prefer-stable": true
77+
"prefer-stable": true,
78+
"config": {
79+
"allow-plugins": {
80+
"symfony/flex": true
81+
}
82+
}
7883
}

phpunit.xml.dist

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
3-
<phpunit bootstrap="./tests/bootstrap.php" colors="true">
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
4+
bootstrap="./tests/bootstrap.php"
5+
colors="true"
6+
cacheResultFile=".phpunit.cache/test-results"
7+
executionOrder="depends,defects"
8+
failOnWarning="true"
9+
failOnRisky="true"
10+
failOnEmptyTestSuite="true"
11+
beStrictAboutOutputDuringTests="true"
12+
verbose="true">
13+
<coverage processUncoveredFiles="true">
14+
<include>
15+
<directory suffix=".php">./src</directory>
16+
</include>
17+
</coverage>
418
<php>
5-
<ini name="xdebug.max_nesting_level" value="200" />
19+
<ini name="xdebug.max_nesting_level" value="200"/>
620
</php>
721
<testsuites>
8-
<testsuite name="FOSCommentBundle test suitei">
22+
<testsuite name="FOSCommentBundle test suite">
923
<directory suffix="Test.php">./tests</directory>
1024
</testsuite>
1125
</testsuites>

0 commit comments

Comments
 (0)