Skip to content

Commit

Permalink
[TASK] Apply rector changes (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbertsoft authored Jun 2, 2023
1 parent be217d9 commit 71a1e2e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"fix:php:cs": "@php php-cs-fixer fix",
"fix:php:rector": [
"@composer require --dev rector/rector",
"@php rector process",
"@php rector process --clear-cache",
"@composer remove --dev rector/rector"
]
}
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/TypeTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ private function getType(InputInterface $input): string
throw new \RuntimeException(sprintf($composerManifestError, 'read')); // @codeCoverageIgnore
}

$composerManifest = \json_decode($composerManifest, true);
$composerManifest = \json_decode($composerManifest, true, 512, 0);
if ($composerManifest === false || !is_array($composerManifest)) {
throw new \RuntimeException(sprintf($composerManifestError, 'decoded'));
}
Expand Down
14 changes: 7 additions & 7 deletions tests/Unit/Smoke/InstallViaComposerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testInstallationViaPathIsPossible(): void
{
$filesystem = self::getFilesystem();

$tmpPath = self::getTestPath();
$testPath = self::getTestPath();

$initialComposerFileState = [
'repositories' => [
Expand All @@ -89,13 +89,13 @@ public function testInstallationViaPathIsPossible(): void
];

file_put_contents(
$tmpPath . '/composer.json',
$testPath . '/composer.json',
json_encode($initialComposerFileState, JSON_PRETTY_PRINT)
);

static::assertCommandsWork(self::STEPS_TO_VERIFY_INSTALLATION, $tmpPath);
static::assertCommandsWork(self::STEPS_TO_VERIFY_INSTALLATION, $testPath);

$filesystem->remove($tmpPath);
$filesystem->remove($testPath);
}

// test that respects `export-ignore` from `.gitattributes` file
Expand All @@ -106,7 +106,7 @@ public function testInstallationViaArtifactIsPossible(): void
self::markTestIncomplete('No zip extension available.');
}

$tmpPath = self::getTestPath();
$testPath = self::getTestPath();
$tmpArtifactPath = self::getTestPath();

$fakeVersion = preg_replace('#\-.+#', '', Application::VERSION, 1) . '-alpha987654321';
Expand All @@ -124,7 +124,7 @@ public function testInstallationViaArtifactIsPossible(): void
];

file_put_contents(
$tmpPath . '/composer.json',
$testPath . '/composer.json',
json_encode($initialComposerFileState, JSON_PRETTY_PRINT)
);

Expand All @@ -151,7 +151,7 @@ public function testInstallationViaArtifactIsPossible(): void

static::assertCommandsWork($stepsToInitializeArtifact, $cwd);
static::assertCommandsWork($stepsToPrepareArtifact, $tmpArtifactPath);
static::assertCommandsWork(self::STEPS_TO_VERIFY_INSTALLATION, $tmpPath);
static::assertCommandsWork(self::STEPS_TO_VERIFY_INSTALLATION, $testPath);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions tests/Unit/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ protected static function getFixtureFilename(string $filename): string

protected static function getTestPath(?string $subFolder = null): string
{
$fs = self::getFilesystem();
$filesystem = self::getFilesystem();

$testPath = $fs->tempnam(self::$testPath, 'test_');
$testPath = $filesystem->tempnam(self::$testPath, 'test_');

if ($subFolder !== null) {
$testPath .= '/' . $subFolder;
}

$fs->remove($testPath);
$fs->mkdir($testPath);
$filesystem->remove($testPath);
$filesystem->mkdir($testPath);
\chdir($testPath);

return $testPath;
Expand All @@ -126,10 +126,10 @@ protected static function getFilesystem(): Filesystem
*/
protected static function createFiles(string $testPath, array $files): void
{
$fs = self::getFilesystem();
$filesystem = self::getFilesystem();

foreach ($files as $target => $source) {
$fs->copy(static::getFilename($source), $testPath . '/' . $target);
$filesystem->copy(static::getFilename($source), $testPath . '/' . $target);
}
}
}

0 comments on commit 71a1e2e

Please sign in to comment.