Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add php 8 and symfony 6 support #48

Merged
merged 10 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ jobs:
SYMFONY_DEPRECATIONS_HELPER: disabled

- php-version: '7.4'
lint: true
dependency-versions: 'highest'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: disabled

- php-version: '8.0'
Prokyonn marked this conversation as resolved.
Show resolved Hide resolved
lint: true
dependency-versions: 'highest'
tools: 'composer:v2'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Tests/Application/var
Tests/Application/.env.test.local

# php-cs-fixer
.php_cs.cache
.php-cs-fixer.cache
php-cs-fixer
7 changes: 5 additions & 2 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
EOF;

$finder = PhpCsFixer\Finder::create()
->exclude(['var/cache'])
->exclude(['var/cache', 'tests/Resources/cache', 'node_modules'])
->in(__DIR__);

return PhpCsFixer\Config::create()
$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true)
->setRules([
'@Symfony' => true,
'array_syntax' => ['syntax' => 'short'],
Expand All @@ -26,3 +27,5 @@
'phpdoc_types_order' => false,
])
->setFinder($finder);

return $config;
18 changes: 9 additions & 9 deletions Admin/CommentAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
*/
class CommentAdmin extends Admin
{
const COMMENT_SECURITY_CONTEXT = 'sulu.comment.comments';
const COMMENT_LIST_VIEW = 'sulu_comment.comments.list';
const COMMENT_EDIT_FORM_VIEW = 'sulu_comment.comments.edit_form';
const COMMENT_EDIT_FORM_DETAILS_VIEW = 'sulu_comment.comments.edit_form.details';

const THREAD_SECURITY_CONTEXT = 'sulu.comment.threads';
const THREAD_LIST_VIEW = 'sulu_comment.threads.list';
const THREAD_EDIT_FORM_VIEW = 'sulu_comment.threads.edit_form';
const THREAD_EDIT_FORM_DETAILS_VIEW = 'sulu_comment.threads.edit_form.details';
public const COMMENT_SECURITY_CONTEXT = 'sulu.comment.comments';
public const COMMENT_LIST_VIEW = 'sulu_comment.comments.list';
public const COMMENT_EDIT_FORM_VIEW = 'sulu_comment.comments.edit_form';
public const COMMENT_EDIT_FORM_DETAILS_VIEW = 'sulu_comment.comments.edit_form.details';

public const THREAD_SECURITY_CONTEXT = 'sulu.comment.threads';
public const THREAD_LIST_VIEW = 'sulu_comment.threads.list';
public const THREAD_EDIT_FORM_VIEW = 'sulu_comment.threads.edit_form';
public const THREAD_EDIT_FORM_DETAILS_VIEW = 'sulu_comment.threads.edit_form.details';

/**
* @var ViewBuilderFactoryInterface
Expand Down
6 changes: 4 additions & 2 deletions Controller/CommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,17 @@ public function cgetAction(Request $request): Response

foreach ($request->query->all() as $filterKey => $filterValue) {
if (isset($fieldDescriptors[$filterKey])) {
$listBuilder->where($fieldDescriptors[$filterKey], $filterValue);
$listBuilder->where($fieldDescriptors[$filterKey], (string) $filterValue);
}
}

/** @var string $route */
$route = $request->attributes->get('_route');
$results = $listBuilder->execute();
$list = new ListRepresentation(
$results,
'comments',
$request->attributes->get('_route'),
$route,
$request->query->all(),
$listBuilder->getCurrentPage(),
$listBuilder->getLimit(),
Expand Down
7 changes: 5 additions & 2 deletions Controller/ThreadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,23 @@ public function cgetAction(Request $request): Response

foreach ($request->query->all() as $filterKey => $filterValue) {
if (isset($fieldDescriptors[$filterKey])) {
$listBuilder->where($fieldDescriptors[$filterKey], $filterValue);
$listBuilder->where($fieldDescriptors[$filterKey], (string) $filterValue);
}
}

/** @var string $typeParameter */
$typeParameter = $request->get('types');
if ($typeParameter) {
$listBuilder->in($fieldDescriptors['type'], array_filter(explode(',', $typeParameter)));
}

$items = $listBuilder->execute();
/** @var string $route */
$route = $request->attributes->get('_route');
$list = new ListRepresentation(
$items,
'threads',
$request->attributes->get('_route'),
$route,
$request->query->all(),
$listBuilder->getCurrentPage(),
$listBuilder->getLimit(),
Expand Down
4 changes: 2 additions & 2 deletions Controller/WebsiteCommentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ public function cgetCommentsAction(string $threadId, Request $request): Response
{
list($type, $entityId) = $this->getThreadIdParts($threadId);

$limit = $request->query->getInt('limit') ?? 10;
$offset = $request->query->getInt('offset') ?? 0;
$limit = $request->query->getInt('limit', 10);
$offset = $request->query->getInt('offset', 0);

$pageSize = $request->get('pageSize');
if ($pageSize) {
Expand Down
4 changes: 2 additions & 2 deletions Entity/CommentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

interface CommentInterface
{
const STATE_UNPUBLISHED = 0;
public const STATE_UNPUBLISHED = 0;

const STATE_PUBLISHED = 1;
public const STATE_PUBLISHED = 1;

public function getId(): int;

Expand Down
20 changes: 10 additions & 10 deletions Events/Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@

final class Events
{
const PRE_PERSIST_EVENT = 'sulu_comment.pre_persist';
public const PRE_PERSIST_EVENT = 'sulu_comment.pre_persist';

const POST_PERSIST_EVENT = 'sulu_comment.post_persist';
public const POST_PERSIST_EVENT = 'sulu_comment.post_persist';

const PRE_DELETE_EVENT = 'sulu_comment.pre_delete';
public const PRE_DELETE_EVENT = 'sulu_comment.pre_delete';

const POST_DELETE_EVENT = 'sulu_comment.post_delete';
public const POST_DELETE_EVENT = 'sulu_comment.post_delete';

const PRE_UPDATE_EVENT = 'sulu_comment.pre_update';
public const PRE_UPDATE_EVENT = 'sulu_comment.pre_update';

const PUBLISH_EVENT = 'sulu_comment.publish';
public const PUBLISH_EVENT = 'sulu_comment.publish';

const UNPUBLISH_EVENT = 'sulu_comment.unpublish';
public const UNPUBLISH_EVENT = 'sulu_comment.unpublish';

const THREAD_PRE_UPDATE_EVENT = 'sulu_comment.thread.pre_update';
public const THREAD_PRE_UPDATE_EVENT = 'sulu_comment.thread.pre_update';

const THREAD_PRE_DELETE_EVENT = 'sulu_comment.thread.pre_delete';
public const THREAD_PRE_DELETE_EVENT = 'sulu_comment.thread.pre_delete';

const THREAD_POST_DELETE_EVENT = 'sulu_comment.thread.post_delete';
public const THREAD_POST_DELETE_EVENT = 'sulu_comment.thread.post_delete';

/**
* Private constructor.
Expand Down
2 changes: 1 addition & 1 deletion Tests/Application/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
APP_ENV=test
DATABASE_URL=mysql://root@localhost:3306/su_comment_test
DATABASE_URL=mysql://root@127.0.0.1:3306/su_comment_test
2 changes: 1 addition & 1 deletion Tests/Application/bin/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
// umask(0000);

set_time_limit(0);

Expand Down
2 changes: 1 addition & 1 deletion Tests/Application/config/config_admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parameters:
database.url: '%env(resolve:DATABASE_URL)%'

framework:
router: { resource: "%kernel.root_dir%/config/routing_admin.yml" }
router: { resource: "%kernel.project_dir%/config/routing_admin.yml" }

doctrine:
orm:
Expand Down
2 changes: 1 addition & 1 deletion Tests/Application/config/config_website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ parameters:
database.url: '%env(resolve:DATABASE_URL)%'

framework:
router: { resource: "%kernel.root_dir%/config/routing_website.yml" }
router: { resource: "%kernel.project_dir%/config/routing_website.yml" }

security:
access_decision_manager:
Expand Down
40 changes: 20 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,36 @@
"type": "sulu-bundle",
"license": "MIT",
"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"friendsofsymfony/rest-bundle": "^2.6 || ^3.0",
"sulu/sulu": "^2.0.4",
"symfony/config": "^4.3 || ^5.0",
"symfony/dependency-injection": "^4.3 || ^5.0",
"symfony/framework-bundle": "^4.3 || ^5.0",
"symfony/http-foundation": "^4.3 || ^5.0",
"symfony/http-kernel": "^4.3 || ^5.0"
"sulu/sulu": "^2.0.4 || ^2.5.10@dev",
"symfony/config": "^4.3 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^4.3 || ^5.0 || ^6.0",
"symfony/framework-bundle": "^4.3 || ^5.0 || ^6.0",
"symfony/http-foundation": "^4.3 || ^5.0 || ^6.0",
"symfony/http-kernel": "^4.3 || ^5.0 || ^6.0"
},
"require-dev": {
"doctrine/doctrine-bundle": "^1.10 || ^2.0",
"friendsofphp/php-cs-fixer": "^2.17",
"friendsofphp/php-cs-fixer": "^2.17 || ^3.0",
"handcraftedinthealps/zendsearch": "^2.0",
"jackalope/jackalope-doctrine-dbal": "^1.3.4",
"jangregor/phpstan-prophecy": "^0.5.1",
"jangregor/phpstan-prophecy": "^1.0",
"massive/search-bundle": "^2.0.0",
"php-ffmpeg/php-ffmpeg": "^0.13 || ^0.14",
"php-ffmpeg/php-ffmpeg": "^0.14 || ^1.0",
"phpspec/prophecy": "^1.17",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-doctrine": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-symfony": "^0.12",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-doctrine": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-symfony": "^1.0",
"phpunit/phpunit": "^8.0",
"symfony/browser-kit": "^4.3",
"symfony/dotenv": "^4.3",
"symfony/form": "^4.3",
"symfony/browser-kit": "^4.3 || ^5.0 || ^6.0",
"symfony/dotenv": "^4.3 || ^5.0 || ^6.0",
"symfony/form": "^4.3 || ^5.0 || ^6.0",
"symfony/monolog-bundle": "^3.1",
"symfony/security-bundle": "^4.3",
"symfony/stopwatch": "^4.3",
"thecodingmachine/phpstan-strict-rules": "^0.12.2"
"symfony/security-bundle": "^4.3 || ^5.0 || ^6.0",
"symfony/stopwatch": "^4.3 || ^5.0 || ^6.0",
"thecodingmachine/phpstan-strict-rules": "^1.0"
},
"keywords": [],
"authors": [
Expand Down
Loading
Loading