Skip to content

Commit 2fc5490

Browse files
committed
Resolve PHPStan error
1 parent 70ae254 commit 2fc5490

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

phpstan.src.neon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ includes:
44
- vendor/phpstan/phpstan-phpunit/rules.neon
55
parameters:
66
reportUnmatchedIgnoredErrors: true
7-
checkMissingIterableValueType: false
7+
ignoreErrors:
8+
- identifier: missingType.iterableValue

phpstan.tests.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ includes:
66
parameters:
77
ignoreErrors:
88
- '#Cannot call method expectsOutput\(\) on Illuminate\\Testing\\PendingCommand\|int.#'
9+
- identifier: missingType.iterableValue
910
reportUnmatchedIgnoredErrors: true
10-
checkMissingIterableValueType: false

src/ServiceProvider.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ class ServiceProvider extends BaseServiceProvider
1818
*/
1919
public function register(): void
2020
{
21-
if (! defined('LARAVEL_PDP_PATH')) {
22-
define('LARAVEL_PDP_PATH', realpath(__DIR__.'/../'));
23-
}
24-
2521
$this->mergeConfigFrom(
26-
LARAVEL_PDP_PATH.'/config/domain-parser.php', 'domain-parser'
22+
$this->basePath().'/config/domain-parser.php', 'domain-parser'
2723
);
2824

2925
$this->app->singleton('pdp.parser', function ($app) {
@@ -117,8 +113,13 @@ protected function offerPublishing(): void
117113
{
118114
if ($this->app->runningInConsole()) {
119115
$this->publishes([
120-
LARAVEL_PDP_PATH.'/config/domain-parser.php' => config_path('domain-parser.php'),
116+
$this->basePath().'/config/domain-parser.php' => config_path('domain-parser.php'),
121117
], 'config');
122118
}
123119
}
120+
121+
private function basePath(): string
122+
{
123+
return realpath(rtrim(__DIR__, '/').'/../') ?: '/../';
124+
}
124125
}

0 commit comments

Comments
 (0)