Skip to content

Commit e75f238

Browse files
mattstauffergithub-actions[bot]
authored andcommitted
Fix code styling
1 parent 4e672ba commit e75f238

File tree

11 files changed

+32
-32
lines changed

11 files changed

+32
-32
lines changed

cli/Valet/Brew.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ function ($version) use ($resolvedPhpVersion) {
292292
*
293293
* @param string|null $phpVersion For example, "[email protected]"
294294
*/
295-
public function getPhpExecutablePath(string $phpVersion = null): string
295+
public function getPhpExecutablePath(?string $phpVersion = null): string
296296
{
297297
if (! $phpVersion) {
298298
return BREW_PREFIX.'/bin/php';

cli/Valet/CommandLine.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ public function passthru(string $command): void
3333
/**
3434
* Run the given command as the non-root user.
3535
*/
36-
public function run(string $command, callable $onError = null): string
36+
public function run(string $command, ?callable $onError = null): string
3737
{
3838
return $this->runCommand($command, $onError);
3939
}
4040

4141
/**
4242
* Run the given command.
4343
*/
44-
public function runAsUser(string $command, callable $onError = null): string
44+
public function runAsUser(string $command, ?callable $onError = null): string
4545
{
4646
return $this->runCommand('sudo -u "'.user().'" '.$command, $onError);
4747
}
4848

4949
/**
5050
* Run the given command.
5151
*/
52-
public function runCommand(string $command, callable $onError = null): string
52+
public function runCommand(string $command, ?callable $onError = null): string
5353
{
5454
$onError = $onError ?: function () {
5555
};

cli/Valet/Expose.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function __construct(public Composer $composer, public CommandLine $cli)
1111
{
1212
}
1313

14-
public function currentTunnelUrl(string $domain = null): ?string
14+
public function currentTunnelUrl(?string $domain = null): ?string
1515
{
1616
$endpoint = 'http://127.0.0.1:4040/api/tunnels';
1717

cli/Valet/Filesystem.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function isDir(string $path): bool
1919
/**
2020
* Create a directory.
2121
*/
22-
public function mkdir(string $path, string $owner = null, int $mode = 0755): void
22+
public function mkdir(string $path, ?string $owner = null, int $mode = 0755): void
2323
{
2424
mkdir($path, $mode, true);
2525

@@ -31,7 +31,7 @@ public function mkdir(string $path, string $owner = null, int $mode = 0755): voi
3131
/**
3232
* Ensure that the given directory exists.
3333
*/
34-
public function ensureDirExists(string $path, string $owner = null, int $mode = 0755): void
34+
public function ensureDirExists(string $path, ?string $owner = null, int $mode = 0755): void
3535
{
3636
if (! $this->isDir($path)) {
3737
$this->mkdir($path, $owner, $mode);
@@ -49,7 +49,7 @@ public function mkdirAsUser(string $path, int $mode = 0755): void
4949
/**
5050
* Touch the given path.
5151
*/
52-
public function touch(string $path, string $owner = null): string
52+
public function touch(string $path, ?string $owner = null): string
5353
{
5454
touch($path);
5555

@@ -87,7 +87,7 @@ public function get(string $path): string
8787
/**
8888
* Write to the given file.
8989
*/
90-
public function put(string $path, string $contents, string $owner = null): void
90+
public function put(string $path, string $contents, ?string $owner = null): void
9191
{
9292
file_put_contents($path, $contents);
9393

@@ -107,7 +107,7 @@ public function putAsUser(string $path, ?string $contents): void
107107
/**
108108
* Append the contents to the given file.
109109
*/
110-
public function append(string $path, string $contents, string $owner = null): void
110+
public function append(string $path, string $contents, ?string $owner = null): void
111111
{
112112
file_put_contents($path, $contents, FILE_APPEND);
113113

cli/Valet/Ngrok.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct(public CommandLine $cli, public Brew $brew)
2020
/**
2121
* Get the current tunnel URL from the Ngrok API.
2222
*/
23-
public function currentTunnelUrl(string $domain = null): string
23+
public function currentTunnelUrl(?string $domain = null): string
2424
{
2525
// wait a second for ngrok to start before attempting to find available tunnels
2626
sleep(1);

cli/Valet/PhpFpm.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function createConfigurationFiles(string $phpVersion): void
102102
/**
103103
* Restart the PHP FPM process (if one specified) or processes (if none specified).
104104
*/
105-
public function restart(string $phpVersion = null): void
105+
public function restart(?string $phpVersion = null): void
106106
{
107107
$this->brew->restartService($phpVersion ?: $this->utilizedPhpVersions());
108108
}
@@ -122,7 +122,7 @@ public function stop(): void
122122
/**
123123
* Get the path to the FPM configuration file for the current PHP version.
124124
*/
125-
public function fpmConfigPath(string $phpVersion = null): string
125+
public function fpmConfigPath(?string $phpVersion = null): string
126126
{
127127
if (! $phpVersion) {
128128
$phpVersion = $this->brew->linkedPhp();
@@ -152,7 +152,7 @@ public function stopRunning(): void
152152
/**
153153
* Stop a given PHP version, if that specific version isn't being used globally or by any sites.
154154
*/
155-
public function stopIfUnused(string $phpVersion = null): void
155+
public function stopIfUnused(?string $phpVersion = null): void
156156
{
157157
if (! $phpVersion) {
158158
return;
@@ -305,7 +305,7 @@ public function validateRequestedVersion(string $version): string
305305
/**
306306
* Get FPM sock file name for a given PHP version.
307307
*/
308-
public static function fpmSockName(string $phpVersion = null): string
308+
public static function fpmSockName(?string $phpVersion = null): string
309309
{
310310
$versionInteger = preg_replace('~[^\d]~', '', $phpVersion);
311311

cli/Valet/Site.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public function getSiteUrl(string $directory): string
188188
/**
189189
* Identify whether a site is for a proxy by reading the host name from its config file.
190190
*/
191-
public function getProxyHostForSite(string $site, string $configContents = null): ?string
191+
public function getProxyHostForSite(string $site, ?string $configContents = null): ?string
192192
{
193193
$siteConf = $configContents ?: $this->getSiteConfigFileContents($site);
194194

@@ -207,7 +207,7 @@ public function getProxyHostForSite(string $site, string $configContents = null)
207207
/**
208208
* Get the contents of the configuration for the given site.
209209
*/
210-
public function getSiteConfigFileContents(string $site, string $suffix = null): ?string
210+
public function getSiteConfigFileContents(string $site, ?string $suffix = null): ?string
211211
{
212212
$config = $this->config->read();
213213
$suffix = $suffix ?: '.'.$config['tld'];
@@ -219,7 +219,7 @@ public function getSiteConfigFileContents(string $site, string $suffix = null):
219219
/**
220220
* Get all certificates from config folder.
221221
*/
222-
public function getCertificates(string $path = null): Collection
222+
public function getCertificates(?string $path = null): Collection
223223
{
224224
$path = $path ?: $this->certificatesPath();
225225

@@ -283,7 +283,7 @@ public function getSites(string $path, Collection $certs): Collection
283283
/**
284284
* Unlink the given symbolic link.
285285
*/
286-
public function unlink(string $name = null): string
286+
public function unlink(?string $name = null): string
287287
{
288288
$name = $this->getSiteLinkName($name);
289289

@@ -452,7 +452,7 @@ public function isSecured(string $site): bool
452452
*
453453
* @see https://github.com/cabforum/servercert/blob/main/docs/BR.md
454454
*/
455-
public function secure(string $url, string $siteConf = null, int $certificateExpireInDays = 396, int $caExpireInYears = 20): void
455+
public function secure(string $url, ?string $siteConf = null, int $certificateExpireInDays = 396, int $caExpireInYears = 20): void
456456
{
457457
// Extract in order to later preserve custom PHP version config when securing
458458
$phpVersion = $this->customPhpVersion($url);
@@ -628,7 +628,7 @@ public function buildCertificateConf(string $path, string $url): void
628628
/**
629629
* Build the TLS secured Nginx server for the given URL.
630630
*/
631-
public function buildSecureNginxServer(string $url, string $siteConf = null): string
631+
public function buildSecureNginxServer(string $url, ?string $siteConf = null): string
632632
{
633633
if ($siteConf === null) {
634634
$siteConf = $this->replaceOldLoopbackWithNew(
@@ -943,31 +943,31 @@ public function plistPath(): string
943943
/**
944944
* Get the path to Nginx site configuration files.
945945
*/
946-
public function nginxPath(string $additionalPath = null): string
946+
public function nginxPath(?string $additionalPath = null): string
947947
{
948948
return $this->valetHomePath().'/Nginx'.($additionalPath ? '/'.$additionalPath : '');
949949
}
950950

951951
/**
952952
* Get the path to the linked Valet sites.
953953
*/
954-
public function sitesPath(string $link = null): string
954+
public function sitesPath(?string $link = null): string
955955
{
956956
return $this->valetHomePath().'/Sites'.($link ? '/'.$link : '');
957957
}
958958

959959
/**
960960
* Get the path to the Valet CA certificates.
961961
*/
962-
public function caPath(string $caFile = null): string
962+
public function caPath(?string $caFile = null): string
963963
{
964964
return $this->valetHomePath().'/CA'.($caFile ? '/'.$caFile : '');
965965
}
966966

967967
/**
968968
* Get the path to the Valet TLS certificates.
969969
*/
970-
public function certificatesPath(string $url = null, string $extension = null): string
970+
public function certificatesPath(?string $url = null, ?string $extension = null): string
971971
{
972972
$url = $url ? '/'.$url : '';
973973
$extension = $extension ? '.'.$extension : '';
@@ -1051,7 +1051,7 @@ public function replaceSockFile(string $siteConf, string $phpVersion): string
10511051
/**
10521052
* Get configuration items defined in .valetrc for a site.
10531053
*/
1054-
public function valetRc(string $siteName, string $cwd = null): array
1054+
public function valetRc(string $siteName, ?string $cwd = null): array
10551055
{
10561056
if ($cwd) {
10571057
$path = $cwd.'/.valetrc';
@@ -1077,7 +1077,7 @@ public function valetRc(string $siteName, string $cwd = null): array
10771077
/**
10781078
* Get PHP version from .valetrc or .valetphprc for a site.
10791079
*/
1080-
public function phpRcVersion(string $siteName, string $cwd = null): ?string
1080+
public function phpRcVersion(string $siteName, ?string $cwd = null): ?string
10811081
{
10821082
if ($cwd) {
10831083
$oldPath = $cwd.'/.valetphprc';

cli/includes/helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
/**
3333
* Set or get a global console writer.
3434
*/
35-
function writer(OutputInterface $writer = null): OutputInterface|\NullWriter|null
35+
function writer(?OutputInterface $writer = null): OutputInterface|\NullWriter|null
3636
{
3737
$container = Container::getInstance();
3838

find-usable-php.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* @param string|null $phpFormulaName For example, "[email protected]"
5353
* @return string
5454
*/
55-
function getPhpExecutablePath(string $phpFormulaName = null)
55+
function getPhpExecutablePath(?string $phpFormulaName = null)
5656
{
5757
$brewPrefix = exec('printf $(brew --prefix)');
5858

tests/PhpFpmTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ public function test_isolate_will_throw_if_site_is_not_parked_or_linked()
449449

450450
class StubForUpdatingFpmConfigFiles extends PhpFpm
451451
{
452-
public function fpmConfigPath(string $phpVersion = null): string
452+
public function fpmConfigPath(?string $phpVersion = null): string
453453
{
454454
return __DIR__.'/output/fpm.conf';
455455
}

tests/SiteTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,7 @@ public function test_it_can_read_php_rc_version()
11611161

11621162
class CommandLineFake extends CommandLine
11631163
{
1164-
public function runCommand(string $command, callable $onError = null): string
1164+
public function runCommand(string $command, ?callable $onError = null): string
11651165
{
11661166
// noop
11671167
//
@@ -1284,7 +1284,7 @@ public function assertCertificateExistsWithCounterValue($urlWithTld, $counter)
12841284

12851285
class StubForRemovingLinks extends Site
12861286
{
1287-
public function sitesPath(string $additionalPath = null): string
1287+
public function sitesPath(?string $additionalPath = null): string
12881288
{
12891289
return __DIR__.'/output'.($additionalPath ? '/'.$additionalPath : '');
12901290
}

0 commit comments

Comments
 (0)