Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Dec 27, 2021
1 parent 0159454 commit d59899c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -24,6 +24,7 @@
},
"require-dev": {
"illuminate/filesystem": "^8.0",
"nunomaduro/larastan": "^1.0.1",
"orchestra/testbench": "^6.15"
},
"suggest": {
Expand Down
17 changes: 17 additions & 0 deletions phpstan-baseline.neon
@@ -0,0 +1,17 @@
parameters:
ignoreErrors:
-
message: "#^Cannot access offset 'events' on Illuminate\\\\Contracts\\\\Foundation\\\\Application\\.$#"
count: 1
path: src/AssetServiceProvider.php

-
message: "#^Class Laravel\\\\Octane\\\\Events\\\\RequestReceived not found\\.$#"
count: 1
path: src/AssetServiceProvider.php

-
message: "#^Parameter \\#1 \\$dispatcher of class Orchestra\\\\Asset\\\\Factory constructor expects Orchestra\\\\Asset\\\\Dispatcher, mixed given\\.$#"
count: 1
path: src/AssetServiceProvider.php

15 changes: 15 additions & 0 deletions phpstan.neon.dist
@@ -0,0 +1,15 @@
includes:
- ./vendor/nunomaduro/larastan/extension.neon
- ./phpstan-baseline.neon

parameters:

paths:
- src

# The level 8 is the highest level
level: 9

checkMissingIterableValueType: false
noUnnecessaryCollectionCall: false
checkModelProperties: false
4 changes: 2 additions & 2 deletions src/Asset.php
Expand Up @@ -23,7 +23,7 @@ class Asset implements Htmlable
/**
* The asset container path prefix.
*
* @var string
* @var string|null
*/
protected $path = null;

Expand Down Expand Up @@ -133,7 +133,7 @@ public function style(
$attributes = [],
$replaces = []
) {
if (! \array_key_exists('media', $attributes)) {
if (is_array($attributes) && ! \array_key_exists('media', $attributes)) {
$attributes['media'] = 'all';
}

Expand Down
3 changes: 3 additions & 0 deletions src/AssetServiceProvider.php
Expand Up @@ -34,6 +34,9 @@ public function register()
protected function registerAsset(): void
{
$this->app->singleton('orchestra.asset', static function (Container $app) {
/** @var \Orchestra\Asset\Dispatcher $dispatcher */
$dispatcher = $app->make('orchestra.asset.dispatcher');

return new Factory($app->make('orchestra.asset.dispatcher'));
});
}
Expand Down

0 comments on commit d59899c

Please sign in to comment.