mirror of
https://github.com/flarum/framework.git
synced 2024-11-22 04:27:18 +08:00
feat(core): PHP 8.2 Support (#3709)
* chore: test with php 8.2 * chore: bump httphandlerunnder * chore: bump httphandlerunner * chore: address php8.2 deprecation * chore: php 8.2 * chore: bump less.php version * avoid dynamic properties * avoid another dynamic property * Apply fixes from StyleCI * tags php82 * php82 * fix: check for property existence * Rerun checks after s9e/text-formatter update * chore: disable deprecation warnings for php 8.2 * chore: PHP8.2 does not accept dynamic properties * chore: temporarily disable package manager tests workflow Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
This commit is contained in:
parent
ced1c2d94f
commit
1ee5cf6ba9
19
.github/workflows/REUSABLE_backend.yml
vendored
19
.github/workflows/REUSABLE_backend.yml
vendored
|
@ -25,7 +25,7 @@ on:
|
|||
description: Versions of PHP to test with. Should be array of strings encoded as JSON array
|
||||
type: string
|
||||
required: false
|
||||
default: '["7.3", "7.4", "8.0", "8.1"]'
|
||||
default: '["7.3", "7.4", "8.0", "8.1", "8.2"]'
|
||||
|
||||
php_extensions:
|
||||
description: PHP extensions to install.
|
||||
|
@ -58,6 +58,7 @@ jobs:
|
|||
php: ${{ fromJSON(inputs.php_versions) }}
|
||||
service: ${{ fromJSON(inputs.db_versions) }}
|
||||
prefix: ['']
|
||||
php_ini_values: [inputs.php_ini_values]
|
||||
|
||||
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude
|
||||
include:
|
||||
|
@ -86,12 +87,24 @@ jobs:
|
|||
prefix: flarum_
|
||||
prefixStr: (prefix)
|
||||
|
||||
# @TODO: remove in 2.0
|
||||
# Include testing PHP 8.2 with deprecation warnings disabled.
|
||||
- php: 8.2
|
||||
php_ini_values: error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
|
||||
|
||||
# To reduce number of actions, we exclude some PHP versions from running with some DB versions.
|
||||
exclude:
|
||||
- php: ${{ fromJSON(inputs.php_versions)[1] }}
|
||||
service: 'mysql:8.0.30'
|
||||
- php: ${{ fromJSON(inputs.php_versions)[2] }}
|
||||
service: 'mysql:8.0.30'
|
||||
- php: ${{ fromJSON(inputs.php_versions)[3] }}
|
||||
service: 'mysql:8.0.30'
|
||||
|
||||
# @TODO: remove in 2.0
|
||||
# Exclude testing PHP 8.2 with deprecation warnings enabled.
|
||||
- php: 8.2
|
||||
php_ini_values: error_reporting=E_ALL
|
||||
|
||||
services:
|
||||
mysql:
|
||||
|
@ -115,7 +128,7 @@ jobs:
|
|||
coverage: xdebug
|
||||
extensions: ${{ inputs.php_extensions }}
|
||||
tools: phpunit, composer:v2
|
||||
ini-values: ${{ inputs.php_ini_values }}
|
||||
ini-values: ${{ matrix.php_ini_values }}
|
||||
|
||||
# The authentication alter is necessary because newer mysql versions use the `caching_sha2_password` driver,
|
||||
# which isn't supported prior to PHP7.4
|
||||
|
@ -167,7 +180,7 @@ jobs:
|
|||
coverage: xdebug
|
||||
extensions: ${{ inputs.php_extensions }}
|
||||
tools: phpunit, composer:v2
|
||||
ini-values: ${{ inputs.php_ini_values }}
|
||||
ini-values: ${{ matrix.php_ini_values }}
|
||||
|
||||
- name: Install Composer dependencies
|
||||
run: composer install
|
||||
|
|
|
@ -6,6 +6,6 @@ jobs:
|
|||
run:
|
||||
uses: ./.github/workflows/REUSABLE_backend.yml
|
||||
with:
|
||||
enable_backend_testing: true
|
||||
enable_backend_testing: false
|
||||
|
||||
backend_directory: ./extensions/package-manager
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
"illuminate/view": "^8.0",
|
||||
"intervention/image": "2.5.* || ^2.6.1",
|
||||
"laminas/laminas-diactoros": "^2.4.1",
|
||||
"laminas/laminas-httphandlerrunner": "^1.2.0",
|
||||
"laminas/laminas-httphandlerrunner": "^1.2.0 || ^2.3.0",
|
||||
"laminas/laminas-stratigility": "^3.2.2",
|
||||
"league/flysystem": "^1.0.11",
|
||||
"matthiasmullie/minify": "^1.3",
|
||||
|
|
|
@ -19,7 +19,7 @@ return [
|
|||
// do this manually because dbal doesn't recognize timestamp columns
|
||||
$connection = $schema->getConnection();
|
||||
$prefix = $connection->getTablePrefix();
|
||||
$connection->statement("ALTER TABLE `${prefix}post_mentions_post` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
$connection->statement("ALTER TABLE `{$prefix}post_mentions_post` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
|
|
|
@ -19,7 +19,7 @@ return [
|
|||
// do this manually because dbal doesn't recognize timestamp columns
|
||||
$connection = $schema->getConnection();
|
||||
$prefix = $connection->getTablePrefix();
|
||||
$connection->statement("ALTER TABLE `${prefix}post_mentions_user` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
$connection->statement("ALTER TABLE `{$prefix}post_mentions_user` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
|
|
|
@ -18,5 +18,10 @@ abstract class AbstractActionCommand
|
|||
*/
|
||||
public $task = null;
|
||||
|
||||
/**
|
||||
* @var string|null
|
||||
*/
|
||||
public $package = null;
|
||||
|
||||
abstract public function getOperationName(): string;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ return [
|
|||
// do this manually because dbal doesn't recognize timestamp columns
|
||||
$connection = $schema->getConnection();
|
||||
$prefix = $connection->getTablePrefix();
|
||||
$connection->statement("ALTER TABLE `${prefix}tags` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
$connection->statement("ALTER TABLE `${prefix}tags` MODIFY updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
|
||||
$connection->statement("ALTER TABLE `{$prefix}tags` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
$connection->statement("ALTER TABLE `{$prefix}tags` MODIFY updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP");
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
|
|
|
@ -19,7 +19,7 @@ return [
|
|||
// do this manually because dbal doesn't recognize timestamp columns
|
||||
$connection = $schema->getConnection();
|
||||
$prefix = $connection->getTablePrefix();
|
||||
$connection->statement("ALTER TABLE `${prefix}discussion_tag` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
$connection->statement("ALTER TABLE `{$prefix}discussion_tag` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP");
|
||||
},
|
||||
|
||||
'down' => function (Builder $schema) {
|
||||
|
|
|
@ -55,7 +55,7 @@ class ScopeDiscussionVisibilityForAbility
|
|||
})
|
||||
->orWhere(function ($query) use ($actor, $permission) {
|
||||
// Allow extensions a way to override scoping for any given permission.
|
||||
$query->whereVisibleTo($actor, "${permission}InRestrictedTags");
|
||||
$query->whereVisibleTo($actor, "{$permission}InRestrictedTags");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
"illuminate/view": "^8.0",
|
||||
"intervention/image": "2.5.* || ^2.6.1",
|
||||
"laminas/laminas-diactoros": "^2.4.1",
|
||||
"laminas/laminas-httphandlerrunner": "^1.2.0",
|
||||
"laminas/laminas-httphandlerrunner": "^1.2.0 || ^2.3.0",
|
||||
"laminas/laminas-stratigility": "^3.2.2",
|
||||
"league/flysystem": "^1.0.11",
|
||||
"matthiasmullie/minify": "^1.3",
|
||||
|
@ -84,7 +84,7 @@
|
|||
"symfony/polyfill-intl-messageformatter": "^1.22.0",
|
||||
"symfony/translation": "^5.1.5",
|
||||
"symfony/yaml": "^5.2.2",
|
||||
"wikimedia/less.php": "^3.0"
|
||||
"wikimedia/less.php": "^3.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"flarum/testing": "^1.0.0"
|
||||
|
|
|
@ -113,7 +113,7 @@ class ListNotificationsController extends AbstractListController
|
|||
$ids = [];
|
||||
|
||||
foreach ($notifications as $notification) {
|
||||
if ($notification->subject && isset($notification->subject->discussion_id)) {
|
||||
if ($notification->subject && property_exists($notification->subject, 'discussion_id')) {
|
||||
$ids[] = $notification->subject->discussion_id;
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ class ListNotificationsController extends AbstractListController
|
|||
$discussions = Discussion::query()->find(array_unique($ids));
|
||||
|
||||
foreach ($notifications as $notification) {
|
||||
if ($notification->subject && isset($notification->subject->discussion_id)) {
|
||||
if ($notification->subject && property_exists($notification->subject, 'discussion_id')) {
|
||||
$notification->subject->setRelation('discussion', $discussions->find($notification->subject->discussion_id));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
namespace Flarum\Discussion\Event;
|
||||
|
||||
use Flarum\Discussion\UserState;
|
||||
use Flarum\User\User;
|
||||
|
||||
class UserRead
|
||||
{
|
||||
|
@ -18,6 +19,11 @@ class UserRead
|
|||
*/
|
||||
public $state;
|
||||
|
||||
/**
|
||||
* @var User
|
||||
*/
|
||||
public $actor;
|
||||
|
||||
/**
|
||||
* @param UserState $state
|
||||
*/
|
||||
|
|
|
@ -14,6 +14,16 @@ use Flarum\Testing\unit\TestCase;
|
|||
|
||||
class ExtensionDependencyResolutionTest extends TestCase
|
||||
{
|
||||
public $tags;
|
||||
public $categories;
|
||||
public $tagBackgrounds;
|
||||
public $something;
|
||||
public $help;
|
||||
public $missing;
|
||||
public $circular1;
|
||||
public $circular2;
|
||||
public $optionalDependencyCategories;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
|
Loading…
Reference in New Issue
Block a user