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

Commit

Permalink
[MonorepoBuilder] Remove AbstractMutualDependencyReleaseWorker
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Feb 22, 2021
1 parent c892bf2 commit 462a1a1
Show file tree
Hide file tree
Showing 13 changed files with 135 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public function resolve(Tokens $tokens, int $docTokenPosition): array
return [];
}

/** @var array<string, mixed> $functionArgumentAnalyses */
$functionArgumentAnalyses = $this->functionsAnalyzer->getFunctionArguments($tokens, $functionTokenPosition);

return array_keys($functionArgumentAnalyses);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpCsFixer\DocBlock\DocBlock;
use PhpCsFixer\DocBlock\Line;
use PhpCsFixer\Tokenizer\Tokens;
use Symplify\CodingStandard\TokenAnalyzer\DocblockRelatedParamNamesResolver;
use Symplify\CodingStandard\TokenRunner\Contract\DocBlock\MalformWorkerInterface;
use Symplify\PackageBuilder\Configuration\StaticEolConfiguration;

Expand All @@ -32,13 +33,12 @@ final class MissingParamNameMalformWorker implements MalformWorkerInterface
private const PARAM_WITH_NAME_REGEX = '#@param(.*?)\$[\w]+(.*?)\n#';

/**
* @var \Symplify\CodingStandard\TokenAnalyzer\DocblockRelatedParamNamesResolver
* @var DocblockRelatedParamNamesResolver
*/
private $docblockRelatedParamNamesResolver;

public function __construct(
\Symplify\CodingStandard\TokenAnalyzer\DocblockRelatedParamNamesResolver $docblockRelatedParamNamesResolver
) {
public function __construct(DocblockRelatedParamNamesResolver $docblockRelatedParamNamesResolver)
{
$this->docblockRelatedParamNamesResolver = $docblockRelatedParamNamesResolver;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use PhpCsFixer\DocBlock\Annotation;
use PhpCsFixer\DocBlock\DocBlock;
use PhpCsFixer\Tokenizer\Tokens;
use Symplify\CodingStandard\TokenAnalyzer\DocblockRelatedParamNamesResolver;
use Symplify\CodingStandard\TokenRunner\Contract\DocBlock\MalformWorkerInterface;

final class ParamNameTypoMalformWorker implements MalformWorkerInterface
Expand All @@ -19,13 +20,12 @@ final class ParamNameTypoMalformWorker implements MalformWorkerInterface
private const PARAM_NAME_REGEX = '#@param(.*?)(?<paramName>\$\w+)#';

/**
* @var \Symplify\CodingStandard\TokenAnalyzer\DocblockRelatedParamNamesResolver
* @var DocblockRelatedParamNamesResolver
*/
private $docblockRelatedParamNamesResolver;

public function __construct(
\Symplify\CodingStandard\TokenAnalyzer\DocblockRelatedParamNamesResolver $docblockRelatedParamNamesResolver
) {
public function __construct(DocblockRelatedParamNamesResolver $docblockRelatedParamNamesResolver)
{
$this->docblockRelatedParamNamesResolver = $docblockRelatedParamNamesResolver;
}

Expand Down
11 changes: 0 additions & 11 deletions packages/git-wrapper/tests/Event/TestDispatcher.php

This file was deleted.

8 changes: 4 additions & 4 deletions packages/git-wrapper/tests/GitWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

namespace Symplify\GitWrapper\Tests;

use Symfony\Component\EventDispatcher\EventDispatcher;
use Symplify\GitWrapper\Exception\GitException;
use Symplify\GitWrapper\GitCommand;
use Symplify\GitWrapper\GitWorkingCopy;
use Symplify\GitWrapper\Tests\Event\TestDispatcher;

final class GitWrapperTest extends AbstractGitWrapperTestCase
{
Expand All @@ -34,9 +34,9 @@ public function testSetGitBinary(): void

public function testSetDispatcher(): void
{
$testDispatcher = new TestDispatcher();
$this->gitWrapper->setDispatcher($testDispatcher);
$this->assertSame($testDispatcher, $this->gitWrapper->getDispatcher());
$eventDispatcher = new EventDispatcher();
$this->gitWrapper->setDispatcher($eventDispatcher);
$this->assertSame($eventDispatcher, $this->gitWrapper->getDispatcher());
}

public function testSetTimeout(): void
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,46 @@
namespace Symplify\MonorepoBuilder\Release\ReleaseWorker;

use PharIo\Version\Version;
use Symplify\MonorepoBuilder\DependencyUpdater;
use Symplify\MonorepoBuilder\FileSystem\ComposerJsonProvider;
use Symplify\MonorepoBuilder\Package\PackageNamesProvider;
use Symplify\MonorepoBuilder\Release\Contract\ReleaseWorker\ReleaseWorkerInterface;
use Symplify\MonorepoBuilder\Utils\VersionUtils;

final class SetCurrentMutualDependenciesReleaseWorker extends AbstractMutualDependencyReleaseWorker
final class SetCurrentMutualDependenciesReleaseWorker implements ReleaseWorkerInterface
{
/**
* @var VersionUtils
*/
private $versionUtils;

/**
* @var DependencyUpdater
*/
private $dependencyUpdater;

/**
* @var ComposerJsonProvider
*/
private $composerJsonProvider;

/**
* @var PackageNamesProvider
*/
private $packageNamesProvider;

public function __construct(
VersionUtils $versionUtils,
DependencyUpdater $dependencyUpdater,
ComposerJsonProvider $composerJsonProvider,
PackageNamesProvider $packageNamesProvider
) {
$this->versionUtils = $versionUtils;
$this->dependencyUpdater = $dependencyUpdater;
$this->composerJsonProvider = $composerJsonProvider;
$this->packageNamesProvider = $packageNamesProvider;
}

public function work(Version $version): void
{
$versionInString = $this->versionUtils->getRequiredFormat($version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,46 @@
namespace Symplify\MonorepoBuilder\Release\ReleaseWorker;

use PharIo\Version\Version;
use Symplify\MonorepoBuilder\DependencyUpdater;
use Symplify\MonorepoBuilder\FileSystem\ComposerJsonProvider;
use Symplify\MonorepoBuilder\Package\PackageNamesProvider;
use Symplify\MonorepoBuilder\Release\Contract\ReleaseWorker\ReleaseWorkerInterface;
use Symplify\MonorepoBuilder\Utils\VersionUtils;

final class SetNextMutualDependenciesReleaseWorker extends AbstractMutualDependencyReleaseWorker
final class SetNextMutualDependenciesReleaseWorker implements ReleaseWorkerInterface
{
/**
* @var ComposerJsonProvider
*/
private $composerJsonProvider;

/**
* @var DependencyUpdater
*/
private $dependencyUpdater;

/**
* @var VersionUtils
*/
private $versionUtils;

/**
* @var PackageNamesProvider
*/
private $packageNamesProvider;

public function __construct(
ComposerJsonProvider $composerJsonProvider,
DependencyUpdater $dependencyUpdater,
PackageNamesProvider $packageNamesProvider,
VersionUtils $versionUtils
) {
$this->composerJsonProvider = $composerJsonProvider;
$this->dependencyUpdater = $dependencyUpdater;
$this->versionUtils = $versionUtils;
$this->packageNamesProvider = $packageNamesProvider;
}

public function work(Version $version): void
{
$versionInString = $this->versionUtils->getRequiredNextFormat($version);
Expand Down
12 changes: 9 additions & 3 deletions packages/phpstan-rules/src/Rules/NoInheritanceRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,28 @@ final class NoInheritanceRule extends AbstractSymplifyRule
* @var array<class-string>
*/
private const ALLOWED_PARENT_TYPES = [
// possibly configurable?
// @todo make configurable
'Symfony\Bundle\FrameworkBundle\Controller\AbstractController',
'Symplify\PHPStanRules\Rules\AbstractSymplifyRule',
'Symplify\RuleDocGenerator\Contract\CodeSampleInterface',
'Symplify\CodingStandard\Fixer\AbstractSymplifyFixer',


'Symfony\Component\HttpKernel\KernelInterface',
'Symfony\Component\HttpKernel\Bundle\Bundle',
'PHPUnit\Framework\TestCase',
'Throwable',
'Symfony\Component\Console\Application',
'Symfony\Component\Console\Command\Command',
'Symfony\Component\DependencyInjection\Extension\Extension',
'Symfony\Component\DependencyInjection\Loader\FileLoader',
'Symfony\Contracts\EventDispatcher\Event',
'PhpCsFixer\AbstractDoctrineAnnotationFixer',
'PhpParser\NodeTraverser',
'PhpParser\NodeVisitor',
'PhpParser\Builder',
'PhpParser\PrettyPrinter\Standard',
'PHPUnit\Framework\TestCase',
'SplFileInfo',
'Throwable',
];

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,28 @@
namespace Symplify\PHPUnitUpgrader\PHPUnitUpgrader;

use Symplify\PHPUnitUpgrader\FileInfoDecorator\AssertContainsInfoDecorator;
use Symplify\PHPUnitUpgrader\ReportingFileDumper;
use Symplify\PHPUnitUpgrader\ValueObject\FilePathWithContent;
use Symplify\SmartFileSystem\SmartFileInfo;

final class AssertContainsPHPUnitUpgrader extends AbstractPHPUnitUpgrader
final class AssertContainsPHPUnitUpgrader
{
/**
* @var AssertContainsInfoDecorator
*/
private $assertContainsInfoDecorator;

public function __construct(AssertContainsInfoDecorator $assertContainsInfoDecorator)
{
/**
* @var ReportingFileDumper
*/
private $reportingFileDumper;

public function __construct(
AssertContainsInfoDecorator $assertContainsInfoDecorator,
ReportingFileDumper $reportingFileDumper
) {
$this->assertContainsInfoDecorator = $assertContainsInfoDecorator;
$this->reportingFileDumper = $reportingFileDumper;
}

public function renameFileInfos(array $fileInfos, SmartFileInfo $errorReportFileInfo): void
Expand All @@ -33,7 +42,7 @@ public function renameFileInfos(array $fileInfos, SmartFileInfo $errorReportFile
continue;
}

$this->processChangedFileInfo($fileInfo, $changedContent);
$this->reportingFileDumper->processChangedFileInfo($fileInfo, $changedContent);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@
namespace Symplify\PHPUnitUpgrader\PHPUnitUpgrader;

use Symplify\PHPUnitUpgrader\FileInfoDecorator\SetUpTearDownVoidFileInfoDecorator;
use Symplify\PHPUnitUpgrader\ReportingFileDumper;

final class VoidPHPUnitUpgrader extends AbstractPHPUnitUpgrader
final class VoidPHPUnitUpgrader
{
/**
* @var SetUpTearDownVoidFileInfoDecorator
*/
private $setUpTearDownVoidFileInfoDecorator;

public function __construct(SetUpTearDownVoidFileInfoDecorator $setUpTearDownVoidFileInfoDecorator)
{
/**
* @var ReportingFileDumper
*/
private $reportingFileDumper;

public function __construct(
SetUpTearDownVoidFileInfoDecorator $setUpTearDownVoidFileInfoDecorator,
ReportingFileDumper $reportingFileDumper
) {
$this->setUpTearDownVoidFileInfoDecorator = $setUpTearDownVoidFileInfoDecorator;
$this->reportingFileDumper = $reportingFileDumper;
}

public function completeFileInfos(array $fileInfos): void
Expand All @@ -26,7 +35,7 @@ public function completeFileInfos(array $fileInfos): void
continue;
}

$this->processChangedFileInfo($fileInfo, $changedContent);
$this->reportingFileDumper->processChangedFileInfo($fileInfo, $changedContent);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace Symplify\PHPUnitUpgrader\PHPUnitUpgrader;
namespace Symplify\PHPUnitUpgrader;

use Symfony\Component\Console\Style\SymfonyStyle;
use Symplify\ConsoleColorDiff\Console\Output\ConsoleDiffer;
use Symplify\SmartFileSystem\SmartFileInfo;
use Symplify\SmartFileSystem\SmartFileSystem;

abstract class AbstractPHPUnitUpgrader
final class ReportingFileDumper
{
/**
* @var SymfonyStyle
Expand All @@ -26,17 +26,17 @@ abstract class AbstractPHPUnitUpgrader
*/
private $smartFileSystem;

public function autowireAbstractCompleter(
public function __construct(
SymfonyStyle $symfonyStyle,
ConsoleDiffer $consoleDiffer,
SmartFileSystem $smartFileSystem
): void {
) {
$this->symfonyStyle = $symfonyStyle;
$this->consoleDiffer = $consoleDiffer;
$this->smartFileSystem = $smartFileSystem;
}

protected function processChangedFileInfo(SmartFileInfo $testFileInfo, string $changedContent): void
public function processChangedFileInfo(SmartFileInfo $testFileInfo, string $changedContent): void
{
$this->symfonyStyle->newLine();
$this->consoleDiffer->diff($testFileInfo->getContents(), $changedContent);
Expand Down
Loading

0 comments on commit 462a1a1

Please sign in to comment.