Skip to content

Commit b45f17f

Browse files
authored
Merge pull request #113 from anstapol/nova-5
Nova 5 support Thank you @anstapol and @Woeler.
2 parents 4737355 + 32d9354 commit b45f17f

12 files changed

+21
-19
lines changed

.github/workflows/test-code.yml

+3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ jobs:
2323
laravel:
2424
- '10.0'
2525
- '11.0'
26+
- '12.0'
2627

2728
include:
2829
- laravel: '10.0'
2930
testbench: '8.0'
3031
- laravel: '11.0'
3132
testbench: '9.0'
33+
- laravel: '12.0'
34+
testbench: '10.0'
3235
- php: 8.3
3336
laravel: '11.0'
3437
stable: true

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@
66
Thumbs.db
77
.php-cs-fixer.cache
88
/composer.lock
9+
/auth.json
10+
/report-junit.xml
11+
/.env

composer.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
"ext-json": "*",
1616
"codex-team/editor.js": "*",
1717
"guzzlehttp/guzzle": "^7.0",
18-
"illuminate/support": "^10.0 || ^11.0",
19-
"illuminate/events": "^10.0 || ^11.0",
20-
"laravel/nova": "^4.0",
18+
"illuminate/events": "^10.0 || ^11.0 || ^12.0",
19+
"illuminate/support": "^10.0 || ^11.0 || ^12.0",
20+
"laravel/laravel": "^12",
21+
"laravel/nova": "^4.0 || ^5.0",
2122
"spatie/image": "^3.0"
2223
},
2324
"require-dev": {
2425
"laravel/pint": "^1.15",
25-
"orchestra/testbench": "^8.0 || ^9.0",
26+
"orchestra/testbench": "^10",
2627
"php-parallel-lint/php-parallel-lint": "^1.3"
2728
},
2829
"autoload": {

src/Events/EditorJsImageUploaded.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@ class EditorJsImageUploaded
1010
{
1111
use Dispatchable;
1212

13-
public function __construct(public string $disk, public string $path)
14-
{
15-
}
13+
public function __construct(public string $disk, public string $path) {}
1614
}

src/Events/EditorJsThumbnailCreated.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@ class EditorJsThumbnailCreated
1010
{
1111
use Dispatchable;
1212

13-
public function __construct(public string $disk, public string $path)
14-
{
15-
}
13+
public function __construct(public string $disk, public string $path) {}
1614
}

src/Http/Controllers/EditorJsImageUploadController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function url(Request $request): JsonResponse
103103
}
104104

105105
// Validate mime type
106-
$mime = (new finfo())->buffer($response->body(), FILEINFO_MIME_TYPE);
106+
$mime = (new finfo)->buffer($response->body(), FILEINFO_MIME_TYPE);
107107
if (! in_array($mime, self::VALID_IMAGE_MIMES, true)) {
108108
return response()->json([
109109
'success' => 0,

src/Http/Controllers/EditorJsLinkController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function fetch(Request $request): JsonResponse
4040
]);
4141
}
4242

43-
$doc = new DOMDocument();
43+
$doc = new DOMDocument;
4444
@$doc->loadHTML((string) $response->getBody());
4545
$nodes = $doc->getElementsByTagName('title');
4646
$title = $nodes->item(0)->nodeValue;

src/NovaEditorJsConverter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function addRender(string $block, callable $callback): void
4343
*/
4444
public function generateHtmlOutput(mixed $data): HtmlString
4545
{
46-
if (empty($data) || $data == new stdClass()) {
46+
if (empty($data) || $data == new stdClass) {
4747
return new HtmlString('');
4848
}
4949

src/NovaEditorJsField.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,17 @@ public function __construct($name, $attribute = null, ?callable $resolveCallback
4040
/**
4141
* Resolve the field's value for display.
4242
*
43-
* @param string|null $attribute
4443
*
4544
* @throws \Throwable
4645
*/
47-
public function resolveForDisplay($resource, $attribute = null)
46+
public function resolveForDisplay($resource, ?string $attribute = null): void
4847
{
4948
$attribute = $attribute ?? $this->attribute;
5049
if ($attribute === 'ComputedField') {
5150
return;
5251
}
5352

54-
$value = data_get($resource, str_replace('->', '.', $attribute), $placeholder = new \stdClass());
53+
$value = data_get($resource, str_replace('->', '.', $attribute), $placeholder = new \stdClass);
5554

5655
if (is_callable($this->resolveCallback)) {
5756
$value = call_user_func($this->resolveCallback, $value, $resource, $attribute);

tests/Feature/Http/Controllers/EditorJsImageUploadControllerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testImageUpload(string $path): void
4646
$fake = Event::fake();
4747
DB::setEventDispatcher($fake);
4848

49-
$uploadedFile = UploadedFile::fake()->create('file', 1024, (new finfo())->file($path, FILEINFO_MIME_TYPE));
49+
$uploadedFile = UploadedFile::fake()->create('file', 1024, (new finfo)->file($path, FILEINFO_MIME_TYPE));
5050
if ($fp = $uploadedFile->openFile('w')) {
5151
$fp->fwrite(file_get_contents($path));
5252
}

tests/Feature/Views/ViewTestHelpers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
trait ViewTestHelpers
1111
{
12-
protected function view(string $view, array $args = []): TestView
12+
protected function view(string $view, $args = []): TestView
1313
{
1414
return new TestView(View::make($view, $args));
1515
}

tests/TestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TestCase extends OrchestraTestCase
2323
*/
2424
protected function repairLaravel8Compatibiliy()
2525
{
26-
if (! \Composer\InstalledVersions::satisfies(new \Composer\Semver\VersionParser(), 'illuminate/support', '^8.0')) {
26+
if (! \Composer\InstalledVersions::satisfies(new \Composer\Semver\VersionParser, 'illuminate/support', '^8.0')) {
2727
return;
2828
}
2929

0 commit comments

Comments
 (0)