Revert "Fix StringBlade errors with a stub file" (#12776)

This reverts parts of commit 165c4fd53c.
This commit is contained in:
Jellyfrog 2021-04-21 23:22:15 +02:00 committed by GitHub
parent 165c4fd53c
commit 3e3aa9077e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 20 additions and 21 deletions

View File

@ -26,7 +26,6 @@ namespace LibreNMS\Alert;
use App\Models\AlertTemplate;
use LibreNMS\Enum\AlertState;
use Wpb\String_Blade_Compiler\Facades\StringBlade as View;
class Template
{
@ -74,9 +73,9 @@ class Template
{
$alert['alert'] = new AlertData($data['alert']);
try {
return View::make(['template' => $data['template']->template], $alert)->__toString();
return view(['template' => $data['template']->template], $alert)->__toString();
} catch (\Exception $e) {
return View::make(['template' => $this->getDefaultTemplate()], $alert)->__toString();
return view(['template' => $this->getDefaultTemplate()], $alert)->__toString();
}
}
@ -90,9 +89,9 @@ class Template
{
$alert['alert'] = new AlertData($data['alert']);
try {
return View::make(['template' => $data['title']], $alert)->__toString();
return view(['template' => $data['title']], $alert)->__toString();
} catch (\Exception $e) {
return $data['title'] ?: View::make(['template' => 'Template ' . $data['name']], $alert)->__toString();
return $data['title'] ?: view(['template' => 'Template ' . $data['name']], $alert)->__toString();
}
}

View File

@ -13,7 +13,6 @@ use Illuminate\Support\Facades\Auth;
use LibreNMS\Config;
use LibreNMS\Util\Graph;
use LibreNMS\Util\Url;
use Wpb\String_Blade_Compiler\Facades\StringBlade as View;
class DeviceController extends Controller
{
@ -166,7 +165,7 @@ class DeviceController extends Controller
foreach (array_values(Arr::wrap(Config::get('html.device.links'))) as $index => $link) {
$device_links['custom' . ($index + 1)] = [
'icon' => $link['icon'] ?? 'fa-external-link',
'url' => View::make(['template' => $link['url']], ['device' => $device])->__toString(),
'url' => view(['template' => $link['url']], ['device' => $device])->__toString(),
'title' => $link['title'],
'external' => $link['external'] ?? true,
];

View File

@ -1,5 +1,15 @@
parameters:
ignoreErrors:
-
message: "#^Parameter \\#1 \\$view of function view expects view\\-string\\|null, array\\<string, mixed\\> given\\.$#"
count: 2
path: LibreNMS/Alert/Template.php
-
message: "#^Parameter \\#1 \\$view of function view expects view\\-string\\|null, array\\<string, string\\> given\\.$#"
count: 2
path: LibreNMS/Alert/Template.php
-
message: "#^Call to function is_null\\(\\) with string will always evaluate to false\\.$#"
count: 1
@ -215,6 +225,11 @@ parameters:
count: 1
path: app/Console/LnmsCommand.php
-
message: "#^Parameter \\#1 \\$view of function view expects view\\-string\\|null, array\\<string, mixed\\> given\\.$#"
count: 1
path: app/Http/Controllers/DeviceController.php
-
message: "#^Call to function is_null\\(\\) with PDO will always evaluate to false\\.$#"
count: 1

View File

@ -26,6 +26,3 @@ parameters:
parallel:
processTimeout: 300.0
stubFiles:
- tests/stubs/StringBlade.stub

View File

@ -1,11 +0,0 @@
<?php
namespace Wpb\String_Blade_Compiler\Facades;
use Illuminate\Support\Facades\Facade;
/**
* @method static \Wpb\String_Blade_Compiler\StringView make(string|array $view, array $data = [], array $mergeData = [])
*/
class StringBlade extends Facade {}