diff --git a/README.md b/README.md
index 0d939a4ce..06ac4d2ed 100644
--- a/README.md
+++ b/README.md
@@ -233,21 +233,7 @@ Searching for regex: #this->get\((.*)\)#
-## 8. Convert Alice fixtures from YAML to PHP
-
-The `nelmio/alice` package [allows to use PHP](https://github.com/nelmio/alice/blob/v2.3.0/doc/complete-reference.md#php) for test fixture definitions. It's much better format, because Rector and PHPStan can understand it.
-
-But what if we have 100+ YAML files in our project?
-
-```bash
-vendor/bin/swiss-knife convert-alice-yaml-to-php fixtures
-```
-
-That's it!
-
-
-
-## 9. Spots Fake Traits
+## 8. Spots Fake Traits
What is trait has 5 lines and used in single service? We know it's better to be inlined, to empower IDE, Rector and PHPStan. But don't have time to worry about these details.
@@ -269,7 +255,7 @@ That's it! Run this command once upon a time or run it in CI to eliminate traits
-## 10. Split huge Symfony config to per-package in directory
+## 9. Split huge Symfony config to per-package in directory
Do you have a huge Symfony config file that is hard to navigate? Do you want to split it to per-package files?
@@ -345,7 +331,7 @@ All the extensions will be extracted to separate files in `config/packages/dev`
-## 11. Generate Symfony Smoke Tests
+## 10. Generate Symfony Smoke Tests
Cover your Symfony app with smoke tests in seconds. This command scans your `composer.json`, picks the matching test templates, and drops them under `tests/Unit/Smoke` (or your project's equivalent unit-tests directory).
@@ -420,7 +406,7 @@ final class ServiceContainerTest extends AbstractContainerTestCase
-## 12. Detect Duplicated Code
+## 11. Detect Duplicated Code
Spot copy-pasted code blocks with a token-based detector, a small clone of phpcpd.
Add it to CI to fail when a large copy-pasted block is added:
diff --git a/composer.json b/composer.json
index 98ca6801b..ad825d723 100644
--- a/composer.json
+++ b/composer.json
@@ -13,7 +13,6 @@
"nette/utils": "^4.1",
"nikic/php-parser": "^5.7",
"symfony/finder": "^8.1",
- "symfony/yaml": "^8.1",
"webmozart/assert": "^2.4"
},
"require-dev": {
diff --git a/src/Command/AliceYamlFixturesToPhpCommand.php b/src/Command/AliceYamlFixturesToPhpCommand.php
deleted file mode 100644
index 4310b3d09..000000000
--- a/src/Command/AliceYamlFixturesToPhpCommand.php
+++ /dev/null
@@ -1,87 +0,0 @@
-getRealPath());
-
- $return = $this->createArrayReturn($yaml);
- $phpFileContents = $standard->prettyPrintFile([$return]);
-
- // get real path without yml/yaml suffix
- if (str_ends_with($yamlFileInfo->getRealPath(), '.yml')) {
- $phpFilePath = substr($yamlFileInfo->getRealPath(), 0, -4) . '.php';
- } else {
- $phpFilePath = substr($yamlFileInfo->getRealPath(), 0, -5) . '.php';
- }
-
- FileSystem::write($phpFilePath, $phpFileContents, null);
-
- // remove YAML file
- unlink($yamlFileInfo->getRealPath());
-
- $this->outputPrinter->writeln('[DELETED] ' . $yamlFileInfo->getRelativePathname());
- $this->outputPrinter->writeln('[ADDED] ' . $phpFilePath);
- $this->outputPrinter->newline();
- }
-
- $this->outputPrinter->success(
- sprintf('Successfully converted %d Alice YAML fixtures to PHP', count($yamlFileInfos))
- );
-
- return ExitCode::SUCCESS;
- }
-
- public function getName(): string
- {
- return 'alice-yaml-fixtures-to-php';
- }
-
- public function getDescription(): string
- {
- return 'Converts Alice YAML fixtures to PHP format, so Rector and PHPStan can understand it';
- }
-
- /**
- * @param mixed[] $yaml
- */
- private function createArrayReturn(array $yaml): Return_
- {
- $expr = BuilderHelpers::normalizeValue($yaml);
-
- return new Return_($expr);
- }
-}
diff --git a/src/Command/NamespaceToPSR4Command.php b/src/Command/NamespaceToPSR4Command.php
index 09256167b..0d538cd3e 100644
--- a/src/Command/NamespaceToPSR4Command.php
+++ b/src/Command/NamespaceToPSR4Command.php
@@ -12,6 +12,9 @@
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
+/**
+ * @see \Rector\SwissKnife\Tests\Command\NamespaceToPSR4CommandTest
+ */
final readonly class NamespaceToPSR4Command implements CommandInterface
{
public function __construct(
diff --git a/src/Finder/FilesFinder.php b/src/Finder/FilesFinder.php
index 18b687299..a17e90c8d 100644
--- a/src/Finder/FilesFinder.php
+++ b/src/Finder/FilesFinder.php
@@ -8,6 +8,9 @@
use Symfony\Component\Finder\SplFileInfo;
use Webmozart\Assert\Assert;
+/**
+ * @see \Rector\SwissKnife\Tests\Finder\FilesFinderTest
+ */
final class FilesFinder
{
/**
diff --git a/src/Finder/PhpFilesFinder.php b/src/Finder/PhpFilesFinder.php
index 791a3a51d..c5f2f83f5 100644
--- a/src/Finder/PhpFilesFinder.php
+++ b/src/Finder/PhpFilesFinder.php
@@ -8,6 +8,9 @@
use Symfony\Component\Finder\SplFileInfo;
use Webmozart\Assert\Assert;
+/**
+ * @see \Rector\SwissKnife\Tests\Finder\PhpFilesFinderTest
+ */
final class PhpFilesFinder
{
/**
diff --git a/src/PhpParser/NodeVisitor/FindNonPrivateClassConstNodeVisitor.php b/src/PhpParser/NodeVisitor/FindNonPrivateClassConstNodeVisitor.php
index 44b0a8e34..aaaf1433f 100644
--- a/src/PhpParser/NodeVisitor/FindNonPrivateClassConstNodeVisitor.php
+++ b/src/PhpParser/NodeVisitor/FindNonPrivateClassConstNodeVisitor.php
@@ -71,7 +71,7 @@ private function isConstantDefinedInParentClassAlso(Class_ $class, string $const
return array_any(
$class->implements,
- fn ($implement): bool => in_array($constantName, $this->getClassConstantNames($implement->toString()), true)
+ fn (Name $name): bool => in_array($constantName, $this->getClassConstantNames($name->toString()), true)
);
}
diff --git a/src/SmokeTestgen/FileSystem/TestsDirectoryResolver.php b/src/SmokeTestgen/FileSystem/TestsDirectoryResolver.php
index 1954c1dc5..4a85ac9ee 100644
--- a/src/SmokeTestgen/FileSystem/TestsDirectoryResolver.php
+++ b/src/SmokeTestgen/FileSystem/TestsDirectoryResolver.php
@@ -12,10 +12,8 @@ public function resolveSmokeUnitTestDirectory(string $projectDirectory): string
{
$testDirectory = $this->resolveTestDirectory($projectDirectory);
- if ($testDirectory === null) {
- // fallback to default
- $testDirectory = 'tests';
- }
+ // fallback to default
+ $testDirectory ??= 'tests';
$unitTestDirectory = $this->resolveUnitTestsDirectory($testDirectory);
if ($unitTestDirectory === null) {
diff --git a/src/SmokeTestgen/TestTemplateResolver.php b/src/SmokeTestgen/TestTemplateResolver.php
index b3caba67b..ec28e3b95 100644
--- a/src/SmokeTestgen/TestTemplateResolver.php
+++ b/src/SmokeTestgen/TestTemplateResolver.php
@@ -31,8 +31,7 @@ public function matchProjectPackages(array $requiredPackages): array
// find all subscribers, that match any of the required packages
return array_filter(
$this->testByPackageSubscribers,
- fn (TestByPackageSubscriberInterface $testByPackageSubscriber): bool =>
- array_intersect($testByPackageSubscriber->getPackageNames(), $requiredPackages) !== []
+ fn (TestByPackageSubscriberInterface $testByPackageSubscriber): bool => array_intersect($testByPackageSubscriber->getPackageNames(), $requiredPackages) !== []
);
}
}
diff --git a/src/SmokeTestgen/Utils/TestPathResolver.php b/src/SmokeTestgen/Utils/TestPathResolver.php
index 12c583b96..be912a748 100644
--- a/src/SmokeTestgen/Utils/TestPathResolver.php
+++ b/src/SmokeTestgen/Utils/TestPathResolver.php
@@ -6,6 +6,9 @@
use Rector\SwissKnife\SmokeTestgen\Contract\TestByPackageSubscriberInterface;
+/**
+ * @see \Rector\SwissKnife\Tests\SmokeTestgen\Utils\TestPathResolverTest
+ */
final class TestPathResolver
{
public static function resolve(
diff --git a/src/Testing/UnitTestFilter.php b/src/Testing/UnitTestFilter.php
index bef1322c5..c36504c3f 100644
--- a/src/Testing/UnitTestFilter.php
+++ b/src/Testing/UnitTestFilter.php
@@ -33,7 +33,7 @@ private function isUnitTest(string $class): bool
return array_all(
self::NON_UNIT_TEST_CASE_CLASSES,
- fn ($nonUnitTestCaseClass): bool => ! is_a($class, $nonUnitTestCaseClass, true)
+ fn (string $nonUnitTestCaseClass): bool => ! is_a($class, $nonUnitTestCaseClass, true)
);
}
}