Skip to content

Commit

Permalink
Update to PHP 8.4 (AzuraCast#7706)
Browse files Browse the repository at this point in the history
* Update to PHP 8.4; modify deprecated code, update DoctrineEntityNormalizer, etc.

* Update PHP deps for 8.4.

Changelogs summary:

 - symfony/serializer updated from v7.2.0 to v7.2.3 patch
   See changes: symfony/serializer@v7.2.0...v7.2.3
   Release notes: https://github.com/symfony/serializer/releases/tag/v7.2.3

 - symfony/yaml updated from v7.2.0 to v7.2.3 patch
   See changes: symfony/yaml@v7.2.0...v7.2.3
   Release notes: https://github.com/symfony/yaml/releases/tag/v7.2.3

 - symfony/var-dumper updated from v7.2.0 to v7.2.3 patch
   See changes: symfony/var-dumper@v7.2.0...v7.2.3
   Release notes: https://github.com/symfony/var-dumper/releases/tag/v7.2.3

 - phpunit/phpunit updated from 11.5.3 to 11.5.5 patch
   See changes: sebastianbergmann/phpunit@11.5.3...11.5.5
   Release notes: https://github.com/sebastianbergmann/phpunit/releases/tag/11.5.5

 - symfony/dom-crawler updated from v7.2.0 to v7.2.3 patch
   See changes: symfony/dom-crawler@v7.2.0...v7.2.3
   Release notes: https://github.com/symfony/dom-crawler/releases/tag/v7.2.3

 - aws/aws-sdk-php updated from 3.339.0 to 3.339.2 patch
   See changes: aws/aws-sdk-php@3.339.0...3.339.2
   Release notes: https://github.com/aws/aws-sdk-php/releases/tag/3.339.2

 - laravel/serializable-closure updated from v1.3.7 to v2.0.2 major
   See changes: laravel/serializable-closure@v1.3.7...v2.0.2
   Release notes: https://github.com/laravel/serializable-closure/releases/tag/v2.0.2

 - php-di/php-di updated from 7.0.7 to 7.0.8 patch
   See changes: PHP-DI/PHP-DI@7.0.7...7.0.8
   Release notes: https://github.com/PHP-DI/PHP-DI/releases/tag/7.0.8

 - symfony/cache updated from v7.2.1 to v7.2.3 patch
   See changes: symfony/cache@v7.2.1...v7.2.3
   Release notes: https://github.com/symfony/cache/releases/tag/v7.2.3

 - roave/security-advisories updated from dev-latest@43863a2 to dev-latest@a39f409
   See changes: Roave/SecurityAdvisories@43863a2...a39f409

 - symfony/lock updated from v7.2.0 to v7.2.3 patch
   See changes: symfony/lock@v7.2.0...v7.2.3
   Release notes: https://github.com/symfony/lock/releases/tag/v7.2.3

 - symfony/mime updated from v7.2.1 to v7.2.3 patch
   See changes: symfony/mime@v7.2.1...v7.2.3
   Release notes: https://github.com/symfony/mime/releases/tag/v7.2.3

 - symfony/mailer updated from v7.2.0 to v7.2.3 patch
   See changes: symfony/mailer@v7.2.0...v7.2.3
   Release notes: https://github.com/symfony/mailer/releases/tag/v7.2.3

 - symfony/property-info updated from v7.2.2 to v7.2.3 patch
   See changes: symfony/property-info@v7.2.2...v7.2.3
   Release notes: https://github.com/symfony/property-info/releases/tag/v7.2.3

 - symfony/property-access updated from v7.2.0 to v7.2.3 patch
   See changes: symfony/property-access@v7.2.0...v7.2.3
   Release notes: https://github.com/symfony/property-access/releases/tag/v7.2.3

 - symfony/messenger updated from v7.2.1 to v7.2.3 patch
   See changes: symfony/messenger@v7.2.1...v7.2.3
   Release notes: https://github.com/symfony/messenger/releases/tag/v7.2.3

 - symfony/redis-messenger updated from v7.2.0 to v7.2.3 patch
   See changes: symfony/redis-messenger@v7.2.0...v7.2.3
   Release notes: https://github.com/symfony/redis-messenger/releases/tag/v7.2.3

 - symfony/validator updated from v7.2.2 to v7.2.3 patch
   See changes: symfony/validator@v7.2.2...v7.2.3
   Release notes: https://github.com/symfony/validator/releases/tag/v7.2.3

No security vulnerability advisories found.
  • Loading branch information
BusterNeece authored Jan 30, 2025
1 parent 683f2c2 commit 1558606
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 179 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
extensions: intl, xdebug
tools: composer:v2, cs2pr

Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
extensions: intl, xdebug
tools: composer:v2, cs2pr

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ COPY --from=icecast /usr/local/share/icecast /usr/local/share/icecast
#
# Final build image
#
FROM php:8.3-fpm-bookworm AS pre-final
FROM php:8.4-fpm-bookworm AS pre-final

ENV TZ="UTC" \
LANGUAGE="en_US.UTF-8" \
Expand Down
16 changes: 2 additions & 14 deletions backend/src/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,24 +196,12 @@ public function roleAllowed(

// Iterate through an array of roles and return with the first "true" response, or "false" otherwise.
if (is_array($roleId)) {
foreach ($roleId as $r) {
if ($this->roleAllowed($r, $action, $stationId)) {
return true;
}
}

return false;
return array_any($roleId, fn($r) => $this->roleAllowed($r, $action, $stationId));
}

// If multiple actions are supplied, treat the list as "x OR y OR z", returning if any action is allowed.
if (is_array($action)) {
foreach ($action as $a) {
if ($this->roleAllowed($roleId, $a, $stationId)) {
return true;
}
}

return false;
return array_any($action, fn($a) => $this->roleAllowed($roleId, $a, $stationId));
}

if (!empty($this->actions[$roleId])) {
Expand Down
7 changes: 3 additions & 4 deletions backend/src/Controller/Frontend/PublicPages/PlayerAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,9 @@ public function __invoke(
// Auto-redirect requests from players to the playlist (PLS) download.
$userAgent = strtolower($request->getHeaderLine('User-Agent'));
$players = ['mpv', 'player', 'vlc', 'applecoremedia'];
foreach ($players as $player) {
if (str_contains($userAgent, $player)) {
return $response->withRedirect($props['downloadPlaylistUri']);
}

if (array_any($players, fn($player) => str_contains($userAgent, $player))) {
return $response->withRedirect($props['downloadPlaylistUri']);
}

// Render full page player.
Expand Down
13 changes: 5 additions & 8 deletions backend/src/Entity/Repository/StationRequestRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,11 @@ public function getNextPlayableRequest(
)->setParameter('station', $station)
->execute();

foreach ($requests as $request) {
/** @var StationRequest $request */
if ($request->shouldPlayNow($now) && !$this->hasPlayedRecently($request->getTrack(), $station)) {
return $request;
}
}

return null;
return array_find(
$requests,
fn(StationRequest $request) => $request->shouldPlayNow($now)
&& !$this->hasPlayedRecently($request->getTrack(), $station)
);
}

/**
Expand Down
8 changes: 1 addition & 7 deletions backend/src/Flysystem/StationFilesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,6 @@ public static function buildLocalFilesystemForPath(
public static function isDotFile(string $path): bool
{
$pathParts = explode('/', $path);
foreach ($pathParts as $part) {
if (str_starts_with($part, '.')) {
return true;
}
}

return false;
return array_any($pathParts, fn($part) => str_starts_with($part, '.'));
}
}
11 changes: 4 additions & 7 deletions backend/src/Radio/AutoDJ/Scheduler.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,10 @@ public function shouldSchedulePlayNow(
);
}

foreach ($comparePeriods as $dateRange) {
if ($this->shouldPlayInSchedulePeriod($schedule, $dateRange, $now, $excludeSpecialRules)) {
return true;
}
}

return false;
return array_any(
$comparePeriods,
fn($dateRange) => $this->shouldPlayInSchedulePeriod($schedule, $dateRange, $now, $excludeSpecialRules)
);
}

private function shouldPlayInSchedulePeriod(
Expand Down
11 changes: 4 additions & 7 deletions backend/src/Radio/Frontend/Blocklist/BlocklistParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,9 @@ public function isUserAgentBanned(
return false;
}

foreach (array_filter(array_map('trim', explode("\n", $bannedUserAgents))) as $userAgent) {
if (fnmatch($userAgent, $listenerUserAgent)) {
return true;
}
}

return false;
return array_any(
array_filter(array_map('trim', explode("\n", $bannedUserAgents))),
fn($userAgent) => fnmatch($userAgent, $listenerUserAgent)
);
}
}
8 changes: 1 addition & 7 deletions backend/src/Webhook/Connector/AbstractConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,7 @@ protected function webhookShouldTrigger(StationWebhook $webhook, array $triggers
return true;
}

foreach ($triggers as $trigger) {
if ($webhook->hasTrigger($trigger)) {
return true;
}
}

return false;
return array_any($triggers, fn($trigger) => $webhook->hasTrigger($trigger));
}

protected function getRateLimitTime(StationWebhook $webhook): ?int
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": "^8.3",
"php": "^8.4",
"ext-PDO": "*",
"ext-curl": "*",
"ext-ffi": "*",
Expand Down
Loading

0 comments on commit 1558606

Please sign in to comment.