Skip to content

Commit

Permalink
Remove warning accessing /proc/mounts on non Linux systems
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Feb 5, 2024
1 parent 837f7a8 commit dced288
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ public function __construct(CacheClearerInterface $cacheClearer, ?Filesystem $fi
$this->filesystem = $filesystem ?? new Filesystem();
}

/**
* {@inheritdoc}
*/
protected function configure()
{
$this
Expand All @@ -71,9 +68,6 @@ protected function configure()
;
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): int
{
$fs = $this->filesystem;
Expand Down Expand Up @@ -204,6 +198,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int

private function isNfs(string $dir): bool
{
if ('Linux' !== \PHP_OS) {
return false;
}

static $mounts = null;

if (null === $mounts) {
Expand All @@ -219,7 +217,7 @@ private function isNfs(string $dir): bool
}
}
foreach ($mounts as $mount) {
if (0 === strpos($dir, $mount)) {
if (str_starts_with($dir, $mount)) {
return true;
}
}
Expand Down

0 comments on commit dced288

Please sign in to comment.