diff --git a/composer.json b/composer.json index 626a870..b20d16e 100644 --- a/composer.json +++ b/composer.json @@ -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" ] } diff --git a/src/Console/Command/TypeTrait.php b/src/Console/Command/TypeTrait.php index b37b323..623f260 100644 --- a/src/Console/Command/TypeTrait.php +++ b/src/Console/Command/TypeTrait.php @@ -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')); } diff --git a/tests/Unit/Smoke/InstallViaComposerTest.php b/tests/Unit/Smoke/InstallViaComposerTest.php index 7070357..4788415 100644 --- a/tests/Unit/Smoke/InstallViaComposerTest.php +++ b/tests/Unit/Smoke/InstallViaComposerTest.php @@ -74,7 +74,7 @@ public function testInstallationViaPathIsPossible(): void { $filesystem = self::getFilesystem(); - $tmpPath = self::getTestPath(); + $testPath = self::getTestPath(); $initialComposerFileState = [ 'repositories' => [ @@ -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 @@ -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'; @@ -124,7 +124,7 @@ public function testInstallationViaArtifactIsPossible(): void ]; file_put_contents( - $tmpPath . '/composer.json', + $testPath . '/composer.json', json_encode($initialComposerFileState, JSON_PRETTY_PRINT) ); @@ -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); } /** diff --git a/tests/Unit/TestCase.php b/tests/Unit/TestCase.php index 17750c9..753aad8 100644 --- a/tests/Unit/TestCase.php +++ b/tests/Unit/TestCase.php @@ -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; @@ -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); } } }