Passed
Push — master ( a23672...3dee81 )
by Iman
08:02
created

src/helpers.php (3 issues)

1
<?php
2
3
if (! function_exists('render_widget')) {
4
    function render_widget($widget, ...$args)
5
    {
6
        return app(\Imanghafoori\Widgets\Utils\WidgetRenderer::class)->renderWidget($widget, ...$args);
7
    }
8
}
9
10
if (! function_exists('expire_widgets')) {
11
    function expire_widgets($tags)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
12
    {
13
        return app(\Imanghafoori\Widgets\Utils\Cache::class)->expireTaggedWidgets($tags);
0 ignored issues
show
Are you sure the usage of app(Imanghafoori\Widgets...ireTaggedWidgets($tags) targeting Imanghafoori\Widgets\Uti...::expireTaggedWidgets() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
14
    }
15
}
16
17
if (! function_exists('json_widget')) {
18
    function json_widget($widget, ...$args)
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
19
    {
20
        return app(\Imanghafoori\Widgets\Utils\WidgetJsonifier::class)->jsonResponse($widget, ...$args);
21
    }
22
}
23