Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
Remove unused dependencies (#3711)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Oct 29, 2021
1 parent 4988b41 commit 5a28257
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 124 deletions.
8 changes: 2 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@
},
"require-dev": {
"doctrine/annotations": "^1.13",
"doctrine/cache": "^1.11",
"doctrine/common": "^3.1",
"doctrine/doctrine-bundle": "^2.4",
"doctrine/orm": "^2.9",
"doctrine/persistence": "^2.2",
"myclabs/php-enum": "^1.8",
"doctrine/cache": "^1.12",
"doctrine/orm": "^2.10",
"nette/application": "^3.1",
"nette/bootstrap": "^3.1",
"nette/finder": "^2.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/coding-standard/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"nette/application": "^3.1",
"nette/bootstrap": "^3.1",
"symfony/http-kernel": "^5.3|^6.0",
"doctrine/orm": "^2.9",
"doctrine/orm": "^2.10",
"symplify/smart-file-system": "^9.5",
"symfony/framework-bundle": "^5.3|^6.0",
"symplify/easy-coding-standard": "^9.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export IFS=";"
note "Downgrading directories\n"

# --working-dir is needed, so "SKIP" parameter is applied in absolute path of nested directory
php -d memory_limit=-1 vendor/bin/rector process bin src vendor --config packages/config-transformer/build/config/config-downgrade.php --working-dir $BUILD_DIRECTORY --ansi
php -d memory_limit=-1 vendor/bin/rector process bin src vendor --config packages/config-transformer/build/config/config-downgrade.php --working-dir $BUILD_DIRECTORY --ansi --debug

# CONFIRMED: give time to print all the files, before the next process takes over newly printed content
# avoids bugs like these half of files done, next half waiting https://github.com/rectorphp/rector-src/runs/2565478682
Expand Down
11 changes: 4 additions & 7 deletions packages/config-transformer/src/ConfigLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
use Symplify\ConfigTransformer\DependencyInjection\ExtensionFaker;
use Symplify\ConfigTransformer\DependencyInjection\Loader\CheckerTolerantYamlFileLoader;
use Symplify\ConfigTransformer\DependencyInjection\LoaderFactory\IdAwareXmlFileLoaderFactory;
use Symplify\ConfigTransformer\Enum\Format;
use Symplify\ConfigTransformer\Exception\NotImplementedYetException;
use Symplify\ConfigTransformer\ValueObject\Configuration;
use Symplify\ConfigTransformer\ValueObject\ContainerBuilderAndFileContent;
use Symplify\ConfigTransformer\ValueObject\Format;
use Symplify\SmartFileSystem\SmartFileInfo;
use Symplify\SmartFileSystem\SmartFileSystem;

Expand All @@ -44,7 +44,7 @@ public function createAndLoadContainerBuilderFromFileInfo(
): ContainerBuilderAndFileContent {
$containerBuilder = new ContainerBuilder();

$delegatingLoader = $this->createLoaderBySuffix($containerBuilder, $configuration, $smartFileInfo->getSuffix());
$delegatingLoader = $this->createLoaderBySuffix($containerBuilder, $smartFileInfo->getSuffix());
$fileRealPath = $smartFileInfo->getRealPath();

// correct old syntax of tags so we can parse it
Expand All @@ -65,11 +65,8 @@ public function createAndLoadContainerBuilderFromFileInfo(
return new ContainerBuilderAndFileContent($containerBuilder, $content);
}

private function createLoaderBySuffix(
ContainerBuilder $containerBuilder,
Configuration $configuration,
string $suffix
): DelegatingLoader {
private function createLoaderBySuffix(ContainerBuilder $containerBuilder, string $suffix): DelegatingLoader
{
if ($suffix === Format::XML) {
$idAwareXmlFileLoader = $this->idAwareXmlFileLoaderFactory->createFromContainerBuilder($containerBuilder);
return $this->wrapToDelegatingLoader($idAwareXmlFileLoader, $containerBuilder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
use Symplify\ConfigTransformer\Collector\XmlImportCollector;
use Symplify\ConfigTransformer\ConfigLoader;
use Symplify\ConfigTransformer\DependencyInjection\ContainerBuilderCleaner;
use Symplify\ConfigTransformer\Enum\Format;
use Symplify\ConfigTransformer\Exception\NotImplementedYetException;
use Symplify\ConfigTransformer\ValueObject\Configuration;
use Symplify\ConfigTransformer\ValueObject\Format;
use Symplify\PackageBuilder\Reflection\PrivatesAccessor;
use Symplify\PackageBuilder\Yaml\ParametersMerger;
use Symplify\PhpConfigPrinter\Provider\CurrentFilePathProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Symplify\ConfigTransformer\ValueObject;
namespace Symplify\ConfigTransformer\Enum;

final class Format
{
Expand Down
2 changes: 2 additions & 0 deletions packages/config-transformer/src/ValueObject/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Symplify\ConfigTransformer\ValueObject;

use Symplify\ConfigTransformer\Enum\Format;

final class Configuration
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ private function getExcludedCheckersFromParameterBag(ParameterBagInterface $para
}

/**
* @param mixed $key
* @param mixed $value
* @return class-string|null
*/
private function matchFullClassSkip($key, $value): ?string
private function matchFullClassSkip(int|string $key, $value): ?string
{
// "SomeClass::class" => null
if (is_string($key) && class_exists($key) && $value === null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function prepareContainer(ContainerBuilder $containerBuilder): void
}

/**
* @param ContainerInterface|ContainerBuilder $container
* @param ContainerBuilder $container
*/
protected function getContainerLoader(ContainerInterface $container): DelegatingLoader
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(IndentationTypeFixer::class);
$services->set(IndentationTypeFixer::class)
->public();

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::INDENTATION, Option::INDENTATION_SPACES);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(IndentationTypeFixer::class);
$services->set(IndentationTypeFixer::class)
->public();

$parameters = $containerConfigurator->parameters();
$parameters->set(Option::INDENTATION, Option::INDENTATION_TAB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
use PhpCsFixer\Fixer\Whitespace\IndentationTypeFixer;
use PhpCsFixer\Fixer\WhitespacesAwareFixerInterface;
use PhpCsFixer\WhitespacesFixerConfig;
use Psr\Container\ContainerInterface;
use Symplify\EasyCodingStandard\FixerRunner\Application\FixerFileProcessor;
use Symplify\EasyCodingStandard\HttpKernel\EasyCodingStandardKernel;
use Symplify\PackageBuilder\Configuration\StaticEolConfiguration;
use Symplify\PackageBuilder\Reflection\PrivatesAccessor;
Expand All @@ -30,7 +28,7 @@ public function testSpaces(): void
[__DIR__ . '/IndentationSource/config-with-spaces-indentation.php']
);

$indentationTypeFixer = $this->getIndentationTypeFixerFromContainer(self::$container);
$indentationTypeFixer = $this->getService(IndentationTypeFixer::class);

$this->assertInstanceOf(WhitespacesAwareFixerInterface::class, $indentationTypeFixer);
$whitespacesFixerConfig = new WhitespacesFixerConfig(' ', StaticEolConfiguration::getEolChar());
Expand All @@ -49,7 +47,7 @@ public function testTabs(): void
[__DIR__ . '/IndentationSource/config-with-tabs-indentation.php']
);

$indentationTypeFixer = $this->getIndentationTypeFixerFromContainer(self::$container);
$indentationTypeFixer = $this->getService(IndentationTypeFixer::class);

$this->assertInstanceOf(WhitespacesAwareFixerInterface::class, $indentationTypeFixer);
$whitespacesFixerConfig = new WhitespacesFixerConfig(' ', StaticEolConfiguration::getEolChar());
Expand All @@ -60,13 +58,4 @@ public function testTabs(): void
);
$this->assertEquals($whitespacesFixerConfig, $fixerWhitespaceConfig);
}

private function getIndentationTypeFixerFromContainer(ContainerInterface $container): IndentationTypeFixer
{
$fixerFileProcessor = $container->get(FixerFileProcessor::class);
$checkers = $fixerFileProcessor->getCheckers();
$this->assertCount(1, $checkers);

return array_pop($checkers);
}
}
10 changes: 6 additions & 4 deletions packages/easy-testing/src/DataProvider/StaticFixtureFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ private static function findFilesInDirectoryExclusively(string $directory, strin

private static function ensureNoOtherFileName(string $directory, string $suffix): void
{
$iterator = Finder::create()->in($directory)
$finder = Finder::create()->in($directory)
->files()
->notName($suffix)
->getIterator();
->notName($suffix);

/** @var SplFileInfo[] $fileInfos */
$fileInfos = iterator_to_array($finder->getIterator());

$relativeFilePaths = [];
foreach ($iterator as $fileInfo) {
foreach ($fileInfos as $fileInfo) {
$relativeFilePaths[] = Strings::substring($fileInfo->getRealPath(), strlen(getcwd()) + 1);
}

Expand Down
26 changes: 7 additions & 19 deletions packages/git-wrapper/src/GitCommit.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,23 @@

final class GitCommit
{
/**
* @var string
*/
private $hash;
private string $hash;

/**
* @var string
*/
private $author;
private string $author;

private DateTimeImmutable $authorDate;

/**
* @var string
*/
private $committer;
private string $committer;

private DateTimeImmutable $committerDate;

/**
* @var string
*/
private $subject;
private string $subject;

private string $body;

/**
* @var string
* @param array<string, string> $data
*/
private $body;

public function __construct(array $data)
{
$this->hash = $data['hash'];
Expand Down
2 changes: 1 addition & 1 deletion packages/git-wrapper/src/GitCommits.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private function parseShowOutput(string $output): GitCommit
$captureBody = true;
}

$items[Strings::firstLower($key)] = $value;
$items[lcfirst($key)] = $value;
} else {
$items['body'] .= "\n" . $line;
}
Expand Down
4 changes: 0 additions & 4 deletions packages/package-builder/src/Parameter/ParameterProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Symplify\PackageBuilder\Parameter;

use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;

Expand All @@ -19,9 +18,6 @@ final class ParameterProvider
*/
private $parameters = [];

/**
* @param Container|ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
$parameterBag = $container->getParameterBag();
Expand Down
18 changes: 0 additions & 18 deletions packages/package-builder/src/Reflection/PrivatesCaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use ReflectionClass;
use ReflectionMethod;
use Symplify\SymplifyKernel\Exception\ShouldNotHappenException;

/**
* @see \Symplify\PackageBuilder\Tests\Reflection\PrivatesCallerTest
Expand All @@ -19,8 +18,6 @@ final class PrivatesCaller
*/
public function callPrivateMethod(object | string $object, string $methodName, array $arguments)
{
$this->ensureIsNotNull($object, __METHOD__);

if (is_string($object)) {
$reflectionClass = new ReflectionClass($object);
$object = $reflectionClass->newInstanceWithoutConstructor();
Expand All @@ -36,8 +33,6 @@ public function callPrivateMethod(object | string $object, string $methodName, a
*/
public function callPrivateMethodWithReference(object | string $object, string $methodName, mixed $argument)
{
$this->ensureIsNotNull($object, __METHOD__);

if (is_string($object)) {
$reflectionClass = new ReflectionClass($object);
$object = $reflectionClass->newInstanceWithoutConstructor();
Expand All @@ -56,17 +51,4 @@ private function createAccessibleMethodReflection(object $object, string $method

return $reflectionMethod;
}

/**
* @param mixed $object
*/
private function ensureIsNotNull($object, string $location): void
{
if ($object !== null) {
return;
}

$errorMessage = sprintf('Value passed to "%s()" method cannot be null', $location);
throw new ShouldNotHappenException($errorMessage);
}
}
4 changes: 1 addition & 3 deletions packages/package-builder/src/Yaml/ParametersMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace Symplify\PackageBuilder\Yaml;

use Closure;

final class ParametersMerger
{
/**
Expand Down Expand Up @@ -68,7 +66,7 @@ public function mergeWithCombine($left, $right)
/**
* @return mixed[]
*/
private function mergeLeftToRightWithCallable(array $left, array $right, Closure $mergeCallback): array
private function mergeLeftToRightWithCallable(array $left, array $right, callable $mergeCallback): array
{
foreach ($left as $key => $val) {
if (is_int($key)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ private function resolvePropertyValuesFromValueObject(string $valueObjectClass,
{
$reflectionClass = new ReflectionClass($valueObjectClass);
$propertyValues = [];

foreach ($reflectionClass->getProperties() as $reflectionProperty) {
$reflectionProperty->setAccessible(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ public function decorate($configuration, string $class)

/**
* @param mixed[] $value
* @param mixed $key
* @return mixed[]
*/
private function configureArrayOfObjects(array $configuration, array $value, $key): array
private function configureArrayOfObjects(array $configuration, array $value, int|string $key): array
{
foreach ($value as $keyValue => $singleValue) {
if (is_string($keyValue)) {
Expand Down Expand Up @@ -95,6 +94,9 @@ private function decorateValueObject(object $value): StaticCall
return $this->createInlineStaticCall($args);
}

/**
* @param mixed[] $values
*/
private function decorateValueObjects(array $values): StaticCall
{
$arrayItems = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ private function cleanupParameters(array $services, array $serviceDefinition, st
return $services;
}

private function isReservedKey(string | int | bool $key): bool
private function isReservedKey(string | int $key): bool
{
if (! is_string($key)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace Symplify\PHPStanRules\PhpDoc;

use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\Stmt\Property;
use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode;
Expand All @@ -31,7 +30,7 @@ public function hasNodeAnnotationOrAttribute(
return $this->hasAttributeClass($node, $attributeClass);
}

private function hasAttributeClass(ClassMethod | Property | Class_ $node, string $attributeClass): bool
private function hasAttributeClass(ClassMethod | Property $node, string $attributeClass): bool
{
foreach ($node->attrGroups as $attrGroup) {
foreach ($attrGroup->attrs as $attribute) {
Expand Down
7 changes: 7 additions & 0 deletions packages/phpstan-rules/stubs/MyCLabs/Enum/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@

abstract class Enum
{
public function getKey(): string
{
}

public function getValue(): void
{
}
}
Loading

0 comments on commit 5a28257

Please sign in to comment.