Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.x] Move Illuminate\Foundation\Application::joinPaths() to Illuminate\Filesystem\join_paths() #49433

Merged
merged 5 commits into from Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -125,6 +125,7 @@
"files": [
"src/Illuminate/Collections/helpers.php",
"src/Illuminate/Events/functions.php",
"src/Illuminate/Filesystem/functions.php",
"src/Illuminate/Foundation/helpers.php",
"src/Illuminate/Support/helpers.php"
],
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Console/MigrationGeneratorCommand.php
Expand Up @@ -5,6 +5,8 @@
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Composer;

use function Illuminate\Filesystem\join_paths;

abstract class MigrationGeneratorCommand extends Command
{
/**
Expand Down Expand Up @@ -114,7 +116,7 @@ protected function replaceMigrationPlaceholders($path, $table)
protected function migrationExists($table)
{
return count($this->files->glob(
$this->laravel->joinPaths($this->laravel->databasePath('migrations'), '*_*_*_*_create_'.$table.'_table.php')
join_paths($this->laravel->databasePath('migrations'), '*_*_*_*_create_'.$table.'_table.php')
)) !== 0;
}
}
5 changes: 4 additions & 1 deletion src/Illuminate/Filesystem/composer.json
Expand Up @@ -24,7 +24,10 @@
"autoload": {
"psr-4": {
"Illuminate\\Filesystem\\": ""
}
},
"files": [
"functions.php"
]
},
"extra": {
"branch-alias": {
Expand Down
17 changes: 17 additions & 0 deletions src/Illuminate/Filesystem/functions.php
@@ -0,0 +1,17 @@
<?php

namespace Illuminate\Filesystem;

if (! function_exists('Illuminate\Filesystem\join_paths')) {
/**
* Join the given paths together.
*
* @param string $basePath
* @param string $path
* @return string
*/
function join_paths($basePath, $path = '')
{
return $basePath.($path != '' ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : '');
}
crynobone marked this conversation as resolved.
Show resolved Hide resolved
}
4 changes: 3 additions & 1 deletion src/Illuminate/Foundation/Application.php
Expand Up @@ -29,6 +29,8 @@
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;

use function Illuminate\Filesystem\join_paths;

class Application extends Container implements ApplicationContract, CachesConfiguration, CachesRoutes, HttpKernelInterface
{
use Macroable;
Expand Down Expand Up @@ -586,7 +588,7 @@ public function viewPath($path = '')
*/
public function joinPaths($basePath, $path = '')
{
return $basePath.($path != '' ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : '');
return join_paths($basePath, $path);
}

/**
Expand Down