Skip to content

Commit 7d488f0

Browse files
fix cs
1 parent 906235e commit 7d488f0

11 files changed

+38
-38
lines changed

src/Configurator/AbstractConfigurator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ abstract public function unconfigure(Recipe $recipe, $config);
4141

4242
protected function write($messages)
4343
{
44-
if (!is_array($messages)) {
44+
if (!\is_array($messages)) {
4545
$messages = [$messages];
4646
}
4747
foreach ($messages as $i => $message) {

src/Configurator/BundlesConfigurator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private function parse(array $manifest, array $registered): array
6868
private function load(string $file): array
6969
{
7070
$bundles = file_exists($file) ? (require $file) : [];
71-
if (!is_array($bundles)) {
71+
if (!\is_array($bundles)) {
7272
$bundles = [];
7373
}
7474

@@ -87,13 +87,13 @@ private function dump(string $file, array $bundles)
8787
}
8888
$contents .= "];\n";
8989

90-
if (!is_dir(dirname($file))) {
91-
mkdir(dirname($file), 0777, true);
90+
if (!is_dir(\dirname($file))) {
91+
mkdir(\dirname($file), 0777, true);
9292
}
9393

9494
file_put_contents($file, $contents);
9595

96-
if (function_exists('opcache_invalidate')) {
96+
if (\function_exists('opcache_invalidate')) {
9797
opcache_invalidate($file);
9898
}
9999
}

src/Configurator/CopyFromPackageConfigurator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ private function copyFiles(array $manifest, string $from, string $to)
4141
$this->copyDir($this->path->concatenate([$from, $source]), $this->path->concatenate([$to, $target]));
4242
} else {
4343
$targetPath = $this->path->concatenate([$to, $target]);
44-
if (!is_dir(dirname($targetPath))) {
45-
mkdir(dirname($targetPath), 0777, true);
46-
$this->write(sprintf('Created <fg=green>"%s"</>', $this->path->relativize(dirname($targetPath))));
44+
if (!is_dir(\dirname($targetPath))) {
45+
mkdir(\dirname($targetPath), 0777, true);
46+
$this->write(sprintf('Created <fg=green>"%s"</>', $this->path->relativize(\dirname($targetPath))));
4747
}
4848

4949
if (!file_exists($targetPath)) {

src/Configurator/CopyFromRecipeConfigurator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ private function copyDir(string $source, string $target, array $files)
4646
{
4747
foreach ($files as $file => $data) {
4848
if (0 === strpos($file, $source)) {
49-
$file = $this->path->concatenate([$target, substr($file, strlen($source))]);
49+
$file = $this->path->concatenate([$target, substr($file, \strlen($source))]);
5050
$this->copyFile($file, $data['contents'], $data['executable']);
5151
}
5252
}
@@ -58,8 +58,8 @@ private function copyFile(string $to, string $contents, bool $executable)
5858
return;
5959
}
6060

61-
if (!is_dir(dirname($to))) {
62-
mkdir(dirname($to), 0777, true);
61+
if (!is_dir(\dirname($to))) {
62+
mkdir(\dirname($to), 0777, true);
6363
}
6464

6565
file_put_contents($to, $contents);
@@ -83,7 +83,7 @@ private function removeFiles(array $manifest, array $files, string $to)
8383
if ('/' === substr($source, -1)) {
8484
foreach (array_keys($files) as $file) {
8585
if (0 === strpos($file, $source)) {
86-
$this->removeFile($this->path->concatenate([$to, $target, substr($file, strlen($source))]));
86+
$this->removeFile($this->path->concatenate([$to, $target, substr($file, \strlen($source))]));
8787
}
8888
}
8989
} else {
@@ -101,8 +101,8 @@ private function removeFile(string $to)
101101
@unlink($to);
102102
$this->write(sprintf('Removed <fg=green>"%s"</>', $this->path->relativize($to)));
103103

104-
if (0 === count(glob(dirname($to).'/*', GLOB_NOSORT))) {
105-
@rmdir(dirname($to));
104+
if (0 === \count(glob(\dirname($to).'/*', GLOB_NOSORT))) {
105+
@rmdir(\dirname($to));
106106
}
107107
}
108108
}

src/CurlDownloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct()
4949
{
5050
$this->multiHandle = $mh = curl_multi_init();
5151
curl_multi_setopt($mh, CURLMOPT_PIPELINING, /*CURLPIPE_HTTP1 | CURLPIPE_MULTIPLEX*/ 3);
52-
if (defined('CURLMOPT_MAX_HOST_CONNECTIONS')) {
52+
if (\defined('CURLMOPT_MAX_HOST_CONNECTIONS')) {
5353
curl_multi_setopt($mh, CURLMOPT_MAX_HOST_CONNECTIONS, 8);
5454
}
5555

src/Downloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function getRecipes(array $operations): array
112112
if ($date = $package->getReleaseDate()) {
113113
$path .= ','.$date->format('U');
114114
}
115-
if (strlen($chunk) + strlen($path) > self::$MAX_LENGTH) {
115+
if (\strlen($chunk) + \strlen($path) > self::$MAX_LENGTH) {
116116
$paths[] = ['/p/'.$chunk];
117117
$chunk = $path;
118118
} elseif ($chunk) {

src/Flex.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Flex implements PluginInterface, EventSubscriberInterface
8383

8484
public function activate(Composer $composer, IOInterface $io)
8585
{
86-
if (!extension_loaded('openssl')) {
86+
if (!\extension_loaded('openssl')) {
8787
self::$activated = false;
8888
$io->writeError('<warning>Symfony Flex has been disabled. You must enable the openssl extension in your "php.ini" file.</warning>');
8989

@@ -133,7 +133,7 @@ public function activate(Composer $composer, IOInterface $io)
133133
$populateRepoCacheDir = __CLASS__ === self::class;
134134
if ($composer->getPluginManager()) {
135135
foreach ($composer->getPluginManager()->getPlugins() as $plugin) {
136-
if (0 === strpos(get_class($plugin), 'Hirak\Prestissimo\Plugin')) {
136+
if (0 === strpos(\get_class($plugin), 'Hirak\Prestissimo\Plugin')) {
137137
if (method_exists($rfs, 'getRemoteContents')) {
138138
$plugin->disable();
139139
} else {
@@ -255,7 +255,7 @@ public function record(PackageEvent $event)
255255
}
256256

257257
$operation = $event->getOperation();
258-
if ($operation instanceof InstallOperation && in_array($packageName = $operation->getPackage()->getName(), ['symfony/framework-bundle', 'symfony/flex'])) {
258+
if ($operation instanceof InstallOperation && \in_array($packageName = $operation->getPackage()->getName(), ['symfony/framework-bundle', 'symfony/flex'])) {
259259
if ('symfony/flex' === $packageName) {
260260
array_unshift($this->operations, $operation);
261261
} else {
@@ -291,7 +291,7 @@ public function update(Event $event, $operations = [])
291291

292292
list($recipes, $vulnerabilities) = $this->fetchRecipes();
293293
if ($vulnerabilities) {
294-
$this->io->writeError(sprintf('<info>Vulnerabilities: %d package%s</>', count($vulnerabilities), count($recipes) > 1 ? 's' : ''));
294+
$this->io->writeError(sprintf('<info>Vulnerabilities: %d package%s</>', \count($vulnerabilities), \count($recipes) > 1 ? 's' : ''));
295295
}
296296
foreach ($vulnerabilities as $name => $vulns) {
297297
foreach ($vulns as $v) {
@@ -315,7 +315,7 @@ public function update(Event $event, $operations = [])
315315
return;
316316
}
317317

318-
$this->io->writeError(sprintf('<info>Symfony operations: %d recipe%s (%s)</>', count($recipes), count($recipes) > 1 ? 's' : '', $this->downloader->getSessionId()));
318+
$this->io->writeError(sprintf('<info>Symfony operations: %d recipe%s (%s)</>', \count($recipes), \count($recipes) > 1 ? 's' : '', $this->downloader->getSessionId()));
319319
$installContribs = $this->composer->getPackage()->getExtra()['symfony']['allow-contrib'] ?? false;
320320
$manifest = null;
321321
foreach ($recipes as $recipe) {
@@ -338,7 +338,7 @@ function ($value) {
338338
return 'n';
339339
}
340340
$value = strtolower($value[0]);
341-
if (!in_array($value, ['y', 'n', 'a', 'p'])) {
341+
if (!\in_array($value, ['y', 'n', 'a', 'p'])) {
342342
throw new \InvalidArgumentException('Invalid choice');
343343
}
344344

@@ -514,9 +514,9 @@ public function populateFilesCacheDir(InstallerEvent $event)
514514
continue;
515515
}
516516

517-
@mkdir(dirname($file), 0775, true);
517+
@mkdir(\dirname($file), 0775, true);
518518

519-
if (!is_dir(dirname($file))) {
519+
if (!is_dir(\dirname($file))) {
520520
continue;
521521
}
522522

@@ -527,7 +527,7 @@ public function populateFilesCacheDir(InstallerEvent $event)
527527
$downloads[] = [$originUrl, $fileUrl, [], $file, false];
528528
}
529529

530-
if (1 < count($downloads)) {
530+
if (1 < \count($downloads)) {
531531
$this->rfs->download($downloads, [$this->rfs, 'get'], false, $this->progress);
532532
}
533533
}
@@ -597,7 +597,7 @@ private function fetchRecipes(): array
597597
if (null === $devPackages) {
598598
$devPackages = array_column($this->composer->getLocker()->getLockData()['packages-dev'], 'name');
599599
}
600-
$envs = in_array($name, $devPackages) ? ['dev', 'test'] : ['all'];
600+
$envs = \in_array($name, $devPackages) ? ['dev', 'test'] : ['all'];
601601
foreach ($bundle->getClassNames() as $class) {
602602
$manifest['manifest']['bundles'][$class] = $envs;
603603
}

src/PackageResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function resolve(array $arguments = [], bool $isRequire = false): array
6161
$versionParser->parseConstraints($argument);
6262
} catch (\UnexpectedValueException $e) {
6363
// is it a special Symfony version?
64-
if (!in_array($argument, self::$SYMFONY_VERSIONS, true)) {
64+
if (!\in_array($argument, self::$SYMFONY_VERSIONS, true)) {
6565
$this->throwAlternatives($argument, $i);
6666
}
6767
}
@@ -105,7 +105,7 @@ private function parseVersion(string $package, string $version, bool $isRequire)
105105
$version = $config['require']['symfony/framework-bundle'];
106106
} elseif ('next' === $version) {
107107
$version = '^'.self::$versions[$version].'@dev';
108-
} elseif (in_array($version, self::$SYMFONY_VERSIONS, true)) {
108+
} elseif (\in_array($version, self::$SYMFONY_VERSIONS, true)) {
109109
$version = '^'.self::$versions[$version];
110110
}
111111

@@ -120,7 +120,7 @@ private function throwAlternatives(string $argument, int $position)
120120
$alternatives = [];
121121
foreach (self::$aliases as $alias => $package) {
122122
$lev = levenshtein($argument, $alias);
123-
if ($lev <= strlen($argument) / 3 || false !== strpos($alias, $argument)) {
123+
if ($lev <= \strlen($argument) / 3 || false !== strpos($alias, $argument)) {
124124
$alternatives[$package][] = $alias;
125125
}
126126
}
@@ -129,7 +129,7 @@ private function throwAlternatives(string $argument, int $position)
129129
if ($alternatives || 0 === $position) {
130130
$message = sprintf('"%s" is not a valid alias.', $argument);
131131
if ($alternatives) {
132-
if (1 === count($alternatives)) {
132+
if (1 === \count($alternatives)) {
133133
$message .= " Did you mean this:\n";
134134
} else {
135135
$message .= " Did you mean one of these:\n";

src/ParallelDownloader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(IOInterface $io, Config $config, array $options = []
4242
$this->io = $io;
4343
if (!method_exists(parent::class, 'getRemoteContents')) {
4444
$this->io->writeError('Composer >=1.7 not found, downloads will happen in sequence', true, IOInterface::DEBUG);
45-
} elseif (!extension_loaded('curl')) {
45+
} elseif (!\extension_loaded('curl')) {
4646
$this->io->writeError('ext-curl not found, downloads will happen in sequence', true, IOInterface::DEBUG);
4747
} else {
4848
$this->downloader = new CurlDownloader();
@@ -55,7 +55,7 @@ public function download(array &$nextArgs, callable $nextCallback, bool $quiet =
5555
$previousState = [$this->quiet, $this->progress, $this->downloadCount, $this->nextCallback, $this->sharedState];
5656
$this->quiet = $quiet;
5757
$this->progress = $progress;
58-
$this->downloadCount = count($nextArgs);
58+
$this->downloadCount = \count($nextArgs);
5959
$this->nextCallback = $nextCallback;
6060
$this->sharedState = (object) [
6161
'bytesMaxCount' => 0,

src/SymfonyBundle.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getClassNames(): array
4141
}
4242

4343
foreach ($autoload[$psr] as $namespace => $paths) {
44-
if (!is_array($paths)) {
44+
if (!\is_array($paths)) {
4545
$paths = [$paths];
4646
}
4747
foreach ($paths as $path) {
@@ -71,13 +71,13 @@ private function extractClassNames(string $namespace): array
7171
$namespace = trim($namespace, '\\');
7272
$class = $namespace.'\\';
7373
$parts = explode('\\', $namespace);
74-
$suffix = $parts[count($parts) - 1];
74+
$suffix = $parts[\count($parts) - 1];
7575
if ('Bundle' !== substr($suffix, -6)) {
7676
$suffix .= 'Bundle';
7777
}
7878
$classes = [$class.$suffix];
7979
$acc = '';
80-
foreach (array_slice($parts, 0, -1) as $part) {
80+
foreach (\array_slice($parts, 0, -1) as $part) {
8181
if ('Bundle' === $part) {
8282
continue;
8383
}
@@ -93,9 +93,9 @@ private function checkClassExists(string $class, string $path, bool $isPsr4): bo
9393
{
9494
$classPath = ($this->vendorDir ? $this->vendorDir.'/' : '').$this->package->getPrettyName().'/'.$path.'/';
9595
$parts = explode('\\', $class);
96-
$class = $parts[count($parts) - 1];
96+
$class = $parts[\count($parts) - 1];
9797
if (!$isPsr4) {
98-
$classPath .= str_replace('\\', '', implode('/', array_slice($parts, 0, -1))).'/';
98+
$classPath .= str_replace('\\', '', implode('/', \array_slice($parts, 0, -1))).'/';
9999
}
100100
$classPath .= str_replace('\\', '/', $class).'.php';
101101

src/Unpacker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function unpack(Operation $op): Result
4040
null === $pkg ||
4141
'symfony-pack' !== $pkg->getType() ||
4242
!$op->shouldUnpack() ||
43-
0 === count($pkg->getRequires()) + count($pkg->getDevRequires())
43+
0 === \count($pkg->getRequires()) + \count($pkg->getDevRequires())
4444
) {
4545
$result->addRequired($package['name'].($package['version'] ? ':'.$package['version'] : ''));
4646

0 commit comments

Comments
 (0)