Skip to content

Commit 52dbdc8

Browse files
authored
chore: upgrade to php 8.2 (#351)
* chore: upgrade to php 8.2 * chore: upgrade php cs fixer * chore: upgrade psalm * fix: use {$var} instead of ${var} * fix: downgrade symfony extension Until upgrading to the newest symfony version
1 parent 3815906 commit 52dbdc8

125 files changed

Lines changed: 2045 additions & 1724 deletions

File tree

Some content is hidden

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

Dockerfile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
FROM php:8.1.6-fpm-alpine
1+
FROM php:8.2-fpm-alpine
22
WORKDIR /app
33

4-
RUN wget https://github.com/FriendsOfPHP/pickle/releases/download/v0.7.9/pickle.phar \
4+
RUN wget https://github.com/FriendsOfPHP/pickle/releases/download/v0.7.11/pickle.phar \
55
&& mv pickle.phar /usr/local/bin/pickle \
66
&& chmod +x /usr/local/bin/pickle
77

88
RUN apk --update upgrade \
9-
&& apk add --no-cache autoconf automake make gcc g++ bash icu-dev libzip-dev rabbitmq-c rabbitmq-c-dev \
9+
&& apk add --no-cache autoconf automake make gcc g++ bash icu-dev libzip-dev rabbitmq-c rabbitmq-c-dev linux-headers \
1010
&& docker-php-ext-install -j$(nproc) \
1111
bcmath \
1212
opcache \
1313
intl \
1414
zip \
1515
pdo_mysql
1616

17-
RUN pickle install apcu@5.1.21
18-
19-
ADD etc/infrastructure/php/extensions/rabbitmq.sh /root/install-rabbitmq.sh
20-
ADD etc/infrastructure/php/extensions/xdebug.sh /root/install-xdebug.sh
21-
RUN apk add git
22-
RUN sh /root/install-rabbitmq.sh
23-
RUN sh /root/install-xdebug.sh
17+
RUN pickle install apcu@5.1.22
18+
RUN pickle install amqp@2.1.0
19+
RUN pickle install xdebug@3.2.2
2420

2521
RUN docker-php-ext-enable \
2622
amqp \

apps/backoffice/backend/public/index.php

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

1515
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
1616
Request::setTrustedProxies(
17-
explode(',', $trustedProxies),
17+
explode(',', (string) $trustedProxies),
1818
Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST
1919
);
2020
}

apps/backoffice/backend/src/BackofficeBackendKernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Symfony\Component\Config\Resource\FileResource;
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
1111
use Symfony\Component\HttpKernel\Kernel;
12+
1213
use function dirname;
1314

1415
final class BackofficeBackendKernel extends Kernel

apps/backoffice/backend/src/Controller/Courses/CoursesGetController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010
use CodelyTv\Shared\Domain\Bus\Query\QueryBus;
1111
use Symfony\Component\HttpFoundation\JsonResponse;
1212
use Symfony\Component\HttpFoundation\Request;
13+
1314
use function Lambdish\Phunctional\map;
1415

15-
final class CoursesGetController
16+
final readonly class CoursesGetController
1617
{
1718
public function __construct(private QueryBus $queryBus)
1819
{

apps/backoffice/backend/src/Controller/Metrics/MetricsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symfony\Component\HttpFoundation\Request;
1010
use Symfony\Component\HttpFoundation\Response;
1111

12-
final class MetricsController
12+
final readonly class MetricsController
1313
{
1414
public function __construct(private PrometheusMonitor $monitor)
1515
{

apps/backoffice/frontend/public/index.php

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

1515
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
1616
Request::setTrustedProxies(
17-
explode(',', $trustedProxies),
17+
explode(',', (string) $trustedProxies),
1818
Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST
1919
);
2020
}

apps/backoffice/frontend/src/BackofficeFrontendKernel.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Symfony\Component\Config\Resource\FileResource;
1010
use Symfony\Component\DependencyInjection\ContainerBuilder;
1111
use Symfony\Component\HttpKernel\Kernel;
12+
1213
use function dirname;
1314

1415
final class BackofficeFrontendKernel extends Kernel

apps/backoffice/frontend/src/Command/ImportCoursesToElasticsearchCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
final class ImportCoursesToElasticsearchCommand extends Command
1414
{
1515
public function __construct(
16-
private MySqlBackofficeCourseRepository $mySqlRepository,
17-
private ElasticsearchBackofficeCourseRepository $elasticRepository
16+
private readonly MySqlBackofficeCourseRepository $mySqlRepository,
17+
private readonly ElasticsearchBackofficeCourseRepository $elasticRepository
1818
) {
1919
parent::__construct();
2020
}

apps/backoffice/frontend/src/Controller/Metrics/MetricsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Symfony\Component\HttpFoundation\Request;
1010
use Symfony\Component\HttpFoundation\Response;
1111

12-
final class MetricsController
12+
final readonly class MetricsController
1313
{
1414
public function __construct(private PrometheusMonitor $monitor)
1515
{

apps/bootstrap.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
1111
if (is_array($env = @include $rootPath . '/.env.local.php')) {
1212
foreach ($env as $k => $v) {
13-
$_ENV[$k] = $_ENV[$k] ?? (isset($_SERVER[$k]) && str_starts_with($k, 'HTTP_') ? $_SERVER[$k] : $v);
13+
$_ENV[$k] ??= isset($_SERVER[$k]) && str_starts_with($k, 'HTTP_') ? $_SERVER[$k] : $v;
1414
}
1515
} elseif (!class_exists(Dotenv::class)) {
1616
throw new RuntimeException(
@@ -23,6 +23,6 @@
2323

2424
$_SERVER += $_ENV;
2525
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
26-
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
26+
$_SERVER['APP_DEBUG'] ??= $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
2727
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] =
2828
(int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';

0 commit comments

Comments
 (0)