Skip to content

Commit d47e718

Browse files
committed
Use "and" instead of "&&" for control flow
1 parent 24c5745 commit d47e718

18 files changed

Lines changed: 40 additions & 40 deletions

src/Composer/Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknow
444444
// as http error codes are all beyond the 255 range of permitted exit codes
445445
if ($e instanceof TransportException) {
446446
$reflProp = new \ReflectionProperty($e, 'code');
447-
(\PHP_VERSION_ID < 80100) && $reflProp->setAccessible(true);
447+
(\PHP_VERSION_ID < 80100) and $reflProp->setAccessible(true);
448448
$reflProp->setValue($e, Installer::ERROR_TRANSPORT_EXCEPTION);
449449
}
450450

src/Composer/Repository/FilesystemRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@ public function write(bool $devMode, InstallationManager $installationManager)
177177
// in memory loaded data from above
178178
try {
179179
$reflProp = new \ReflectionProperty(\Composer\InstalledVersions::class, 'selfDir');
180-
(\PHP_VERSION_ID < 80100) && $reflProp->setAccessible(true);
180+
(\PHP_VERSION_ID < 80100) and $reflProp->setAccessible(true);
181181
$reflProp->setValue(null, strtr($repoDir, '\\', '/'));
182182

183183
$reflProp = new \ReflectionProperty(\Composer\InstalledVersions::class, 'installedIsLocalDir');
184-
(\PHP_VERSION_ID < 80100) && $reflProp->setAccessible(true);
184+
(\PHP_VERSION_ID < 80100) and $reflProp->setAccessible(true);
185185
$reflProp->setValue(null, true);
186186
} catch (\ReflectionException $e) {
187187
if (!Preg::isMatch('{Property .*? does not exist}i', $e->getMessage())) {

tests/Composer/Test/Command/InitCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function testNamespaceFromMissingPackageName(): void
132132
private function callParseAuthorString(InitCommand $command, string $string): array
133133
{
134134
$reflMethod = new \ReflectionMethod($command, 'parseAuthorString');
135-
(\PHP_VERSION_ID < 80100) && $reflMethod->setAccessible(true);
135+
(\PHP_VERSION_ID < 80100) and $reflMethod->setAccessible(true);
136136

137137
return $reflMethod->invoke($command, $string);
138138
}

tests/Composer/Test/Downloader/ArchiveDownloaderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function testGetFileName(): void
2929

3030
$downloader = $this->getArchiveDownloaderMock();
3131
$method = new \ReflectionMethod($downloader, 'getFileName');
32-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
32+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
3333

3434
$this->config->expects($this->any())
3535
->method('get')
@@ -49,7 +49,7 @@ public function testProcessUrl(): void
4949

5050
$downloader = $this->getArchiveDownloaderMock();
5151
$method = new \ReflectionMethod($downloader, 'processUrl');
52-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
52+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
5353

5454
$expected = 'https://github.com/composer/composer/zipball/master';
5555
$url = $method->invoke($downloader, $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(), $expected);
@@ -65,7 +65,7 @@ public function testProcessUrl2(): void
6565

6666
$downloader = $this->getArchiveDownloaderMock();
6767
$method = new \ReflectionMethod($downloader, 'processUrl');
68-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
68+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
6969

7070
$expected = 'https://github.com/composer/composer/archive/master.tar.gz';
7171
$url = $method->invoke($downloader, $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(), $expected);
@@ -81,7 +81,7 @@ public function testProcessUrl3(): void
8181

8282
$downloader = $this->getArchiveDownloaderMock();
8383
$method = new \ReflectionMethod($downloader, 'processUrl');
84-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
84+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
8585

8686
$expected = 'https://api.github.com/repos/composer/composer/zipball/master';
8787
$url = $method->invoke($downloader, $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(), $expected);
@@ -100,7 +100,7 @@ public function testProcessUrlRewriteDist(string $url): void
100100

101101
$downloader = $this->getArchiveDownloaderMock();
102102
$method = new \ReflectionMethod($downloader, 'processUrl');
103-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
103+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
104104

105105
$type = strpos($url, 'tar') ? 'tar' : 'zip';
106106
$expected = 'https://api.github.com/repos/composer/composer/'.$type.'ball/ref';
@@ -137,7 +137,7 @@ public function testProcessUrlRewriteBitbucketDist(string $url, string $extensio
137137

138138
$downloader = $this->getArchiveDownloaderMock();
139139
$method = new \ReflectionMethod($downloader, 'processUrl');
140-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
140+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
141141

142142
$url .= '.' . $extension;
143143
$expected = 'https://bitbucket.org/davereid/drush-virtualhost/get/ref.' . $extension;

tests/Composer/Test/Downloader/DownloadManagerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ public function testGetAvailableSourcesUpdateSticksToSameSource(?string $prevPkg
673673

674674
$manager = new DownloadManager($this->io, false, $this->filesystem);
675675
$method = new \ReflectionMethod($manager, 'getAvailableSources');
676-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
676+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
677677
self::assertEquals($expected, $method->invoke($manager, $target, $initial ?? null));
678678
}
679679

tests/Composer/Test/Downloader/FileDownloaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function testGetFileName(): void
9494
$config = $this->getConfig(['vendor-dir' => '/vendor']);
9595
$downloader = $this->getDownloader(null, $config);
9696
$method = new \ReflectionMethod($downloader, 'getFileName');
97-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
97+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
9898

9999
self::assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $method->invoke($downloader, $package, '/path'));
100100
}
@@ -345,7 +345,7 @@ public function testDownloadFileWithInvalidChecksum(): void
345345

346346
// make sure the file expected to be downloaded is on disk already
347347
$method = new \ReflectionMethod($downloader, 'getFileName');
348-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
348+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
349349
$dlFile = $method->invoke($downloader, $package, $path);
350350
mkdir(dirname($dlFile), 0777, true);
351351
touch($dlFile);
@@ -396,7 +396,7 @@ public function testDowngradeShowsAppropriateMessage(): void
396396

397397
// make sure the file expected to be downloaded is on disk already
398398
$method = new \ReflectionMethod($downloader, 'getFileName');
399-
(\PHP_VERSION_ID < 80100) && $method->setAccessible(true);
399+
(\PHP_VERSION_ID < 80100) and $method->setAccessible(true);
400400
$dlFile = $method->invoke($downloader, $newPackage, $path);
401401
mkdir(dirname($dlFile), 0777, true);
402402
touch($dlFile);

tests/Composer/Test/Downloader/GitDownloaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private function initGitVersion($version): void
5353
{
5454
// reset the static version cache
5555
$refl = new \ReflectionProperty('Composer\Util\Git', 'version');
56-
(\PHP_VERSION_ID < 80100) && $refl->setAccessible(true);
56+
(\PHP_VERSION_ID < 80100) and $refl->setAccessible(true);
5757
$refl->setValue(null, $version);
5858
}
5959

tests/Composer/Test/Downloader/ZipDownloaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function setPrivateProperty(string $name, $value, $obj = null): void
6767
{
6868
$reflectionClass = new \ReflectionClass('Composer\Downloader\ZipDownloader');
6969
$reflectedProperty = $reflectionClass->getProperty($name);
70-
(\PHP_VERSION_ID < 80100) && $reflectedProperty->setAccessible(true);
70+
(\PHP_VERSION_ID < 80100) and $reflectedProperty->setAccessible(true);
7171
$reflectedProperty->setValue($obj, $value);
7272
}
7373

tests/Composer/Test/IO/BufferIOTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function testSetUserInputs(): void
2323
$bufferIO = new BufferIO();
2424

2525
$refl = new \ReflectionProperty($bufferIO, 'input');
26-
(\PHP_VERSION_ID < 80100) && $refl->setAccessible(true);
26+
(\PHP_VERSION_ID < 80100) and $refl->setAccessible(true);
2727
$input = $refl->getValue($bufferIO);
2828

2929
if (!$input instanceof StreamableInputInterface) {

tests/Composer/Test/InstalledVersionsTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ public static function setUpBeforeClass(): void
3131
// disable multiple-ClassLoader-based checks of InstalledVersions by making it seem like no
3232
// class loaders are registered
3333
$prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders');
34-
(\PHP_VERSION_ID < 80100) && $prop->setAccessible(true);
34+
(\PHP_VERSION_ID < 80100) and $prop->setAccessible(true);
3535
self::$previousRegisteredLoaders = $prop->getValue();
3636
$prop->setValue(null, []);
3737
}
3838

3939
public static function tearDownAfterClass(): void
4040
{
4141
$prop = new \ReflectionProperty('Composer\Autoload\ClassLoader', 'registeredLoaders');
42-
(\PHP_VERSION_ID < 80100) && $prop->setAccessible(true);
42+
(\PHP_VERSION_ID < 80100) and $prop->setAccessible(true);
4343
$prop->setValue(null, self::$previousRegisteredLoaders);
4444
InstalledVersions::reload(null); // @phpstan-ignore argument.type
4545
}
@@ -272,11 +272,11 @@ public function testWithClassLoaderLoaded(): void
272272
// disable multiple-ClassLoader-based checks of InstalledVersions by making it seem like no
273273
// class loaders are registered
274274
$prop = new \ReflectionProperty(ClassLoader::class, 'registeredLoaders');
275-
(\PHP_VERSION_ID < 80100) && $prop->setAccessible(true);
275+
(\PHP_VERSION_ID < 80100) and $prop->setAccessible(true);
276276
$prop->setValue(null, array_slice(self::$previousRegisteredLoaders, 0, 1, true));
277277

278278
$prop2 = new \ReflectionProperty(InstalledVersions::class, 'installedIsLocalDir');
279-
(\PHP_VERSION_ID < 80100) && $prop2->setAccessible(true);
279+
(\PHP_VERSION_ID < 80100) and $prop2->setAccessible(true);
280280
$prop2->setValue(null, true);
281281

282282
self::assertFalse(InstalledVersions::isInstalled('foo/bar'));

0 commit comments

Comments
 (0)