diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 00000000..91c63005 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,403 @@ +parameters: + ignoreErrors: + - + message: '#^PHPDoc tag @var with type Symfony\\Component\\DependencyInjection\\Container is not subtype of native type ProjectServiceContainer\.$#' + identifier: varTag.nativeType + count: 1 + path: src/Cli/Symfony/ConsoleKernel.php + + - + message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\|TYPO3\\Surf\\Domain\\Model\\Deployment\:\:reveal\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/Unit/Application/BaseApplicationTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Application\\BaseApplicationTest\:\:createDeployment\(\) never returns TYPO3\\Surf\\Domain\\Model\\Deployment so it can be removed from the return type\.$#' + identifier: return.unusedType + count: 1 + path: tests/Unit/Application/BaseApplicationTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Application\\BaseApplicationTest\:\:createDeployment\(\) return type with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Application/BaseApplicationTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Application\\BaseApplicationTest\:\:createWorkflow\(\) return type with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Application/BaseApplicationTest.php + + - + message: '#^PHPDoc tag @return with type Prophecy\\Prophecy\\ObjectProphecy\|TYPO3\\Surf\\Domain\\Model\\Workflow is not subtype of native type Prophecy\\Prophecy\\ObjectProphecy\.$#' + identifier: return.phpDocType + count: 1 + path: tests/Unit/Application/BaseApplicationTest.php + + - + message: '#^Parameter \#1 \$workflow of method TYPO3\\Surf\\Application\\BaseApplication\:\:registerTasks\(\) expects TYPO3\\Surf\\Domain\\Model\\Workflow, object given\.$#' + identifier: argument.type + count: 2 + path: tests/Unit/Application/BaseApplicationTest.php + + - + message: '#^Parameter \#2 \$deployment of method TYPO3\\Surf\\Application\\BaseApplication\:\:registerTasks\(\) expects TYPO3\\Surf\\Domain\\Model\\Deployment, object given\.$#' + identifier: argument.type + count: 2 + path: tests/Unit/Application/BaseApplicationTest.php + + - + message: '#^Call to an undefined method Prophecy\\Prophecy\\ObjectProphecy\|TYPO3\\Surf\\Domain\\Model\\Deployment\:\:reveal\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Unit/Application/Neos/FlowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Application\\Neos\\FlowTest\:\:createDeployment\(\) never returns TYPO3\\Surf\\Domain\\Model\\Deployment so it can be removed from the return type\.$#' + identifier: return.unusedType + count: 1 + path: tests/Unit/Application/Neos/FlowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Application\\Neos\\FlowTest\:\:createDeployment\(\) return type with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Application/Neos/FlowTest.php + + - + message: '#^Parameter \#2 \$deployment of method TYPO3\\Surf\\Application\\Neos\\Flow\:\:registerTasks\(\) expects TYPO3\\Surf\\Domain\\Model\\Deployment, object given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Application/Neos/FlowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\AssertCommandExecuted\:\:matches\(\) has parameter \$other with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/AssertCommandExecuted.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Cli\\Symfony\\Logger\\ConsoleFormatterTest\:\:format\(\) has parameter \$record with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Cli/Symfony/Logger/ConsoleFormatterTest.php + + - + message: '#^Call to an undefined method Prophecy\\Prophecy\\MethodProphecy\|TYPO3\\Surf\\Domain\\Model\\Deployment\:\:willReturn\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Unit/Command/DeployCommandTest.php + + - + message: '#^Parameter \#2 \$configurationPath of method Prophecy\\Prophecy\\ObjectProphecy\\:\:getDeployment\(\) expects string\|null, Prophecy\\Argument\\Token\\ExactValueToken given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Command/DeployCommandTest.php + + - + message: '#^Parameter \#3 \$simulateDeployment of method Prophecy\\Prophecy\\ObjectProphecy\\:\:getDeployment\(\) expects bool, Prophecy\\Argument\\Token\\ExactValueToken given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Command/DeployCommandTest.php + + - + message: '#^Parameter \#4 \$initialize of method Prophecy\\Prophecy\\ObjectProphecy\\:\:getDeployment\(\) expects bool, Prophecy\\Argument\\Token\\ExactValueToken given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Command/DeployCommandTest.php + + - + message: '#^Parameter \#5 \$forceDeployment of method Prophecy\\Prophecy\\ObjectProphecy\\:\:getDeployment\(\) expects bool, Prophecy\\Argument\\Token\\ExactValueToken given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Command/DeployCommandTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Command\\DeployCommandTest\:\:\$factory with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Command/DeployCommandTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Command\\DescribeCommandTest\:\:getDescriptionOfPredefinedApplication\(\) has parameter \$options with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Command/DescribeCommandTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Domain\\Model\\RollbackWorkflowTest\:\:buildDeployment\(\) has parameter \$executedTasks with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Domain/Model/RollbackWorkflowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Domain\\Model\\SimpleWorkflowTest\:\:applicationTaskDefinitionsAreExecutedCorrectly\(\) has parameter \$expectedExecutions with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Domain/Model/SimpleWorkflowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Domain\\Model\\SimpleWorkflowTest\:\:beforeAndAfterStageStepsAreIndependentOfApplications\(\) has parameter \$expectedTasks with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Domain/Model/SimpleWorkflowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Domain\\Model\\SimpleWorkflowTest\:\:buildDeployment\(\) has parameter \$executedTasks with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Domain/Model/SimpleWorkflowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Domain\\Model\\SimpleWorkflowTest\:\:globalTaskDefinitionsAreExecutedCorrectly\(\) has parameter \$expectedExecutions with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Domain/Model/SimpleWorkflowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Domain\\Model\\SimpleWorkflowTest\:\:removeTaskRemovesTaskFromStages\(\) has parameter \$expectedTasks with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Domain/Model/SimpleWorkflowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Domain\\Model\\SimpleWorkflowTest\:\:removeTaskRemovesTaskFromStagesForSpecificApplication\(\) has parameter \$applications with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Domain/Model/SimpleWorkflowTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Domain\\Model\\SimpleWorkflowTest\:\:removeTaskRemovesTaskFromStagesForSpecificApplication\(\) has parameter \$expectedTasks with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Domain/Model/SimpleWorkflowTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''Psr\\\\Log\\\\LoggerInterface'' and Psr\\Log\\LoggerInterface will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/Unit/Domain/Service/TaskFactoryTest.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''TYPO3\\\\Surf\\\\Domain\\\\Service\\\\ShellCommandService'' and TYPO3\\Surf\\Domain\\Service\\ShellCommandService will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/Unit/Domain/Service/TaskFactoryTest.php + + - + message: '#^Cannot call method shouldBeCalledOnce\(\) on Prophecy\\Prophecy\\MethodProphecy\|null\.$#' + identifier: method.nonObject + count: 2 + path: tests/Unit/Domain/Service/TaskManagerTest.php + + - + message: '#^Cannot call method shouldNotHaveBeenCalled\(\) on Prophecy\\Prophecy\\MethodProphecy\|null\.$#' + identifier: method.nonObject + count: 1 + path: tests/Unit/Domain/Service/TaskManagerTest.php + + - + message: '#^Parameter \#4 \$options of method Prophecy\\Prophecy\\ObjectProphecy\\:\:execute\(\) expects array\, Prophecy\\Argument\\Token\\AnyValueToken given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Domain/Service/TaskManagerTest.php + + - + message: '#^Parameter \#4 \$options of method Prophecy\\Prophecy\\ObjectProphecy\\:\:execute\(\) expects array\, Prophecy\\Argument\\Token\\ArrayEntryToken given\.$#' + identifier: argument.type + count: 4 + path: tests/Unit/Domain/Service/TaskManagerTest.php + + - + message: '#^Parameter \#4 \$options of method Prophecy\\Prophecy\\ObjectProphecy\\:\:execute\(\) expects array\, Prophecy\\Argument\\Token\\LogicalNotToken given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Domain/Service/TaskManagerTest.php + + - + message: '#^Parameter \#4 \$options of method Prophecy\\Prophecy\\ObjectProphecy\\:\:rollback\(\) expects array\, Prophecy\\Argument\\Token\\AnyValueToken given\.$#' + identifier: argument.type + count: 2 + path: tests/Unit/Domain/Service/TaskManagerTest.php + + - + message: '#^Parameter \#4 \$options of method Prophecy\\Prophecy\\ObjectProphecy\\:\:simulate\(\) expects array\, Prophecy\\Argument\\Token\\AnyValueToken given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Domain/Service/TaskManagerTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Domain\\Service\\TaskManagerTest\:\:\$task with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Domain/Service/TaskManagerTest.php + + - + message: '#^Call to an undefined method Monolog\\Logger\|Prophecy\\Prophecy\\MethodProphecy\:\:shouldBeCalledOnce\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Cannot call method shouldBeCalledOnce\(\) on Prophecy\\Prophecy\\MethodProphecy\|null\.$#' + identifier: method.nonObject + count: 1 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Cannot call method willReturn\(\) on Prophecy\\Prophecy\\MethodProphecy\|string\.$#' + identifier: method.nonObject + count: 14 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Cannot call method willReturn\(\) on array\\|Prophecy\\Prophecy\\MethodProphecy\.$#' + identifier: method.nonObject + count: 3 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Cannot call method willReturn\(\) on bool\|Prophecy\\Prophecy\\MethodProphecy\.$#' + identifier: method.nonObject + count: 37 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Parameter \#1 \$file of method Prophecy\\Prophecy\\ObjectProphecy\\:\:fileExists\(\) expects string, Prophecy\\Argument\\Token\\AnyValueToken given\.$#' + identifier: argument.type + count: 4 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Integration\\FactoryTest\:\:\$filesystem with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Integration\\FactoryTest\:\:\$logger \(Monolog\\Logger\|Prophecy\\Prophecy\\ObjectProphecy\) is never assigned Monolog\\Logger so it can be removed from the property type\.$#' + identifier: property.unusedType + count: 1 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Integration\\FactoryTest\:\:\$logger with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Integration/FactoryTest.php + + - + message: '#^Call to an undefined method Psr\\Log\\LoggerInterface\:\:expects\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Unit/Task/CleanupReleasesTaskTest.php + + - + message: '#^Cannot call method willReturn\(\) on int\|Prophecy\\Prophecy\\MethodProphecy\.$#' + identifier: method.nonObject + count: 3 + path: tests/Unit/Task/CleanupReleasesTaskTest.php + + - + message: '#^Instanceof between TYPO3\\Surf\\Task\\CleanupReleasesTask and TYPO3\\Surf\\Domain\\Service\\ShellCommandServiceAwareInterface will always evaluate to true\.$#' + identifier: instanceof.alwaysTrue + count: 1 + path: tests/Unit/Task/CleanupReleasesTaskTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Task\\CleanupReleasesTaskTest\:\:removeReleasesByAge\(\) has parameter \$expectedFoldersToBeRemoved with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Task/CleanupReleasesTaskTest.php + + - + message: '#^Method TYPO3\\Surf\\Tests\\Unit\\Task\\CleanupReleasesTaskTest\:\:removeReleasesByAge\(\) has parameter \$identifiers with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Task/CleanupReleasesTaskTest.php + + - + message: '#^Parameter \#1 \$string of method Prophecy\\Prophecy\\ObjectProphecy\\:\:stringToTime\(\) expects string, Prophecy\\Argument\\Token\\TypeToken given\.$#' + identifier: argument.type + count: 1 + path: tests/Unit/Task/CleanupReleasesTaskTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Task\\CleanupReleasesTaskTest\:\:\$clockMock with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Task/CleanupReleasesTaskTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Task\\CleanupReleasesTaskTest\:\:\$folderStructure type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: tests/Unit/Task/CleanupReleasesTaskTest.php + + - + message: '#^Cannot call method willReturn\(\) on Prophecy\\Prophecy\\MethodProphecy\|string\.$#' + identifier: method.nonObject + count: 2 + path: tests/Unit/Task/CreateArchiveTaskTest.php + + - + message: '#^Cannot call method willReturn\(\) on bool\|Prophecy\\Prophecy\\MethodProphecy\.$#' + identifier: method.nonObject + count: 7 + path: tests/Unit/Task/CreateArchiveTaskTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Task\\CreateArchiveTaskTest\:\:\$filesystem with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Task/CreateArchiveTaskTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Task\\CreateArchiveTaskTest\:\:\$idGenerator with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Task/CreateArchiveTaskTest.php + + - + message: '#^Call to an undefined method Psr\\Log\\LoggerInterface\:\:expects\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Unit/Task/Generic/RollbackTaskTest.php + + - + message: '#^Call to an undefined method Psr\\Log\\LoggerInterface\:\:expects\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Unit/Task/TYPO3/CMS/CompareDatabaseTaskTest.php + + - + message: '#^Call to an undefined method Psr\\Log\\LoggerInterface\:\:expects\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Unit/Task/TYPO3/CMS/FlushCachesTaskTest.php + + - + message: '#^Cannot call method willReturn\(\) on bool\|Prophecy\\Prophecy\\MethodProphecy\.$#' + identifier: method.nonObject + count: 3 + path: tests/Unit/Task/TYPO3/CMS/SetUpExtensionsTaskTest.php + + - + message: '#^Parameter \#1 \$packageName of method Prophecy\\Prophecy\\ObjectProphecy\\:\:isSatisified\(\) expects string, Prophecy\\Argument\\Token\\AnyValueToken given\.$#' + identifier: argument.type + count: 3 + path: tests/Unit/Task/TYPO3/CMS/SetUpExtensionsTaskTest.php + + - + message: '#^Parameter \#2 \$constraint of method Prophecy\\Prophecy\\ObjectProphecy\\:\:isSatisified\(\) expects string, Prophecy\\Argument\\Token\\AnyValueToken given\.$#' + identifier: argument.type + count: 3 + path: tests/Unit/Task/TYPO3/CMS/SetUpExtensionsTaskTest.php + + - + message: '#^Property TYPO3\\Surf\\Tests\\Unit\\Task\\TYPO3\\CMS\\SetUpExtensionsTaskTest\:\:\$versionChecker with generic class Prophecy\\Prophecy\\ObjectProphecy does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: tests/Unit/Task/TYPO3/CMS/SetUpExtensionsTaskTest.php diff --git a/phpstan.neon b/phpstan.neon index 83c659ee..7b02316d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,10 +1,15 @@ +includes: + - phpstan-baseline.neon + parameters: - level: 8 - editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' - paths: - - src - - tests + level: 8 + parallel: + # to prevent full thread lagging pc + maximumNumberOfProcesses: 7 + editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%' + paths: + - src + - tests - inferPrivatePropertyTypeFromConstructor: true - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false + inferPrivatePropertyTypeFromConstructor: true + treatPhpDocTypesAsCertain: false diff --git a/src/Application/BaseApplication.php b/src/Application/BaseApplication.php index 2b68c523..8f3ba3d5 100644 --- a/src/Application/BaseApplication.php +++ b/src/Application/BaseApplication.php @@ -39,11 +39,14 @@ class BaseApplication extends Application * Symlinks, which should be created for each release. * * @see \TYPO3\Surf\Task\Generic\CreateSymlinksTask + * @var string[] */ protected array $symlinks = []; /** * Directories which should be created on deployment. E.g. shared folders. + * + * @var string[] */ protected array $directories = []; @@ -125,6 +128,9 @@ public function registerTasks(Workflow $workflow, Deployment $deployment): void } } + /** + * @param string[] $symlinks + */ public function setSymlinks(array $symlinks): self { $this->symlinks = $symlinks; @@ -132,6 +138,9 @@ public function setSymlinks(array $symlinks): self return $this; } + /** + * @return string[] + */ public function getSymlinks(): array { return $this->symlinks; @@ -144,6 +153,9 @@ public function addSymlink(string $linkPath, string $sourcePath): self return $this; } + /** + * @param string[] $symlinks + */ public function addSymlinks(array $symlinks): self { foreach ($symlinks as $linkPath => $sourcePath) { @@ -153,6 +165,9 @@ public function addSymlinks(array $symlinks): self return $this; } + /** + * @param string[] $directories + */ public function setDirectories(array $directories): self { $this->directories = $directories; @@ -160,6 +175,9 @@ public function setDirectories(array $directories): self return $this; } + /** + * @return string[] + */ public function getDirectories(): array { return $this->directories; @@ -172,6 +190,9 @@ public function addDirectory(string $path): self return $this; } + /** + * @param string[] $directories + */ public function addDirectories(array $directories): self { foreach ($directories as $path) { diff --git a/src/Application/Neos/Flow.php b/src/Application/Neos/Flow.php index 499065c9..151f6b9e 100644 --- a/src/Application/Neos/Flow.php +++ b/src/Application/Neos/Flow.php @@ -130,7 +130,9 @@ public function getCommandPackageKey(string $command = ''): string } /** - * Returns a executable flow command including the context + * Returns an executable flow command including the context + * + * @param string[] $arguments */ public function buildCommand( string $targetPath, diff --git a/src/Application/Neos/Neos.php b/src/Application/Neos/Neos.php index 25f75b9c..0e067be3 100644 --- a/src/Application/Neos/Neos.php +++ b/src/Application/Neos/Neos.php @@ -13,6 +13,9 @@ class Neos extends Flow { + /** + * @var string[] + */ private array $neosCommands = [ 'domain:add', 'domain:list', diff --git a/src/Cli/Symfony/Logger/ConsoleHandler.php b/src/Cli/Symfony/Logger/ConsoleHandler.php index 36635dda..a3076876 100644 --- a/src/Cli/Symfony/Logger/ConsoleHandler.php +++ b/src/Cli/Symfony/Logger/ConsoleHandler.php @@ -33,6 +33,9 @@ class ConsoleHandler extends AbstractProcessingHandler { private OutputInterface $output; + /** + * @var array + */ private array $verbosityLevelMap = [ OutputInterface::VERBOSITY_NORMAL => Logger::INFO, OutputInterface::VERBOSITY_VERBOSE => Logger::DEBUG, @@ -40,6 +43,9 @@ class ConsoleHandler extends AbstractProcessingHandler OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG, ]; + /** + * @param array> $verbosityLevelMap + */ public function __construct(OutputInterface $output, bool $bubble = true, array $verbosityLevelMap = []) { parent::__construct(Logger::DEBUG, $bubble); diff --git a/src/Command/DescribeCommand.php b/src/Command/DescribeCommand.php index 60e3e8fd..20f250ec 100755 --- a/src/Command/DescribeCommand.php +++ b/src/Command/DescribeCommand.php @@ -18,6 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface; use TYPO3\Surf\Domain\Model\Application; use TYPO3\Surf\Domain\Model\FailedDeployment; +use TYPO3\Surf\Domain\Model\Node; use TYPO3\Surf\Domain\Model\SimpleWorkflow; use TYPO3\Surf\Domain\Model\Workflow; use TYPO3\Surf\Integration\FactoryInterface; @@ -91,6 +92,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int return Command::SUCCESS; } + /** + * @param Node[] $nodes + */ protected function printNodes(array $nodes): void { $this->output->writeln('Nodes:' . PHP_EOL); @@ -99,6 +103,9 @@ protected function printNodes(array $nodes): void } } + /** + * @param Application[] $applications + */ protected function printApplications(array $applications, Workflow $workflow): void { $this->output->writeln(PHP_EOL . 'Applications:' . PHP_EOL); @@ -127,6 +134,10 @@ protected function printApplications(array $applications, Workflow $workflow): v } } + /** + * @param array $stages + * @param array $tasks + */ protected function printStages(Application $application, array $stages, array $tasks): void { foreach ($stages as $stage) { @@ -155,6 +166,7 @@ protected function printStages(Application $application, array $stages, array $t /** * Print all tasks before or after a task * + * @param array $tasks * @param string $output */ private function printBeforeAfterTasks(array $tasks, string $applicationName, string $task, string $step, &$output): void diff --git a/src/Domain/Filesystem/Filesystem.php b/src/Domain/Filesystem/Filesystem.php index 7170e333..fe3e8826 100644 --- a/src/Domain/Filesystem/Filesystem.php +++ b/src/Domain/Filesystem/Filesystem.php @@ -65,6 +65,9 @@ public function createDirectory(string $directory): bool return mkdir($directory, 0777, true); } + /** + * @return string[] + */ public function glob(string $pattern): array { $matches = glob($pattern); diff --git a/src/Domain/Filesystem/FilesystemInterface.php b/src/Domain/Filesystem/FilesystemInterface.php index 4fa29a75..c2e298e2 100644 --- a/src/Domain/Filesystem/FilesystemInterface.php +++ b/src/Domain/Filesystem/FilesystemInterface.php @@ -35,5 +35,8 @@ public function fileExists(string $file): bool; public function createDirectory(string $directory): bool; + /** + * @return string[] + */ public function glob(string $pattern): array; } diff --git a/src/Domain/Model/Application.php b/src/Domain/Model/Application.php index 397bef3e..b9bd3676 100644 --- a/src/Domain/Model/Application.php +++ b/src/Domain/Model/Application.php @@ -48,6 +48,9 @@ class Application */ protected string $releasesDirectory = 'releases'; + /** + * @var array + */ protected array $options = []; public function __construct(string $name) @@ -219,6 +222,8 @@ public function getReleasesPath(): string * * The options will include the deploymentPath and sharedPath for * unified option handling. + * + * @return array */ public function getOptions(): array { @@ -267,6 +272,9 @@ public function provideStringOption(string $key): string return (string)$this->getOption($key); } + /** + * @param array $options + */ public function setOptions(array $options): self { $this->options = $options; diff --git a/src/Domain/Model/Deployment.php b/src/Domain/Model/Deployment.php index a3369c3b..43d5499b 100644 --- a/src/Domain/Model/Deployment.php +++ b/src/Domain/Model/Deployment.php @@ -61,6 +61,8 @@ class Deployment implements LoggerAwareInterface /** * Callbacks that should be executed after initialization + * + * @var array */ protected array $initCallbacks = []; @@ -68,6 +70,9 @@ class Deployment implements LoggerAwareInterface protected bool $initialized = false; + /** + * @var array + */ protected array $options = []; /** @@ -344,7 +349,7 @@ public function isInitialized(): bool * The options will include the deploymentPath and sharedPath for * unified option handling. * - * @return array An array of options indexed by option key + * @return array An array of options indexed by option key */ public function getOptions(): array { @@ -367,8 +372,7 @@ public function hasOption(string $key): bool /** * Sets all options for the deployment * - * @param array $options The options to set indexed by option key - * + * @param array $options The options to set indexed by option key * @return Deployment The current instance for chaining */ public function setOptions(array $options): self diff --git a/src/Domain/Model/HttpResponse.php b/src/Domain/Model/HttpResponse.php index 7fabf9b8..8628b917 100644 --- a/src/Domain/Model/HttpResponse.php +++ b/src/Domain/Model/HttpResponse.php @@ -28,10 +28,16 @@ final class HttpResponse { private string $body; + /** + * @var string[][] + */ private array $headers; private int $statusCode; + /** + * @param string[][] $headers + */ public function __construct(string $body, array $headers, int $statusCode) { $this->body = $body; @@ -44,6 +50,9 @@ public function getBody(): string return $this->body; } + /** + * @return string[][] + */ public function getHeaders(): array { return $this->headers; diff --git a/src/Domain/Model/Node.php b/src/Domain/Model/Node.php index 62238967..9d5e7e2a 100644 --- a/src/Domain/Model/Node.php +++ b/src/Domain/Model/Node.php @@ -46,6 +46,8 @@ class Node * * username: SSH username for connecting to this node (optional) * port: SSH port for connecting to the node (optional) + * + * @var array{hostname?: string, username?: string, port?: int} */ protected array $options = []; @@ -143,6 +145,9 @@ public function setHostname(string $hostname): Node return $this->setOption('hostname', $hostname); } + /** + * @return array + */ public function getOptions(): array { return array_merge($this->options, [ @@ -152,6 +157,9 @@ public function getOptions(): array ]); } + /** + * @param array $options + */ public function setOptions(array $options): self { $this->options = $options; @@ -171,7 +179,7 @@ public function getOption(string $key) case 'sharedPath': return $this->getSharedPath(); default: - return $this->options[$key]; + return $this->options[$key] ?? null; } } diff --git a/src/Domain/Model/RollbackWorkflow.php b/src/Domain/Model/RollbackWorkflow.php index 9e34d94d..cbc24fe8 100644 --- a/src/Domain/Model/RollbackWorkflow.php +++ b/src/Domain/Model/RollbackWorkflow.php @@ -20,6 +20,9 @@ final class RollbackWorkflow extends Workflow { + /** + * @var array + */ private array $stages; public function __construct(TaskManager $taskManager) diff --git a/src/Domain/Model/SimpleWorkflow.php b/src/Domain/Model/SimpleWorkflow.php index d84261d8..2f1ba895 100644 --- a/src/Domain/Model/SimpleWorkflow.php +++ b/src/Domain/Model/SimpleWorkflow.php @@ -28,6 +28,9 @@ class SimpleWorkflow extends Workflow */ protected bool $enableRollback = true; + /** + * @var array + */ protected array $stages = []; public function __construct(TaskManager $taskManager) @@ -118,6 +121,9 @@ public function isEnableRollback(): bool return $this->enableRollback; } + /** + * @return string[] + */ public function getStages(): array { return $this->stages; diff --git a/src/Domain/Model/Task.php b/src/Domain/Model/Task.php index f8924316..5f8fd53c 100644 --- a/src/Domain/Model/Task.php +++ b/src/Domain/Model/Task.php @@ -28,20 +28,31 @@ abstract class Task implements LoggerAwareInterface use LoggerAwareTrait; /** + * @param array $options * @return mixed|void */ abstract public function execute(Node $node, Application $application, Deployment $deployment, array $options = []); + /** + * @param array $options + */ public function rollback(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->configureOptions($options); } + /** + * @param array $options + */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->configureOptions($options); } + /** + * @param array $options + * @return array + */ protected function configureOptions(array $options = []): array { try { diff --git a/src/Domain/Model/TaskInHistory.php b/src/Domain/Model/TaskInHistory.php index 8e148f4c..8bf0ace2 100644 --- a/src/Domain/Model/TaskInHistory.php +++ b/src/Domain/Model/TaskInHistory.php @@ -26,8 +26,14 @@ final class TaskInHistory private string $stage; + /** + * @var string[] + */ private array $options; + /** + * @param array $options + */ private function __construct(Task $task, Node $node, Application $application, Deployment $deployment, string $stage, array $options) { $this->task = $task; @@ -38,6 +44,9 @@ private function __construct(Task $task, Node $node, Application $application, D $this->options = $options; } + /** + * @param array $options + */ public static function create(Task $task, Node $node, Application $application, Deployment $deployment, string $stage, array $options): TaskInHistory { return new self($task, $node, $application, $deployment, $stage, $options); @@ -68,6 +77,9 @@ public function stage(): string return $this->stage; } + /** + * @return array + */ public function options(): array { return $this->options; diff --git a/src/Domain/Model/Workflow.php b/src/Domain/Model/Workflow.php index abe8cd88..8b48ff7f 100644 --- a/src/Domain/Model/Workflow.php +++ b/src/Domain/Model/Workflow.php @@ -27,6 +27,9 @@ abstract class Workflow implements LoggerAwareInterface protected TaskManager $taskManager; + /** + * @var array + */ protected array $tasks = []; public function __construct(TaskManager $taskManager) @@ -91,7 +94,7 @@ public function removeTask(string $removeTask, Application $application = null): } /** - * @param array|string $tasks + * @param class-string[]|string $tasks */ public function forStage(string $stage, $tasks): self { @@ -104,7 +107,7 @@ public function forStage(string $stage, $tasks): self * The tasks will be executed for the given stage. If an application is given, * the tasks will be executed only for the stage and application. * - * @param array|string $tasks + * @param class-string[]|string $tasks * @param string $stage The name of the stage when this task shall be executed * @param string $step A stage has three steps "before", "tasks" and "after" */ @@ -129,7 +132,7 @@ protected function addTaskToStage($tasks, string $stage, Application $applicatio * The tasks will be executed for the given stage. If an application is given, * the tasks will be executed only for the stage and application. * - * @param array|string $tasks + * @param class-string[]|string $tasks * @param string $stage The name of the stage when this task shall be executed * * @return Workflow @@ -146,7 +149,7 @@ public function addTask($tasks, string $stage, Application $application = null) * * The execution will not depend on a stage but on an optional application. * - * @param array|string $tasks + * @param array|string $tasks */ public function afterTask(string $task, $tasks, Application $application = null): self { @@ -169,7 +172,7 @@ public function afterTask(string $task, $tasks, Application $application = null) * * The execution will not depend on a stage but on an optional application. * - * @param array|string $tasks + * @param array|string $tasks */ public function beforeTask(string $task, $tasks, Application $application = null): self { @@ -189,6 +192,8 @@ public function beforeTask(string $task, $tasks, Application $application = null /** * Define a new task based on an existing task by setting options + * + * @param array $options */ public function defineTask(string $taskName, string $baseTask, array $options): self { @@ -202,7 +207,7 @@ public function defineTask(string $taskName, string $baseTask, array $options): /** * Add tasks that shall be executed before the given stage * - * @param array|string $tasks + * @param class-string[]|string $tasks */ public function beforeStage(string $stage, $tasks, Application $application = null): self { @@ -214,7 +219,7 @@ public function beforeStage(string $stage, $tasks, Application $application = nu /** * Add tasks that shall be executed after the given stage * - * @param array|string $tasks + * @param class-string[]|string $tasks */ public function afterStage(string $stage, $tasks, Application $application = null): self { @@ -225,6 +230,8 @@ public function afterStage(string $stage, $tasks, Application $application = nul /** * Override options for given task + * + * @param array $options */ public function setTaskOptions(string $taskName, array $options): self { @@ -243,6 +250,8 @@ public function setTaskOptions(string $taskName, array $options): self /** * Returns list of all registered tasks + * + * @return array */ public function getTasks(): array { @@ -272,6 +281,8 @@ protected function executeStage(string $stage, Node $node, Application $applicat * Execute a task and consider configured before / after "hooks" * * Will also execute tasks that are registered to run before or after this task. + * + * @param array $callstack */ protected function executeTask(string $task, Node $node, Application $application, Deployment $deployment, string $stage, array &$callstack = []): void { diff --git a/src/Domain/Service/ShellCommandService.php b/src/Domain/Service/ShellCommandService.php index fbfcd85e..ed97f4e1 100644 --- a/src/Domain/Service/ShellCommandService.php +++ b/src/Domain/Service/ShellCommandService.php @@ -36,7 +36,7 @@ public function __construct() /** * Execute a shell command (locally or remote depending on the node hostname) * - * @param array|string $command The shell command to execute, either string or array of commands + * @param array|string $command The shell command to execute, either string or array of commands * @param bool $ignoreErrors If this command should ignore exit codes unequal zero * @param bool $logOutput TRUE if the output of the command should be logged * @return mixed The output of the shell command or false if the command returned a non-zero exit code and $ignoreErrors was enabled. @@ -58,7 +58,7 @@ public function execute($command, Node $node, Deployment $deployment, bool $igno /** * Simulate a command by just outputting what would be executed * - * @param array|string $command + * @param array|string $command */ public function simulate($command, Node $node, Deployment $deployment): bool { @@ -75,7 +75,7 @@ public function simulate($command, Node $node, Deployment $deployment): bool /** * Execute or simulate a command (if the deployment is in dry run mode) * - * @param array|string $command + * @param array|string $command * @param bool $ignoreErrors * @param bool $logOutput true if the output of the command should be logged * @return mixed false if command failed or command output as string @@ -91,8 +91,9 @@ public function executeOrSimulate($command, Node $node, Deployment $deployment, /** * Execute a shell command locally * - * @param array|string $command + * @param array|string $command * @param bool $logOutput TRUE if the output of the command should be logged + * @return array */ protected function executeLocalCommand($command, Deployment $deployment, bool $logOutput = true): array { @@ -105,9 +106,9 @@ protected function executeLocalCommand($command, Deployment $deployment, bool $l /** * Execute a shell command via SSH * - * @param array|string $command + * @param array|string $command * @param bool $logOutput TRUE if the output of the command should be logged - * @return array + * @return array|mixed */ protected function executeRemoteCommand($command, Node $node, Deployment $deployment, bool $logOutput = true) { @@ -116,7 +117,7 @@ protected function executeRemoteCommand($command, Node $node, Deployment $deploy if ($node->hasOption('remoteCommandExecutionHandler')) { $remoteCommandExecutionHandler = $node->getOption('remoteCommandExecutionHandler'); - /** @var $remoteCommandExecutionHandler callable */ + /** @var callable $remoteCommandExecutionHandler */ return $remoteCommandExecutionHandler($this, $command, $node, $deployment, $logOutput); } @@ -164,7 +165,7 @@ protected function executeRemoteCommand($command, Node $node, Deployment $deploy * Open a process with symfony/process and process each line by logging and * collecting its output. * - * @return array The exit code of the command and the returned output + * @return array The exit code of the command and the returned output */ public function executeProcess(Deployment $deployment, string $command, bool $logOutput, string $logPrefix): array { @@ -187,7 +188,7 @@ public function executeProcess(Deployment $deployment, string $command, bool $lo /** * Prepare a command * - * @param array|string|null $command + * @param array|string|null $command * @return string * @throws TaskExecutionException */ diff --git a/src/Domain/Service/TaskManager.php b/src/Domain/Service/TaskManager.php index 1fd88b7d..1f78d82f 100644 --- a/src/Domain/Service/TaskManager.php +++ b/src/Domain/Service/TaskManager.php @@ -39,6 +39,9 @@ public function __construct(TaskFactory $taskFactory) $this->taskFactory = $taskFactory; } + /** + * @param array $options + */ public function execute(string $taskName, Node $node, Application $application, Deployment $deployment, string $stage, array $options = [], string $definedTaskName = ''): void { $definedTaskName = $definedTaskName ?: $taskName; @@ -89,6 +92,9 @@ public function reset(): void * Global options for a task should be prefixed with the task name to prevent naming * issues between different tasks. For example passing a special option to the * GitCheckoutTask could be expressed like GitCheckoutTask::class . '[sha1]' => '1234...'. + * + * @param array $taskOptions + * @return array */ protected function overrideOptions(string $taskName, Deployment $deployment, Node $node, Application $application, array $taskOptions): array { diff --git a/src/Integration/FactoryInterface.php b/src/Integration/FactoryInterface.php index be2b1a46..33f2a0f2 100644 --- a/src/Integration/FactoryInterface.php +++ b/src/Integration/FactoryInterface.php @@ -21,6 +21,8 @@ public function getDeployment(string $deploymentName, string $configurationPath * Get available deployment names * * Will look up all .php files in the directory ./.surf/ or the given path if specified. + * + * @return string[] */ public function getDeploymentNames(string $path = null): array; diff --git a/src/Task/CleanupReleasesTask.php b/src/Task/CleanupReleasesTask.php index 7aaedf51..c7493578 100644 --- a/src/Task/CleanupReleasesTask.php +++ b/src/Task/CleanupReleasesTask.php @@ -53,6 +53,9 @@ public function __construct(ClockInterface $clock) $this->clock = $clock; } + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { if (! isset($options['keepReleases']) && ! isset($options['onlyRemoveReleasesOlderThan'])) { @@ -89,12 +92,18 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->execute($node, $application, $deployment, $options); } + /** + * @param array $options + * @param string[] $removableReleases + * @return string[] + */ private function removeReleasesByAge(array $options, array $removableReleases): array { $onlyRemoveReleasesOlderThan = $this->clock->stringToTime($options['onlyRemoveReleasesOlderThan']); @@ -102,6 +111,11 @@ private function removeReleasesByAge(array $options, array $removableReleases): return array_filter($removableReleases, fn ($removeRelease): bool => ($currentTime - $this->clock->createTimestampFromFormat('YmdHis', $removeRelease)) > ($currentTime - $onlyRemoveReleasesOlderThan)); } + /** + * @param array $options + * @param string[] $removableReleases + * @return string[] + */ private function removeReleasesByNumber(array $options, array $removableReleases): array { sort($removableReleases); @@ -109,6 +123,10 @@ private function removeReleasesByNumber(array $options, array $removableReleases return array_slice($removableReleases, 0, count($removableReleases) - $keepReleases); } + /** + * @param string[] $allReleases + * @return string[] + */ private function extractRemovableReleases(array $allReleases, ?string $currentReleaseIdentifier, string $previousReleaseIdentifier): array { return array_map('trim', array_filter($allReleases, static fn ($release): bool => $release !== '.' && $release !== $currentReleaseIdentifier && $release !== $previousReleaseIdentifier && $release !== 'current' && $release !== 'previous')); diff --git a/src/Task/Composer/AbstractComposerTask.php b/src/Task/Composer/AbstractComposerTask.php index 319bedfd..4b362486 100644 --- a/src/Task/Composer/AbstractComposerTask.php +++ b/src/Task/Composer/AbstractComposerTask.php @@ -36,11 +36,15 @@ abstract class AbstractComposerTask extends Task implements ShellCommandServiceA /** * Arguments for the command + * + * @var string[] */ protected array $arguments = []; /** * Suffix for the command + * + * @var string[] */ protected array $suffix = ['2>&1']; @@ -67,6 +71,9 @@ public function execute(Node $node, Application $application, Deployment $deploy } } + /** + * @param array $options + */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->execute($node, $application, $deployment, $options); @@ -74,6 +81,9 @@ public function simulate(Node $node, Application $application, Deployment $deplo /** * Build the composer command in the given $path. + * + * @param array $options + * @return string[] */ private function buildComposerCommands(string $manifestPath, array $options): array { diff --git a/src/Task/Composer/InstallTask.php b/src/Task/Composer/InstallTask.php index 632e6560..f227fa2d 100644 --- a/src/Task/Composer/InstallTask.php +++ b/src/Task/Composer/InstallTask.php @@ -38,6 +38,8 @@ class InstallTask extends AbstractComposerTask /** * Arguments for the command + * + * @var string[] */ protected array $arguments = [ '--no-ansi', diff --git a/src/Task/Git/AbstractCheckoutTask.php b/src/Task/Git/AbstractCheckoutTask.php index 2bfd16b8..e41c6080 100644 --- a/src/Task/Git/AbstractCheckoutTask.php +++ b/src/Task/Git/AbstractCheckoutTask.php @@ -26,11 +26,17 @@ abstract class AbstractCheckoutTask extends Task implements ShellCommandServiceA { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->execute($node, $application, $deployment, $options); } + /** + * @param array $options + */ protected function resolveSha1(Node $node, Deployment $deployment, array $options): string { if (isset($options['sha1'])) { @@ -54,6 +60,9 @@ protected function resolveSha1(Node $node, Deployment $deployment, array $option return $sha1; } + /** + * @param array $options + */ protected function executeOrSimulateGitCloneOrUpdate(string $checkoutPath, Node $node, Deployment $deployment, array $options): string { $sha1 = $this->resolveSha1($node, $deployment, $options); @@ -90,6 +99,9 @@ protected function executeOrSimulateGitCloneOrUpdate(string $checkoutPath, Node return $sha1; } + /** + * @param array $options + */ protected function executeOrSimulatePostGitCheckoutCommands(string $gitPath, string $sha1, Node $node, Deployment $deployment, array $options): void { if (!isset($options['gitPostCheckoutCommands'])) { diff --git a/src/Task/Git/PushTask.php b/src/Task/Git/PushTask.php index 48fc9674..f5fae2fe 100644 --- a/src/Task/Git/PushTask.php +++ b/src/Task/Git/PushTask.php @@ -44,6 +44,9 @@ class PushTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->logger->warning('This task is deprecated and will be removed in Version 4.0'); @@ -59,6 +62,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Git/TagTask.php b/src/Task/Git/TagTask.php index 9041a87a..1cca3bf2 100644 --- a/src/Task/Git/TagTask.php +++ b/src/Task/Git/TagTask.php @@ -47,6 +47,9 @@ class TagTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->logger->warning('This task is deprecated and will be removed in Version 4.0'); @@ -71,12 +74,16 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->execute($node, $application, $deployment, $options); } + /** + * @param array $options + */ protected function validateOptions(array $options): void { if (!isset($options['tagName'])) { @@ -88,6 +95,10 @@ protected function validateOptions(array $options): void } } + /** + * @param array $options + * @return array + */ protected function processOptions(array $options, Deployment $deployment): array { foreach (['tagName', 'description'] as $optionName) { @@ -97,7 +108,7 @@ protected function processOptions(array $options, Deployment $deployment): array '{deploymentName}' ], [ - $deployment->getReleaseIdentifier(), + $deployment->getReleaseIdentifier() ?? '', $deployment->getName() ], $options[$optionName] diff --git a/src/Task/Laravel/AbstractCliTask.php b/src/Task/Laravel/AbstractCliTask.php index 3b327d09..e804d98e 100644 --- a/src/Task/Laravel/AbstractCliTask.php +++ b/src/Task/Laravel/AbstractCliTask.php @@ -36,11 +36,8 @@ abstract class AbstractCliTask extends Task implements ShellCommandServiceAwareI /** * Execute this task * - * @param array $cliArguments - * @param Node $node - * @param Application $application - * @param Deployment $deployment - * @param array $options + * @param string[] $cliArguments + * @param array $options * @return bool|mixed * @throws TaskExecutionException */ @@ -68,10 +65,7 @@ protected function executeCliCommand( /** * Simulate this task * - * @param Node $node - * @param Application $application - * @param Deployment $deployment - * @param array $options + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { @@ -81,10 +75,7 @@ public function simulate(Node $node, Application $application, Deployment $deplo /** * Determines the path to the working directory and the target node by given options * - * @param Node $node - * @param Application $application - * @param Deployment $deployment - * @param array $options + * @param array $options */ protected function determineWorkingDirectoryAndTargetNode( Node $node, diff --git a/src/Task/Laravel/ClearAuthResetsTask.php b/src/Task/Laravel/ClearAuthResetsTask.php index 2af1e66a..ca5f08cc 100644 --- a/src/Task/Laravel/ClearAuthResetsTask.php +++ b/src/Task/Laravel/ClearAuthResetsTask.php @@ -19,6 +19,9 @@ class ClearAuthResetsTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( diff --git a/src/Task/Laravel/ConfigCacheTask.php b/src/Task/Laravel/ConfigCacheTask.php index 795c4238..963856a4 100644 --- a/src/Task/Laravel/ConfigCacheTask.php +++ b/src/Task/Laravel/ConfigCacheTask.php @@ -19,6 +19,9 @@ class ConfigCacheTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( diff --git a/src/Task/Laravel/CreateDirectoriesTask.php b/src/Task/Laravel/CreateDirectoriesTask.php index 9199027d..5ad1c135 100644 --- a/src/Task/Laravel/CreateDirectoriesTask.php +++ b/src/Task/Laravel/CreateDirectoriesTask.php @@ -17,6 +17,9 @@ class CreateDirectoriesTask extends \TYPO3\Surf\Task\Generic\CreateDirectoriesTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = [ diff --git a/src/Task/Laravel/DisableMaintenanceModeTask.php b/src/Task/Laravel/DisableMaintenanceModeTask.php index 49304739..3498a286 100644 --- a/src/Task/Laravel/DisableMaintenanceModeTask.php +++ b/src/Task/Laravel/DisableMaintenanceModeTask.php @@ -19,6 +19,9 @@ class DisableMaintenanceModeTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( diff --git a/src/Task/Laravel/EnableMaintenanceModeTask.php b/src/Task/Laravel/EnableMaintenanceModeTask.php index 7bea80d5..7e40ab58 100644 --- a/src/Task/Laravel/EnableMaintenanceModeTask.php +++ b/src/Task/Laravel/EnableMaintenanceModeTask.php @@ -19,6 +19,9 @@ class EnableMaintenanceModeTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( diff --git a/src/Task/Laravel/EnvAwareTask.php b/src/Task/Laravel/EnvAwareTask.php index 518ade01..1b7ce0e5 100644 --- a/src/Task/Laravel/EnvAwareTask.php +++ b/src/Task/Laravel/EnvAwareTask.php @@ -29,7 +29,7 @@ class EnvAwareTask extends Task implements ShellCommandServiceAwareInterface * @param Node $node * @param Application $application * @param Deployment $deployment - * @param array $options + * @param array $options * * @throws TaskExecutionException */ diff --git a/src/Task/Laravel/MigrateFreshAndSeedTask.php b/src/Task/Laravel/MigrateFreshAndSeedTask.php index c31ba892..5f9b769f 100644 --- a/src/Task/Laravel/MigrateFreshAndSeedTask.php +++ b/src/Task/Laravel/MigrateFreshAndSeedTask.php @@ -19,6 +19,9 @@ class MigrateFreshAndSeedTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( @@ -38,6 +41,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Laravel/MigrateFreshTask.php b/src/Task/Laravel/MigrateFreshTask.php index 66b3556a..b4304e63 100644 --- a/src/Task/Laravel/MigrateFreshTask.php +++ b/src/Task/Laravel/MigrateFreshTask.php @@ -19,6 +19,9 @@ class MigrateFreshTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( @@ -38,6 +41,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Laravel/MigrateTask.php b/src/Task/Laravel/MigrateTask.php index 8d04fd41..b8db1c10 100644 --- a/src/Task/Laravel/MigrateTask.php +++ b/src/Task/Laravel/MigrateTask.php @@ -19,6 +19,9 @@ class MigrateTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( @@ -38,12 +41,16 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->execute($node, $application, $deployment, $options); } + /** + * @param array $options + */ public function rollback(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf( diff --git a/src/Task/Laravel/QueueRestartTask.php b/src/Task/Laravel/QueueRestartTask.php index 11fd0d8a..b597f2e8 100644 --- a/src/Task/Laravel/QueueRestartTask.php +++ b/src/Task/Laravel/QueueRestartTask.php @@ -19,6 +19,9 @@ class QueueRestartTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( diff --git a/src/Task/Laravel/RouteCacheTask.php b/src/Task/Laravel/RouteCacheTask.php index 7918c7b1..8ce128ba 100644 --- a/src/Task/Laravel/RouteCacheTask.php +++ b/src/Task/Laravel/RouteCacheTask.php @@ -19,6 +19,9 @@ class RouteCacheTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( diff --git a/src/Task/Laravel/StorageLinkTask.php b/src/Task/Laravel/StorageLinkTask.php index 1f6372f7..6461878e 100644 --- a/src/Task/Laravel/StorageLinkTask.php +++ b/src/Task/Laravel/StorageLinkTask.php @@ -19,6 +19,9 @@ class StorageLinkTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( @@ -38,6 +41,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Laravel/SymlinkStorageTask.php b/src/Task/Laravel/SymlinkStorageTask.php index c956571a..d35ed560 100644 --- a/src/Task/Laravel/SymlinkStorageTask.php +++ b/src/Task/Laravel/SymlinkStorageTask.php @@ -26,6 +26,9 @@ class SymlinkStorageTask extends Task implements ShellCommandServiceAwareInterfa { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { $targetReleasePath = $deployment->getApplicationReleasePath($node); diff --git a/src/Task/Laravel/ViewCacheTask.php b/src/Task/Laravel/ViewCacheTask.php index cade3708..faceb511 100644 --- a/src/Task/Laravel/ViewCacheTask.php +++ b/src/Task/Laravel/ViewCacheTask.php @@ -19,6 +19,9 @@ class ViewCacheTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { Assert::isInstanceOf( diff --git a/src/Task/Neos/Flow/CopyConfigurationTask.php b/src/Task/Neos/Flow/CopyConfigurationTask.php index d02f15ec..90c1c5de 100644 --- a/src/Task/Neos/Flow/CopyConfigurationTask.php +++ b/src/Task/Neos/Flow/CopyConfigurationTask.php @@ -38,6 +38,9 @@ class CopyConfigurationTask extends Task implements ShellCommandServiceAwareInte { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $configurationFileExtension = $options['configurationFileExtension'] ?? 'yaml'; diff --git a/src/Task/Neos/Flow/CreateDirectoriesTask.php b/src/Task/Neos/Flow/CreateDirectoriesTask.php index 7190d9ef..b6384dbe 100644 --- a/src/Task/Neos/Flow/CreateDirectoriesTask.php +++ b/src/Task/Neos/Flow/CreateDirectoriesTask.php @@ -22,6 +22,9 @@ */ class CreateDirectoriesTask extends \TYPO3\Surf\Task\Generic\CreateDirectoriesTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = [ diff --git a/src/Task/Neos/Flow/FlushCacheListTask.php b/src/Task/Neos/Flow/FlushCacheListTask.php index c23b72cc..25d3866c 100644 --- a/src/Task/Neos/Flow/FlushCacheListTask.php +++ b/src/Task/Neos/Flow/FlushCacheListTask.php @@ -45,6 +45,9 @@ class FlushCacheListTask extends Task implements ShellCommandServiceAwareInterfa { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf($application, FlowApplication::class, sprintf('Flow application needed for FlushCacheListTask, got "%s"', get_class($application))); diff --git a/src/Task/Neos/Flow/FunctionalTestTask.php b/src/Task/Neos/Flow/FunctionalTestTask.php index 841f1d8e..c1dbe9fb 100644 --- a/src/Task/Neos/Flow/FunctionalTestTask.php +++ b/src/Task/Neos/Flow/FunctionalTestTask.php @@ -29,6 +29,9 @@ class FunctionalTestTask extends Task implements ShellCommandServiceAwareInterfa { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for FunctionalTestTask, got "%s"', get_class($application))); @@ -42,6 +45,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Flow/MigrateTask.php b/src/Task/Neos/Flow/MigrateTask.php index 44dfe820..1554b176 100644 --- a/src/Task/Neos/Flow/MigrateTask.php +++ b/src/Task/Neos/Flow/MigrateTask.php @@ -32,6 +32,9 @@ class MigrateTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for MigrateTask, got "%s"', get_class($application))); @@ -43,6 +46,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Flow/PublishResourcesTask.php b/src/Task/Neos/Flow/PublishResourcesTask.php index 7d846401..d213a29b 100644 --- a/src/Task/Neos/Flow/PublishResourcesTask.php +++ b/src/Task/Neos/Flow/PublishResourcesTask.php @@ -32,6 +32,9 @@ class PublishResourcesTask extends Task implements ShellCommandServiceAwareInter { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for PublishResourcesTask, got "%s"', get_class($application))); @@ -45,6 +48,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Flow/RunCommandTask.php b/src/Task/Neos/Flow/RunCommandTask.php index 1d9d5910..fe3af903 100644 --- a/src/Task/Neos/Flow/RunCommandTask.php +++ b/src/Task/Neos/Flow/RunCommandTask.php @@ -48,6 +48,9 @@ class RunCommandTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for RunCommandTask, got "%s"', get_class($application))); @@ -63,6 +66,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Flow/SetFilePermissionsTask.php b/src/Task/Neos/Flow/SetFilePermissionsTask.php index 35244368..b790f4f3 100644 --- a/src/Task/Neos/Flow/SetFilePermissionsTask.php +++ b/src/Task/Neos/Flow/SetFilePermissionsTask.php @@ -46,6 +46,9 @@ class SetFilePermissionsTask extends Task implements ShellCommandServiceAwareInt { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for SetFilePermissionsTask, got "%s"', get_class($application))); @@ -70,6 +73,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Flow/SymlinkConfigurationTask.php b/src/Task/Neos/Flow/SymlinkConfigurationTask.php index e580bb26..411c71da 100644 --- a/src/Task/Neos/Flow/SymlinkConfigurationTask.php +++ b/src/Task/Neos/Flow/SymlinkConfigurationTask.php @@ -33,6 +33,9 @@ class SymlinkConfigurationTask extends Task implements ShellCommandServiceAwareI { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $targetReleasePath = $deployment->getApplicationReleasePath($node); @@ -58,6 +61,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Flow/SymlinkDataTask.php b/src/Task/Neos/Flow/SymlinkDataTask.php index 13d792d3..37996aee 100644 --- a/src/Task/Neos/Flow/SymlinkDataTask.php +++ b/src/Task/Neos/Flow/SymlinkDataTask.php @@ -27,6 +27,9 @@ class SymlinkDataTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $releaseIdentifier = $deployment->getReleaseIdentifier(); @@ -42,6 +45,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Flow/UnitTestTask.php b/src/Task/Neos/Flow/UnitTestTask.php index 603f751f..662d3455 100644 --- a/src/Task/Neos/Flow/UnitTestTask.php +++ b/src/Task/Neos/Flow/UnitTestTask.php @@ -29,6 +29,9 @@ class UnitTestTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for UnitTestTask, got "%s"', get_class($application))); @@ -39,6 +42,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Flow/WarmUpCacheTask.php b/src/Task/Neos/Flow/WarmUpCacheTask.php index 73c36a6a..277aeb93 100644 --- a/src/Task/Neos/Flow/WarmUpCacheTask.php +++ b/src/Task/Neos/Flow/WarmUpCacheTask.php @@ -28,6 +28,9 @@ class WarmUpCacheTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf( @@ -49,6 +52,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/Neos/Neos/ImportSiteTask.php b/src/Task/Neos/Neos/ImportSiteTask.php index fffa37b6..5e314cc6 100644 --- a/src/Task/Neos/Neos/ImportSiteTask.php +++ b/src/Task/Neos/Neos/ImportSiteTask.php @@ -42,6 +42,9 @@ class ImportSiteTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { Assert::isInstanceOf($application, Flow::class, sprintf('Flow application needed for ImportSiteTask, got "%s"', get_class($application))); diff --git a/src/Task/Package/GitTask.php b/src/Task/Package/GitTask.php index 7a78d5d0..cfa425f7 100644 --- a/src/Task/Package/GitTask.php +++ b/src/Task/Package/GitTask.php @@ -49,6 +49,9 @@ */ class GitTask extends AbstractCheckoutTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = $this->configureOptions($options); diff --git a/src/Task/Php/WebOpcacheResetCreateScriptTask.php b/src/Task/Php/WebOpcacheResetCreateScriptTask.php index 144e62e1..19ac285f 100644 --- a/src/Task/Php/WebOpcacheResetCreateScriptTask.php +++ b/src/Task/Php/WebOpcacheResetCreateScriptTask.php @@ -58,6 +58,9 @@ public function __construct(RandomBytesGeneratorInterface $randomBytesGenerator, $this->randomBytesGenerator = $randomBytesGenerator; } + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = $this->configureOptions($options); @@ -101,6 +104,9 @@ public function execute(Node $node, Application $application, Deployment $deploy } } + /** + * @param array $options + */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = $this->configureOptions($options); diff --git a/src/Task/Php/WebOpcacheResetExecuteTask.php b/src/Task/Php/WebOpcacheResetExecuteTask.php index fbfc4ba8..a2eabab0 100644 --- a/src/Task/Php/WebOpcacheResetExecuteTask.php +++ b/src/Task/Php/WebOpcacheResetExecuteTask.php @@ -51,6 +51,9 @@ public function __construct(FilesystemInterface $filesystem) $this->filesystem = $filesystem; } + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = $this->configureOptions($options); diff --git a/src/Task/RsyncFoldersTask.php b/src/Task/RsyncFoldersTask.php index b1ac4d9e..daf75530 100644 --- a/src/Task/RsyncFoldersTask.php +++ b/src/Task/RsyncFoldersTask.php @@ -47,6 +47,9 @@ class RsyncFoldersTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array{username?: string, folders?: array, ignoreErrors?: bool, logOutput?: bool} $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = $this->configureOptions($options); @@ -78,6 +81,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array{username?: string, folders?: array, ignoreErrors?: bool, logOutput?: bool} $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/TYPO3/CMS/AbstractCliTask.php b/src/Task/TYPO3/CMS/AbstractCliTask.php index 9bbbe89c..f17eaf86 100755 --- a/src/Task/TYPO3/CMS/AbstractCliTask.php +++ b/src/Task/TYPO3/CMS/AbstractCliTask.php @@ -38,6 +38,8 @@ abstract class AbstractCliTask extends Task implements ShellCommandServiceAwareI protected ?Node $targetNode = null; /** + * @param array $cliArguments + * @param array $options * @return bool|mixed */ protected function executeCliCommand(array $cliArguments, Node $node, CMS $application, Deployment $deployment, array $options = []) @@ -60,11 +62,17 @@ protected function executeCliCommand(array $cliArguments, Node $node, CMS $appli ], $this->targetNode, $deployment); } + /** + * @param array $options + */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->execute($node, $application, $deployment, $options); } + /** + * @param array $options + */ protected function determineWorkingDirectoryAndTargetNode(Node $node, Application $application, Deployment $deployment, array $options = []): void { if (isset($options['useApplicationWorkspace']) && $options['useApplicationWorkspace'] === true) { @@ -76,6 +84,9 @@ protected function determineWorkingDirectoryAndTargetNode(Node $node, Applicatio $this->targetNode = $node; } + /** + * @param array $options + */ protected function getAvailableCliPackage(Node $node, CMS $application, Deployment $deployment, array $options = []): ?string { try { @@ -86,6 +97,9 @@ protected function getAvailableCliPackage(Node $node, CMS $application, Deployme } } + /** + * @param array $options + */ protected function getTypo3CoreCliFileName(Node $node, CMS $application, Deployment $deployment, array $options = []): string { if (!isset($options['typo3CliFileName'])) { @@ -103,6 +117,9 @@ protected function getTypo3CoreCliFileName(Node $node, CMS $application, Deploym return $options['typo3CliFileName']; } + /** + * @param array $options + */ protected function getTypo3ConsoleScriptFileName(Node $node, CMS $application, Deployment $deployment, array $options = []): string { if (!isset($options['scriptFileName'])) { @@ -116,6 +133,9 @@ protected function getTypo3ConsoleScriptFileName(Node $node, CMS $application, D return $options['scriptFileName']; } + /** + * @param array $options + */ protected function fileExists(string $pathAndFileName, Node $node, CMS $application, Deployment $deployment, array $options = []): bool { $this->determineWorkingDirectoryAndTargetNode($node, $application, $deployment, $options); diff --git a/src/Task/TYPO3/CMS/CompareDatabaseTask.php b/src/Task/TYPO3/CMS/CompareDatabaseTask.php index 96d861b4..5a071384 100755 --- a/src/Task/TYPO3/CMS/CompareDatabaseTask.php +++ b/src/Task/TYPO3/CMS/CompareDatabaseTask.php @@ -36,11 +36,13 @@ */ class CompareDatabaseTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { - /** @var CMS $application */ Assert::isInstanceOf($application, CMS::class); - + /** @var CMS $application */ $options = $this->configureOptions($options); $cliArguments = $this->getSuitableCliArguments($node, $application, $deployment, $options); @@ -57,6 +59,10 @@ public function execute(Node $node, Application $application, Deployment $deploy ); } + /** + * @param array $options + * @return array + */ protected function getSuitableCliArguments(Node $node, CMS $application, Deployment $deployment, array $options = []): array { if ($this->getAvailableCliPackage($node, $application, $deployment, $options) === 'typo3_console') { diff --git a/src/Task/TYPO3/CMS/FlushCachesTask.php b/src/Task/TYPO3/CMS/FlushCachesTask.php index f32678f7..577f2069 100755 --- a/src/Task/TYPO3/CMS/FlushCachesTask.php +++ b/src/Task/TYPO3/CMS/FlushCachesTask.php @@ -25,11 +25,13 @@ */ class FlushCachesTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { - /** @var CMS $application */ Assert::isInstanceOf($application, CMS::class); - + /** @var CMS $application */ $options = $this->configureOptions($options); $cliArguments = $this->getSuitableCliArguments($node, $application, $deployment, $options); @@ -46,7 +48,11 @@ public function execute(Node $node, Application $application, Deployment $deploy ); } - protected function getSuitableCliArguments(Node $node, CMS $application, Deployment $deployment, array $options = []): ?array + /** + * @param array $options + * @return array + */ + protected function getSuitableCliArguments(Node $node, CMS $application, Deployment $deployment, array $options = []): array { if ($this->getAvailableCliPackage($node, $application, $deployment, $options) === 'typo3_console') { return array_merge( diff --git a/src/Task/TYPO3/CMS/RunCommandTask.php b/src/Task/TYPO3/CMS/RunCommandTask.php index 242140f8..56c7e09c 100644 --- a/src/Task/TYPO3/CMS/RunCommandTask.php +++ b/src/Task/TYPO3/CMS/RunCommandTask.php @@ -24,11 +24,13 @@ */ class RunCommandTask extends AbstractCliTask { + /** + * @param array|string> $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { - /** @var CMS $application */ Assert::isInstanceOf($application, CMS::class); - + /** @var CMS $application */ $options = $this->configureOptions($options); $arguments = array_merge([$this->getTypo3ConsoleScriptFileName($node, $application, $deployment, $options), $options['command']], $options['arguments']); diff --git a/src/Task/TYPO3/CMS/SetUpExtensionsTask.php b/src/Task/TYPO3/CMS/SetUpExtensionsTask.php index 992db1f0..75fe32cc 100755 --- a/src/Task/TYPO3/CMS/SetUpExtensionsTask.php +++ b/src/Task/TYPO3/CMS/SetUpExtensionsTask.php @@ -35,11 +35,13 @@ public function __construct(VersionCheckerInterface $versionChecker) $this->versionChecker = $versionChecker; } + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { - /** @var CMS $application */ Assert::isInstanceOf($application, CMS::class); - + /** @var CMS $application */ try { $scriptFileName = $this->getTypo3ConsoleScriptFileName($node, $application, $deployment, $options); } catch (InvalidConfigurationException $e) { diff --git a/src/Task/TYPO3/CMS/SymlinkDataTask.php b/src/Task/TYPO3/CMS/SymlinkDataTask.php index 5367fbe2..69c29f2a 100755 --- a/src/Task/TYPO3/CMS/SymlinkDataTask.php +++ b/src/Task/TYPO3/CMS/SymlinkDataTask.php @@ -29,6 +29,9 @@ class SymlinkDataTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $commands = []; @@ -67,6 +70,7 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { diff --git a/src/Task/TYPO3/CMS/WarmupCacheTask.php b/src/Task/TYPO3/CMS/WarmupCacheTask.php index a678367a..d801edf4 100644 --- a/src/Task/TYPO3/CMS/WarmupCacheTask.php +++ b/src/Task/TYPO3/CMS/WarmupCacheTask.php @@ -21,11 +21,13 @@ class WarmupCacheTask extends AbstractCliTask { + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []) { - /** @var CMS $application */ Assert::isInstanceOf($application, CMS::class); - + /** @var CMS $application */ $options = $this->configureOptions($options); $cliArguments = $this->getSuitableCliArguments($node, $application, $deployment, $options); @@ -43,6 +45,10 @@ public function execute(Node $node, Application $application, Deployment $deploy ); } + /** + * @param array $options + * @return array|null + */ protected function getSuitableCliArguments(Node $node, CMS $application, Deployment $deployment, array $options = []): ?array { return array_merge([$this->getTypo3CoreCliFileName($node, $application, $deployment, $options), 'cache:warmup'], $options['arguments']); diff --git a/src/Task/Test/HttpTestTask.php b/src/Task/Test/HttpTestTask.php index 5ce5d65f..c745a99a 100644 --- a/src/Task/Test/HttpTestTask.php +++ b/src/Task/Test/HttpTestTask.php @@ -107,6 +107,10 @@ protected function assertExpectedStatus(int $expected, int $actual): void } } + /** + * @param array $expected + * @param array $actual + */ protected function assertExpectedHeaders(array $expected, array $actual): void { if (count($expected) > 0) { @@ -132,6 +136,9 @@ protected function assertExpectedHeaders(array $expected, array $actual): void } } + /** + * @param array $expectedRegexp + */ protected function assertExpectedRegexp(array $expectedRegexp, string $responseBody): void { if (count($expectedRegexp) > 0) { @@ -172,6 +179,7 @@ protected function testSingleHeader(string $headerValue, string $expectedValue): } /** + * @param array $options * @throws TaskExecutionException * @throws GuzzleException */ @@ -234,6 +242,8 @@ protected function executeRemoteCurlRequest( /** * Split response into headers and body part + * + * @return string[][] */ protected function extractHeadersFromMultiLineString(string $headerText): array { diff --git a/src/Task/Transfer/RsyncTask.php b/src/Task/Transfer/RsyncTask.php index 2bbeb4d6..a871aa14 100644 --- a/src/Task/Transfer/RsyncTask.php +++ b/src/Task/Transfer/RsyncTask.php @@ -31,8 +31,14 @@ class RsyncTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @var array + */ protected array $replacePaths = []; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = $this->configureOptions($options); @@ -86,12 +92,16 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->execute($node, $application, $deployment, $options); } + /** + * @param array $options + */ public function rollback(Node $node, Application $application, Deployment $deployment, array $options = []): void { $releasePath = $deployment->getApplicationReleasePath($node); @@ -102,6 +112,8 @@ public function rollback(Node $node, Application $application, Deployment $deplo * Generates the --exclude flags for a given array of exclude patterns * * Example: ['foo', '/bar'] => --exclude 'foo' --exclude '/bar' + * + * @param array $rsyncExcludes */ protected function getExcludeFlags(array $rsyncExcludes): string { diff --git a/src/Task/Transfer/ScpTask.php b/src/Task/Transfer/ScpTask.php index b34aa460..83d8f227 100644 --- a/src/Task/Transfer/ScpTask.php +++ b/src/Task/Transfer/ScpTask.php @@ -29,6 +29,9 @@ final class ScpTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $fileName = sprintf('%s.tar.gz', $deployment->getReleaseIdentifier()); @@ -96,18 +99,25 @@ public function execute(Node $node, Application $application, Deployment $deploy /** * @codeCoverageIgnore + * @param array $options */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $this->execute($node, $application, $deployment, $options); } + /** + * @param array $options + */ public function rollback(Node $node, Application $application, Deployment $deployment, array $options = []): void { $releasePath = $deployment->getApplicationReleasePath($node); $this->shell->execute(sprintf('rm -rf %s', $releasePath), $node, $deployment, true); } + /** + * @param array $options + */ private function getExcludes(array $options, string $fileName): string { $excludes = ['.git', $fileName]; diff --git a/src/Task/VarnishBanTask.php b/src/Task/VarnishBanTask.php index 8f7885e8..16e45571 100644 --- a/src/Task/VarnishBanTask.php +++ b/src/Task/VarnishBanTask.php @@ -41,15 +41,23 @@ class VarnishBanTask extends Task implements ShellCommandServiceAwareInterface { use ShellCommandServiceAwareTrait; + /** + * @param array $options + */ public function execute(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = $this->configureOptions($options); + /** @var array $options */ $this->shell->executeOrSimulate($options['varnishadm'] . ' -S ' . $options['secretFile'] . ' -T 127.0.0.1:6082 ban.url ' . escapeshellarg($options['banUrl']), $node, $deployment); } + /** + * @param array $options + */ public function simulate(Node $node, Application $application, Deployment $deployment, array $options = []): void { $options = $this->configureOptions($options); + /** @var array $options */ $this->shell->executeOrSimulate($options['varnishadm'] . ' -S ' . $options['secretFile'] . ' -T 127.0.0.1:6082 status', $node, $deployment); } diff --git a/tests/Unit/AssertCommandExecuted.php b/tests/Unit/AssertCommandExecuted.php index 138a8d0f..318fcc8f 100644 --- a/tests/Unit/AssertCommandExecuted.php +++ b/tests/Unit/AssertCommandExecuted.php @@ -20,9 +20,6 @@ class AssertCommandExecuted extends Constraint public function __construct(string $expectedCommand) { - if (!is_string($expectedCommand)) { - throw new InvalidArgumentException('Expected command should be a string, ' . gettype($expectedCommand) . ' given'); - } $this->expectedCommand = $expectedCommand; } diff --git a/tests/Unit/Domain/Clock/SystemClockTest.php b/tests/Unit/Domain/Clock/SystemClockTest.php index 6682818c..5b10f007 100644 --- a/tests/Unit/Domain/Clock/SystemClockTest.php +++ b/tests/Unit/Domain/Clock/SystemClockTest.php @@ -17,24 +17,13 @@ class SystemClockTest extends TestCase { - /** - * @var SystemClock - */ - protected $subject; + protected SystemClock $subject; protected function setUp(): void { $this->subject = new SystemClock(); } - /** - * @test - */ - public function currentTime(): void - { - self::assertIsInt($this->subject->currentTime()); - } - /** * @test */ @@ -57,7 +46,7 @@ public function stringToTimeThrowsException(): void */ public function createTimestampFromFormat(): void { - self::assertIsInt($this->subject->createTimestampFromFormat('d.m.Y', '20.12.2002')); + self::assertEquals(1040342400, $this->subject->createTimestampFromFormat('d.m.Y H:i:s', '20.12.2002 00:00:00')); } /** @@ -66,7 +55,6 @@ public function createTimestampFromFormat(): void public function createTimestampFromFormatThrowsException(): void { $this->expectException(ClockException::class); - - self::assertIsInt($this->subject->createTimestampFromFormat('d.m.Y', 'foobarbaz')); + $this->subject->createTimestampFromFormat('d.m.Y', 'foobarbaz'); } } diff --git a/tests/Unit/Domain/Model/RollbackWorkflowTest.php b/tests/Unit/Domain/Model/RollbackWorkflowTest.php index d6f62469..9aa96f82 100644 --- a/tests/Unit/Domain/Model/RollbackWorkflowTest.php +++ b/tests/Unit/Domain/Model/RollbackWorkflowTest.php @@ -210,6 +210,7 @@ public function globalTaskDefinitions(): \Iterator /** * @test * @dataProvider globalTaskDefinitions + * @param array $expectedExecutions */ public function globalTaskDefinitionsAreExecutedCorrectly( string $message, diff --git a/tests/Unit/Task/BaseTaskTest.php b/tests/Unit/Task/BaseTaskTest.php index 5b8f2f2a..9432d88d 100644 --- a/tests/Unit/Task/BaseTaskTest.php +++ b/tests/Unit/Task/BaseTaskTest.php @@ -15,7 +15,6 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; -use Prophecy\Prophecy\ObjectProphecy; use Psr\Log\LoggerInterface; use TYPO3\Surf\Domain\Model\Application; use TYPO3\Surf\Domain\Model\Deployment; @@ -36,11 +35,15 @@ abstract class BaseTaskTest extends TestCase /** * Executed commands + * + * @var array */ protected array $commands = []; /** * Predefined command responses + * + * @var array */ protected array $responses = []; @@ -53,7 +56,7 @@ abstract class BaseTaskTest extends TestCase protected Deployment $deployment; /** - * @var LoggerInterface|ObjectProphecy + * @var LoggerInterface */ protected $mockLogger; @@ -118,10 +121,10 @@ function ($command) use (&$commands, &$responses) { $this->deployment = new Deployment(static::getKernel()->getContainer(), 'TestDeployment'); - $this->mockLogger = $this->prophesize(LoggerInterface::class); - $this->task->setLogger($this->mockLogger->reveal()); + $this->mockLogger = $this->createMock(LoggerInterface::class); + $this->task->setLogger($this->mockLogger); - $this->deployment->setLogger($this->mockLogger->reveal()); + $this->deployment->setLogger($this->mockLogger); $this->deployment->setWorkspacesBasePath('./Data/Surf'); $this->application = new Application('TestApplication'); diff --git a/tests/Unit/Task/CleanupReleasesTaskTest.php b/tests/Unit/Task/CleanupReleasesTaskTest.php index 3fdc14c7..c18aaf5e 100644 --- a/tests/Unit/Task/CleanupReleasesTaskTest.php +++ b/tests/Unit/Task/CleanupReleasesTaskTest.php @@ -56,7 +56,7 @@ protected function setUp(): void $this->deployment = new Deployment(static::getKernel()->getContainer(), 'TestDeployment'); - $this->deployment->setLogger($this->mockLogger->reveal()); + $this->deployment->setLogger($this->mockLogger); $this->deployment->setWorkspacesBasePath('./Data/Surf'); $this->application = new Application('TestApplication'); @@ -75,7 +75,7 @@ protected function setUp(): void 'index.php', ], ]; - $this->task->setLogger($this->mockLogger->reveal()); + $this->task->setLogger($this->mockLogger); } protected function createTask(): CleanupReleasesTask @@ -90,8 +90,8 @@ protected function createTask(): CleanupReleasesTask */ public function doNothingJustLogDebugIfOptionKeepReleasesIsNotDefined(): void { + $this->mockLogger->expects(self::atLeastOnce())->method('debug')->with(self::anything()); $this->task->execute($this->node, $this->application, $this->deployment, []); - $this->mockLogger->debug(Argument::any())->shouldHaveBeenCalledOnce(); } /** diff --git a/tests/Unit/Task/Generic/RollbackTaskTest.php b/tests/Unit/Task/Generic/RollbackTaskTest.php index 0dc9553f..097a41b9 100644 --- a/tests/Unit/Task/Generic/RollbackTaskTest.php +++ b/tests/Unit/Task/Generic/RollbackTaskTest.php @@ -61,7 +61,7 @@ public function canNotRollbackTooFewReleasesExist(): void current previous', ]; - $this->mockLogger->notice('No more releases you can revert to.')->shouldBeCalledOnce(); + $this->mockLogger->expects(self::once())->method('notice')->with('No more releases you can revert to.'); $this->task->execute($this->node, $this->application, $this->deployment); diff --git a/tests/Unit/Task/Neos/Flow/RunCommandTaskTest.php b/tests/Unit/Task/Neos/Flow/RunCommandTaskTest.php index b8023240..c724eb66 100644 --- a/tests/Unit/Task/Neos/Flow/RunCommandTaskTest.php +++ b/tests/Unit/Task/Neos/Flow/RunCommandTaskTest.php @@ -46,6 +46,7 @@ public function requiredOptionCommandNotGivenThrowsException(): void /** * @test * @dataProvider executeWithDifferentOptions + * @param array $options */ public function executeSuccessfully(string $expectedCommand, array $options = []): void { diff --git a/tests/Unit/Task/Neos/Flow/SetFilePermissionsTaskTest.php b/tests/Unit/Task/Neos/Flow/SetFilePermissionsTaskTest.php index a1da567f..ebb440dd 100644 --- a/tests/Unit/Task/Neos/Flow/SetFilePermissionsTaskTest.php +++ b/tests/Unit/Task/Neos/Flow/SetFilePermissionsTaskTest.php @@ -37,9 +37,9 @@ public function noFlowApplicationGivenThrowsException(): void * @dataProvider executeWithDifferentOptions * * @param string $expectedCommand - * @param array $options + * @param array $options */ - public function executeSuccessfully($expectedCommand, array $options = []): void + public function executeSuccessfully(string $expectedCommand, array $options = []): void { $this->application = new Flow(); $this->task->execute($this->node, $this->application, $this->deployment, $options); diff --git a/tests/Unit/Task/RsyncFoldersTaskTest.php b/tests/Unit/Task/RsyncFoldersTaskTest.php index 9098bfbe..96b12120 100644 --- a/tests/Unit/Task/RsyncFoldersTaskTest.php +++ b/tests/Unit/Task/RsyncFoldersTaskTest.php @@ -30,11 +30,10 @@ public function emptyFoldersOptionsReturnsVoid(): void /** * @test - * * @dataProvider executeWithDifferentOptions * - * @param array|string $expectedCommands - * @param array $options + * @param array|string $expectedCommands + * @param array $options */ public function executeSuccessfully($expectedCommands, array $options): void { diff --git a/tests/Unit/Task/TYPO3/CMS/CompareDatabaseTaskTest.php b/tests/Unit/Task/TYPO3/CMS/CompareDatabaseTaskTest.php index 07196c57..97839f69 100644 --- a/tests/Unit/Task/TYPO3/CMS/CompareDatabaseTaskTest.php +++ b/tests/Unit/Task/TYPO3/CMS/CompareDatabaseTaskTest.php @@ -12,7 +12,6 @@ namespace TYPO3\Surf\Tests\Unit\Task\TYPO3\CMS; use InvalidArgumentException; -use Prophecy\Argument; use TYPO3\Surf\Application\BaseApplication; use TYPO3\Surf\Application\TYPO3\CMS; use TYPO3\Surf\Exception\InvalidConfigurationException; @@ -61,8 +60,8 @@ public function wrongApplicationTypeGivenThrowsException(): void */ public function noSuitableCliArgumentsGiven(): void { + $this->mockLogger->expects(self::once())->method('warning')->with(self::anything()); $this->task->execute($this->node, $this->application, $this->deployment, []); - $this->mockLogger->warning(Argument::any())->shouldBeCalledOnce(); } /** diff --git a/tests/Unit/Task/TYPO3/CMS/FlushCachesTaskTest.php b/tests/Unit/Task/TYPO3/CMS/FlushCachesTaskTest.php index 1874b9e7..e3ce8299 100644 --- a/tests/Unit/Task/TYPO3/CMS/FlushCachesTaskTest.php +++ b/tests/Unit/Task/TYPO3/CMS/FlushCachesTaskTest.php @@ -12,7 +12,6 @@ namespace TYPO3\Surf\Tests\Unit\Task\TYPO3\CMS; use InvalidArgumentException; -use Prophecy\Argument; use TYPO3\Surf\Application\BaseApplication; use TYPO3\Surf\Application\TYPO3\CMS; use TYPO3\Surf\Exception\InvalidConfigurationException; @@ -62,8 +61,8 @@ public function wrongApplicationTypeGivenThrowsException(): void */ public function noSuitableCliArgumentsGiven(): void { + $this->mockLogger->expects(self::once())->method('warning')->with(self::anything()); $this->task->execute($this->node, $this->application, $this->deployment, []); - $this->mockLogger->warning(Argument::any())->shouldBeCalledOnce(); } /** diff --git a/tests/Unit/Task/TYPO3/CMS/SymlinkDataTaskTest.php b/tests/Unit/Task/TYPO3/CMS/SymlinkDataTaskTest.php index 70bd751a..81cb356d 100644 --- a/tests/Unit/Task/TYPO3/CMS/SymlinkDataTaskTest.php +++ b/tests/Unit/Task/TYPO3/CMS/SymlinkDataTaskTest.php @@ -145,6 +145,10 @@ public function withAdditionalDirectoriesAndApplicationRootCreatesCorrectLinks() $this->assertCommandExecuted("ln -sf '../{$dataPath}/test/assets' 'test/assets'"); } + /** + * @param array $options + * @return array + */ private function mergeOptions(array $options): array { return array_merge($this->application->getOptions(), $options); diff --git a/tests/Unit/Task/Test/HttpTestTaskTest.php b/tests/Unit/Task/Test/HttpTestTaskTest.php index b36a499c..b714d5ff 100644 --- a/tests/Unit/Task/Test/HttpTestTaskTest.php +++ b/tests/Unit/Task/Test/HttpTestTaskTest.php @@ -156,6 +156,9 @@ public function responseBodyDoesNotContainsCorrectContent(): void $this->task->execute($this->node, $this->application, $this->deployment, $options); } + /** + * @param array $options + */ protected function assertNoExceptionThrown(array $options): void { $exception = null;