1 | <?php |
||||
2 | |||||
3 | use Nip\Container\Container; |
||||
4 | |||||
5 | /** |
||||
6 | * @param $entryName |
||||
7 | * @param null $packageName |
||||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||||
8 | * @param null $entrypointName |
||||
0 ignored issues
–
show
|
|||||
9 | * @return string |
||||
10 | * @noinspection PhpDocMissingThrowsInspection |
||||
11 | */ |
||||
12 | function assets_render_scripts_files($entryName, string $packageName = null, string $entrypointName = '_default') |
||||
13 | { |
||||
14 | 1 | return assets_manager()->renderWebpackScriptTags($entryName, $packageName, $entrypointName); |
|||
0 ignored issues
–
show
It seems like
$packageName can also be of type string ; however, parameter $packageName of ByTIC\Assets\AssetsManag...nderWebpackScriptTags() does only seem to accept null , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
15 | } |
||||
16 | |||||
17 | /** |
||||
18 | * @param $entryName |
||||
19 | * @param string $packageName |
||||
20 | * @param string $entrypointName |
||||
21 | * @return string |
||||
22 | * @noinspection PhpDocMissingThrowsInspection |
||||
23 | */ |
||||
24 | function assets_render_link_files($entryName, string $packageName = null, string $entrypointName = '_default') |
||||
25 | { |
||||
26 | 1 | return assets_manager()->renderWebpackLinkTags($entryName, $packageName, $entrypointName); |
|||
27 | } |
||||
28 | |||||
29 | /** |
||||
30 | * @return \ByTIC\Assets\AssetsManager |
||||
31 | * @throws Exception |
||||
32 | */ |
||||
33 | function assets_manager() |
||||
34 | { |
||||
35 | 3 | $container = function_exists('app') ? app() : Container::getInstance(); |
|||
36 | 3 | if (!$container) { |
|||
37 | /** @noinspection PhpUnhandledExceptionInspection */ |
||||
38 | throw new Exception("No container was found for assets_manager function"); |
||||
39 | } |
||||
40 | |||||
41 | 3 | $manager = $container->get('assets.manager'); |
|||
42 | 3 | if (!$manager) { |
|||
43 | /** @noinspection PhpUnhandledExceptionInspection */ |
||||
44 | throw new Exception("No Assets Manager was found in the container"); |
||||
45 | } |
||||
46 | |||||
47 | 3 | return $manager; |
|||
48 | } |
||||
49 |