Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Apply rector changes #95

Merged
merged 1 commit into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}
}