1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 00:10:07 +01:00

Fix code styling

This commit is contained in:
mattstauffer
2023-12-21 03:25:35 +00:00
committed by github-actions[bot]
parent 4e672ba05b
commit e75f238b22
11 changed files with 32 additions and 32 deletions

View File

@@ -292,7 +292,7 @@ function ($version) use ($resolvedPhpVersion) {
*
* @param string|null $phpVersion For example, "php@8.1"
*/
public function getPhpExecutablePath(string $phpVersion = null): string
public function getPhpExecutablePath(?string $phpVersion = null): string
{
if (! $phpVersion) {
return BREW_PREFIX.'/bin/php';

View File

@@ -33,7 +33,7 @@ public function passthru(string $command): void
/**
* Run the given command as the non-root user.
*/
public function run(string $command, callable $onError = null): string
public function run(string $command, ?callable $onError = null): string
{
return $this->runCommand($command, $onError);
}
@@ -41,7 +41,7 @@ public function run(string $command, callable $onError = null): string
/**
* Run the given command.
*/
public function runAsUser(string $command, callable $onError = null): string
public function runAsUser(string $command, ?callable $onError = null): string
{
return $this->runCommand('sudo -u "'.user().'" '.$command, $onError);
}
@@ -49,7 +49,7 @@ public function runAsUser(string $command, callable $onError = null): string
/**
* Run the given command.
*/
public function runCommand(string $command, callable $onError = null): string
public function runCommand(string $command, ?callable $onError = null): string
{
$onError = $onError ?: function () {
};

View File

@@ -11,7 +11,7 @@ public function __construct(public Composer $composer, public CommandLine $cli)
{
}
public function currentTunnelUrl(string $domain = null): ?string
public function currentTunnelUrl(?string $domain = null): ?string
{
$endpoint = 'http://127.0.0.1:4040/api/tunnels';

View File

@@ -19,7 +19,7 @@ public function isDir(string $path): bool
/**
* Create a directory.
*/
public function mkdir(string $path, string $owner = null, int $mode = 0755): void
public function mkdir(string $path, ?string $owner = null, int $mode = 0755): void
{
mkdir($path, $mode, true);
@@ -31,7 +31,7 @@ public function mkdir(string $path, string $owner = null, int $mode = 0755): voi
/**
* Ensure that the given directory exists.
*/
public function ensureDirExists(string $path, string $owner = null, int $mode = 0755): void
public function ensureDirExists(string $path, ?string $owner = null, int $mode = 0755): void
{
if (! $this->isDir($path)) {
$this->mkdir($path, $owner, $mode);
@@ -49,7 +49,7 @@ public function mkdirAsUser(string $path, int $mode = 0755): void
/**
* Touch the given path.
*/
public function touch(string $path, string $owner = null): string
public function touch(string $path, ?string $owner = null): string
{
touch($path);
@@ -87,7 +87,7 @@ public function get(string $path): string
/**
* Write to the given file.
*/
public function put(string $path, string $contents, string $owner = null): void
public function put(string $path, string $contents, ?string $owner = null): void
{
file_put_contents($path, $contents);
@@ -107,7 +107,7 @@ public function putAsUser(string $path, ?string $contents): void
/**
* Append the contents to the given file.
*/
public function append(string $path, string $contents, string $owner = null): void
public function append(string $path, string $contents, ?string $owner = null): void
{
file_put_contents($path, $contents, FILE_APPEND);

View File

@@ -20,7 +20,7 @@ public function __construct(public CommandLine $cli, public Brew $brew)
/**
* Get the current tunnel URL from the Ngrok API.
*/
public function currentTunnelUrl(string $domain = null): string
public function currentTunnelUrl(?string $domain = null): string
{
// wait a second for ngrok to start before attempting to find available tunnels
sleep(1);

View File

@@ -102,7 +102,7 @@ public function createConfigurationFiles(string $phpVersion): void
/**
* Restart the PHP FPM process (if one specified) or processes (if none specified).
*/
public function restart(string $phpVersion = null): void
public function restart(?string $phpVersion = null): void
{
$this->brew->restartService($phpVersion ?: $this->utilizedPhpVersions());
}
@@ -122,7 +122,7 @@ public function stop(): void
/**
* Get the path to the FPM configuration file for the current PHP version.
*/
public function fpmConfigPath(string $phpVersion = null): string
public function fpmConfigPath(?string $phpVersion = null): string
{
if (! $phpVersion) {
$phpVersion = $this->brew->linkedPhp();
@@ -152,7 +152,7 @@ public function stopRunning(): void
/**
* Stop a given PHP version, if that specific version isn't being used globally or by any sites.
*/
public function stopIfUnused(string $phpVersion = null): void
public function stopIfUnused(?string $phpVersion = null): void
{
if (! $phpVersion) {
return;
@@ -305,7 +305,7 @@ public function validateRequestedVersion(string $version): string
/**
* Get FPM sock file name for a given PHP version.
*/
public static function fpmSockName(string $phpVersion = null): string
public static function fpmSockName(?string $phpVersion = null): string
{
$versionInteger = preg_replace('~[^\d]~', '', $phpVersion);

View File

@@ -188,7 +188,7 @@ public function getSiteUrl(string $directory): string
/**
* Identify whether a site is for a proxy by reading the host name from its config file.
*/
public function getProxyHostForSite(string $site, string $configContents = null): ?string
public function getProxyHostForSite(string $site, ?string $configContents = null): ?string
{
$siteConf = $configContents ?: $this->getSiteConfigFileContents($site);
@@ -207,7 +207,7 @@ public function getProxyHostForSite(string $site, string $configContents = null)
/**
* Get the contents of the configuration for the given site.
*/
public function getSiteConfigFileContents(string $site, string $suffix = null): ?string
public function getSiteConfigFileContents(string $site, ?string $suffix = null): ?string
{
$config = $this->config->read();
$suffix = $suffix ?: '.'.$config['tld'];
@@ -219,7 +219,7 @@ public function getSiteConfigFileContents(string $site, string $suffix = null):
/**
* Get all certificates from config folder.
*/
public function getCertificates(string $path = null): Collection
public function getCertificates(?string $path = null): Collection
{
$path = $path ?: $this->certificatesPath();
@@ -283,7 +283,7 @@ public function getSites(string $path, Collection $certs): Collection
/**
* Unlink the given symbolic link.
*/
public function unlink(string $name = null): string
public function unlink(?string $name = null): string
{
$name = $this->getSiteLinkName($name);
@@ -452,7 +452,7 @@ public function isSecured(string $site): bool
*
* @see https://github.com/cabforum/servercert/blob/main/docs/BR.md
*/
public function secure(string $url, string $siteConf = null, int $certificateExpireInDays = 396, int $caExpireInYears = 20): void
public function secure(string $url, ?string $siteConf = null, int $certificateExpireInDays = 396, int $caExpireInYears = 20): void
{
// Extract in order to later preserve custom PHP version config when securing
$phpVersion = $this->customPhpVersion($url);
@@ -628,7 +628,7 @@ public function buildCertificateConf(string $path, string $url): void
/**
* Build the TLS secured Nginx server for the given URL.
*/
public function buildSecureNginxServer(string $url, string $siteConf = null): string
public function buildSecureNginxServer(string $url, ?string $siteConf = null): string
{
if ($siteConf === null) {
$siteConf = $this->replaceOldLoopbackWithNew(
@@ -943,7 +943,7 @@ public function plistPath(): string
/**
* Get the path to Nginx site configuration files.
*/
public function nginxPath(string $additionalPath = null): string
public function nginxPath(?string $additionalPath = null): string
{
return $this->valetHomePath().'/Nginx'.($additionalPath ? '/'.$additionalPath : '');
}
@@ -951,7 +951,7 @@ public function nginxPath(string $additionalPath = null): string
/**
* Get the path to the linked Valet sites.
*/
public function sitesPath(string $link = null): string
public function sitesPath(?string $link = null): string
{
return $this->valetHomePath().'/Sites'.($link ? '/'.$link : '');
}
@@ -959,7 +959,7 @@ public function sitesPath(string $link = null): string
/**
* Get the path to the Valet CA certificates.
*/
public function caPath(string $caFile = null): string
public function caPath(?string $caFile = null): string
{
return $this->valetHomePath().'/CA'.($caFile ? '/'.$caFile : '');
}
@@ -967,7 +967,7 @@ public function caPath(string $caFile = null): string
/**
* Get the path to the Valet TLS certificates.
*/
public function certificatesPath(string $url = null, string $extension = null): string
public function certificatesPath(?string $url = null, ?string $extension = null): string
{
$url = $url ? '/'.$url : '';
$extension = $extension ? '.'.$extension : '';
@@ -1051,7 +1051,7 @@ public function replaceSockFile(string $siteConf, string $phpVersion): string
/**
* Get configuration items defined in .valetrc for a site.
*/
public function valetRc(string $siteName, string $cwd = null): array
public function valetRc(string $siteName, ?string $cwd = null): array
{
if ($cwd) {
$path = $cwd.'/.valetrc';
@@ -1077,7 +1077,7 @@ public function valetRc(string $siteName, string $cwd = null): array
/**
* Get PHP version from .valetrc or .valetphprc for a site.
*/
public function phpRcVersion(string $siteName, string $cwd = null): ?string
public function phpRcVersion(string $siteName, ?string $cwd = null): ?string
{
if ($cwd) {
$oldPath = $cwd.'/.valetphprc';

View File

@@ -32,7 +32,7 @@
/**
* Set or get a global console writer.
*/
function writer(OutputInterface $writer = null): OutputInterface|\NullWriter|null
function writer(?OutputInterface $writer = null): OutputInterface|\NullWriter|null
{
$container = Container::getInstance();

View File

@@ -52,7 +52,7 @@
* @param string|null $phpFormulaName For example, "php@8.1"
* @return string
*/
function getPhpExecutablePath(string $phpFormulaName = null)
function getPhpExecutablePath(?string $phpFormulaName = null)
{
$brewPrefix = exec('printf $(brew --prefix)');

View File

@@ -449,7 +449,7 @@ public function test_isolate_will_throw_if_site_is_not_parked_or_linked()
class StubForUpdatingFpmConfigFiles extends PhpFpm
{
public function fpmConfigPath(string $phpVersion = null): string
public function fpmConfigPath(?string $phpVersion = null): string
{
return __DIR__.'/output/fpm.conf';
}

View File

@@ -1161,7 +1161,7 @@ public function test_it_can_read_php_rc_version()
class CommandLineFake extends CommandLine
{
public function runCommand(string $command, callable $onError = null): string
public function runCommand(string $command, ?callable $onError = null): string
{
// noop
//
@@ -1284,7 +1284,7 @@ public function assertCertificateExistsWithCounterValue($urlWithTld, $counter)
class StubForRemovingLinks extends Site
{
public function sitesPath(string $additionalPath = null): string
public function sitesPath(?string $additionalPath = null): string
{
return __DIR__.'/output'.($additionalPath ? '/'.$additionalPath : '');
}