diff --git a/src/Configuration/HostConfigAbstract.php b/src/Configuration/HostConfigAbstract.php index 79d97801..62f31186 100644 --- a/src/Configuration/HostConfigAbstract.php +++ b/src/Configuration/HostConfigAbstract.php @@ -2,6 +2,7 @@ namespace Phabalicious\Configuration; +use ArrayAccess; use Phabalicious\Configuration\Storage\Node; use Phabalicious\Method\BaseMethod; use Phabalicious\ShellProvider\ShellProviderInterface; diff --git a/src/Method/ArtifactsGitMethod.php b/src/Method/ArtifactsGitMethod.php index c65cdf10..b9d4963f 100644 --- a/src/Method/ArtifactsGitMethod.php +++ b/src/Method/ArtifactsGitMethod.php @@ -86,6 +86,7 @@ public function getDefaultConfig(ConfigurationService $configuration_service, No ], ]; + $return['gitRootFolder'] = $configuration_service->getFabfilePath(); $return['deployMethod'] = 'git-sync'; return $parent->merge(new Node($return, $this->getName().' method defaults')); @@ -186,7 +187,7 @@ protected function pullTargetRepository(HostConfig $host_config, TaskContextInte $shell = $context->get('outerShell', $host_config->shell()); $branch_exists = $shell->run( sprintf('#!git ls-remote -h --exit-code %s %s', $target_repository, $target_branch), - true + RunOptions::CAPTURE_AND_HIDE_OUTPUT )->succeeded(); $branch_to_clone = $branch_exists ? $target_branch : $host_config[self::PREFS_KEY]['baseBranch'] ?? 'master'; $clone_options = $host_config[self::PREFS_KEY]['gitOptions']['clone'] ?? []; @@ -205,7 +206,7 @@ protected function pullTargetRepository(HostConfig $host_config, TaskContextInte $shell->run(sprintf('#!git push --set-upstream origin %s', $target_branch)); } - $log = $shell->run('#!git log --format="%H|%s"', true); + $log = $shell->run('#!git log --format="%H|%s"', RunOptions::CAPTURE_AND_HIDE_OUTPUT); $found = false; $last_successful_deployment_hash = false; $new_commits_since_last_deployment = []; @@ -231,7 +232,7 @@ protected function pullTargetRepository(HostConfig $host_config, TaskContextInte '#!git diff %s..%s --name-only', $last_successful_deployment_hash, $new_commits_since_last_deployment[0]['hash'] - ), true); + ), RunOptions::CAPTURE_AND_HIDE_OUTPUT); $context->io()->note('Changed files:'); $context->io()->listing($affected_files->getOutput()); } diff --git a/src/Scaffolder/TwigExtensions/GetSecretExtension.php b/src/Scaffolder/TwigExtensions/GetSecretExtension.php index 7fc1b566..0089f00b 100644 --- a/src/Scaffolder/TwigExtensions/GetSecretExtension.php +++ b/src/Scaffolder/TwigExtensions/GetSecretExtension.php @@ -4,6 +4,7 @@ use Phabalicious\Utilities\PasswordManagerInterface; use Twig\Extension\AbstractExtension; +use Twig\TwigFunction; class GetSecretExtension extends AbstractExtension { @@ -20,7 +21,7 @@ public function __construct(PasswordManagerInterface $password_manager) public function getFunctions(): array { return [ - new \Twig\TwigFunction('secret', [$this, 'getSecret']), + new TwigFunction('secret', [$this, 'getSecret']), ]; } diff --git a/src/Scaffolder/TwigExtensions/Md5Extension.php b/src/Scaffolder/TwigExtensions/Md5Extension.php index 2f9ba601..7fb9541c 100644 --- a/src/Scaffolder/TwigExtensions/Md5Extension.php +++ b/src/Scaffolder/TwigExtensions/Md5Extension.php @@ -3,13 +3,14 @@ namespace Phabalicious\Scaffolder\TwigExtensions; use Twig\Extension\AbstractExtension; +use Twig\TwigFilter; class Md5Extension extends AbstractExtension { public function getFilters(): array { return [ - new \Twig\TwigFilter('md5', 'md5'), + new TwigFilter('md5', 'md5'), ]; } diff --git a/src/Utilities/PluginDiscovery.php b/src/Utilities/PluginDiscovery.php index 493b3930..3621291d 100644 --- a/src/Utilities/PluginDiscovery.php +++ b/src/Utilities/PluginDiscovery.php @@ -4,6 +4,7 @@ use Composer\Autoload\ClassLoader; use Composer\Semver\Comparator; +use Exception; use Phabalicious\Configuration\ConfigurationService; use Phabalicious\Exception\MismatchedVersionException; use Psr\Container\ContainerInterface; diff --git a/tests/ConfigurationServiceTest.php b/tests/ConfigurationServiceTest.php index b8e4b479..07fd5efa 100644 --- a/tests/ConfigurationServiceTest.php +++ b/tests/ConfigurationServiceTest.php @@ -4,6 +4,8 @@ use Phabalicious\Configuration\ConfigurationService; use Phabalicious\Configuration\Storage\Node; +use Phabalicious\Exception\FabfileNotFoundException; +use Phabalicious\Exception\MismatchedVersionException; use Phabalicious\Method\DrushMethod; use Phabalicious\Method\LocalMethod; use Phabalicious\Method\MethodFactory; @@ -60,7 +62,7 @@ public function testCustomFabfile() public function testNonExistingCustomFabfile() { - $this->expectException(\Phabalicious\Exception\FabfileNotFoundException::class); + $this->expectException(FabfileNotFoundException::class); $result = $this->config->readConfiguration( __DIR__, __DIR__.'/assets/custom__not_existing.yaml' @@ -99,7 +101,7 @@ public function testRegularFabfileInSubSubSubFolder() public function testNonExistingFabfile() { - $this->expectException(\Phabalicious\Exception\FabfileNotFoundException::class); + $this->expectException(FabfileNotFoundException::class); $result = $this->config->readConfiguration( __DIR__.'/assets/non-existing-fabfile-tests/one/two/three' ); @@ -107,7 +109,7 @@ public function testNonExistingFabfile() public function testNonMatchingVersion() { - $this->expectException(\Phabalicious\Exception\MismatchedVersionException::class); + $this->expectException(MismatchedVersionException::class); $application = $this->getMockBuilder(Application::class) ->setMethods(['getVersion']) ->getMock(); diff --git a/tests/GitMethodTest.php b/tests/GitMethodTest.php index deabf2f0..964f5bab 100644 --- a/tests/GitMethodTest.php +++ b/tests/GitMethodTest.php @@ -14,6 +14,7 @@ use Phabalicious\Method\TaskContext; use Phabalicious\ShellProvider\ShellProviderInterface; use Psr\Log\AbstractLogger; +use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -35,7 +36,7 @@ class GitMethodTest extends PhabTestCase public function setUp(): void { $logger = $this->getMockBuilder(AbstractLogger::class)->getMock(); - $app = $this->getMockBuilder(\Symfony\Component\Console\Application::class)->getMock(); + $app = $this->getMockBuilder(Application::class)->getMock(); $this->method = new GitMethod($logger); $this->configurationService = new ConfigurationService($app, $logger); diff --git a/tests/WebhookTest.php b/tests/WebhookTest.php index 4a1557fb..07302c29 100644 --- a/tests/WebhookTest.php +++ b/tests/WebhookTest.php @@ -10,6 +10,7 @@ use Phabalicious\Method\TaskContext; use Phabalicious\Method\WebhookMethod; use Psr\Log\AbstractLogger; +use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; @@ -27,7 +28,7 @@ class WebhookTest extends PhabTestCase public function setup(): void { $logger = $this->getMockBuilder(AbstractLogger::class)->getMock(); - $app = $this->getMockBuilder(\Symfony\Component\Console\Application::class)->getMock(); + $app = $this->getMockBuilder(Application::class)->getMock(); $this->method = new WebhookMethod($logger); $this->configurationService = new ConfigurationService($app, $logger);