Skip to content

Commit

Permalink
Add support for PHP83 (nabeelio#1763)
Browse files Browse the repository at this point in the history
* Add PHP83 to build

* Upgrade minimum laravel version

* Use PHP83 in sail

* Fix drop_user_oauth_tokens_foreign_keys with sqlite (tests)

* Add themeEngine to ThemeViewFinder

* Fix deprecated null value for first parameter of str_contains in Rank

* Upgrade jmikola/geojson to fix deprecated warnings

* Fix null parameter to DateTimeImmutable deprecated

* Upgrade santigarcor/laratrust to fix deprecation warnings

* Update composer.lock

* Fix warning in CommaDelimitedCast.php

* Update composer.lock

---------

Co-authored-by: Nabeel S <[email protected]>
  • Loading branch information
arthurpar06 and nabeelio authored Feb 28, 2024
1 parent 6f352eb commit 143d927
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php-versions: ['8.1', '8.2']
php-versions: ['8.1', '8.2', '8.3']
name: PHP ${{ matrix.php-versions }}
env:
extensions: intl, pcov, mbstring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration {
public function up(): void
{
Schema::table('user_oauth_tokens', function (Blueprint $table) {
$foreignKeys = Schema::getForeignKeys('user_oauth_tokens');
if (DB::getDriverName() !== 'sqlite') {
Schema::table('user_oauth_tokens', function (Blueprint $table) {
$foreignKeys = Schema::getForeignKeys('user_oauth_tokens');

foreach ($foreignKeys as $foreignKey) {
if (in_array('user_id', $foreignKey['columns'], true)) {
$table->dropForeign(['user_id']);
break;
foreach ($foreignKeys as $foreignKey) {
if (in_array('user_id', $foreignKey['columns'], true)) {
$table->dropForeign(['user_id']);
break;
}
}
}
});
});
}
}

public function down(): void
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Casts/CommaDelimitedCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CommaDelimitedCast implements CastsAttributes
*/
public function get($model, string $key, $value, array $attributes)
{
if (empty(trim($value))) {
if (empty($value) || empty(trim($value))) {
return [];
}

Expand Down
12 changes: 11 additions & 1 deletion app/Models/Rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,17 @@ class Rank extends Model
public function imageUrl(): Attribute
{
return Attribute::make(
get: fn ($value) => str_contains($value, 'http') ? $value : (filled($value) ? public_url($value) : null),
get: function ($value) {
if (!filled($value)) {
return null;
}

if (str_contains($value, 'http')) {
return $value;
}

return public_url($value);
},
);
}

Expand Down
2 changes: 2 additions & 0 deletions app/Support/ThemeViewFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

class ThemeViewFinder extends \Igaster\LaravelTheme\themeViewFinder
{
protected $themeEngine;

public function __construct(Filesystem $files, array $paths, array $extensions = null)
{
//$this->themeEngine = \App::make('igaster.themes');
Expand Down
2 changes: 1 addition & 1 deletion app/Support/Timezonelist.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Timezonelist
public static function formatTimezone($timezone, $continent, $htmlencode = true)
{
try {
$time = new \DateTimeImmutable(null, new DateTimeZone($timezone));
$time = new \DateTimeImmutable('now', new DateTimeZone($timezone));
} catch (\Exception $e) {
Log::error($e->getMessage());
return '';
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"psr/container": "1.1.1",
"composer/composer": "~2.6.5",
"composer/installers": "~1.12.0",
"laravel/framework": "~v10.0",
"laravel/framework": "~v10.22",
"arrilot/laravel-widgets": "~3.13.0",
"doctrine/dbal": "^3.0",
"guzzlehttp/guzzle": "~7.4.1",
"hashids/hashids": "~4.1.0",
"igaster/laravel-theme": "dev-master",
"intervention/image": "~2.4",
"jmikola/geojson": "1.0.*",
"jmikola/geojson": "^1.2.0",
"joshbrw/laravel-module-installer": "~2.0.1",
"laracasts/flash": "~3.2.2",
"laravel/helpers": "~v1.6.0",
Expand All @@ -63,7 +63,7 @@
"php-units-of-measure/php-units-of-measure": "~2.1.0",
"phpvms/sample-module": "~1.0",
"prettus/l5-repository": "~2.9.0",
"santigarcor/laratrust": "^8.0",
"santigarcor/laratrust": "^8.2.2",
"semver/semver": "~1.1.0",
"spatie/valuestore": "~1.3.2",
"tivie/php-os-detector": "~1.1.0",
Expand Down
46 changes: 24 additions & 22 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.2
context: ./vendor/laravel/sail/runtimes/8.3
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.2/app
image: sail-8.3/app
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
Expand Down

0 comments on commit 143d927

Please sign in to comment.