Skip to content

Commit

Permalink
fix: phpstan variable type
Browse files Browse the repository at this point in the history
  • Loading branch information
pemudakoding authored Dec 19, 2024
1 parent 018552b commit 437b74a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/Actions/Stub/ReplacePlaceholderAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function execute(string $filePath, PlaceholderData $placeholders): void

$resolved = $placeholders->toArray();

/**@var string $stub */
/** @var string $stub */
$stub = $filesystem->get(path: $filePath);

Collection::make($resolved)
Expand All @@ -48,6 +48,7 @@ function ($value, $key) use (&$stub) {
}
);

/** @var string $contents */
$contents = $stub;

$filesystem->ensureDirectoryExists(path: Str::of($filePath)->beforeLast(search: '/'));
Expand Down
4 changes: 2 additions & 2 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ protected function resolveRefactor(): void
$filesystem->ensureDirectoryExists($this->resolveInfrastructurePath());
$filesystem->moveDirectory(from: app_path(path: 'Providers'), to: $this->resolveInfrastructurePath());
$configPath = base_path(path: '/config/app.php');
/**@var string $contents */
/** @var string $contents */
$contents = Str::replace(
search: 'App\\Providers',
replace: $this->resolveNamespace(),
Expand All @@ -92,7 +92,7 @@ protected function resolveRefactor(): void
$filesystem->put(path: $configPath, contents: $contents);

foreach ($filesystem->files($this->resolveInfrastructurePath()) as $file) {
/**@var string $contents */
/** @var string $contents */
$contents = Str::replace(
search: 'App\\Providers',
replace: $this->resolveNamespace(),
Expand Down
12 changes: 6 additions & 6 deletions src/Support/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function resolveApplicationPath(): string

public static function resolveNamespace(NamespaceData $data): string
{
/**@var string $namespace */
/** @var string $namespace */
$namespace = Str::replace(
search: '/',
replace: '\\',
Expand All @@ -68,7 +68,7 @@ public static function resolveNamespaceDir(NamespaceData $data, string $namespac

public static function resolveNamespacePath(string $namespace): string
{
/**@var string $path */
/** @var string $path */
$path = base_path(
path: static::resolveBasePath() . static::transformNamespaceToPath(namespace: $namespace)
);
Expand All @@ -78,7 +78,7 @@ public static function resolveNamespacePath(string $namespace): string

public static function transformNamespaceToPath(string $namespace): string
{
/**@var string $path */
/** @var string $path */
$path = Str::replace(
search: '\\',
replace: '/',
Expand All @@ -90,23 +90,23 @@ public static function transformNamespaceToPath(string $namespace): string

public static function resolveNameFromPHP(string $name): string
{
/**@var string $name */
/** @var string $name */
$name = static::resolveNameFromFile(name: $name, suffix: 'php');

return $name;
}

public static function resolveNameFromFile(string $name, string $suffix): string
{
/**@var string $name */
/** @var string $name */
$name = Str::replace(search: Str::start($suffix, prefix: '.'), replace: '', subject: $name);

return $name;
}

public static function resolveStubForPath(string $name): string
{
/**@var string $path */
/** @var string $path */
$path = Str::replace(search: ':name', replace: $name, subject: __DIR__ . '/../../stubs/:name.stub');

return $path;
Expand Down

0 comments on commit 437b74a

Please sign in to comment.