From 307d7a2135324e60ae85342cd9aa20edb48934e9 Mon Sep 17 00:00:00 2001 From: George Steel Date: Mon, 29 Aug 2022 10:25:20 +0100 Subject: [PATCH 1/4] Update doctrine coding standard to 10 and bump dev-deps tp latest Signed-off-by: George Steel --- composer.json | 10 ++-- composer.lock | 132 ++++++++++++++++++++++++++------------------------ 2 files changed, 75 insertions(+), 67 deletions(-) diff --git a/composer.json b/composer.json index d8d93409..747ab81c 100644 --- a/composer.json +++ b/composer.json @@ -21,13 +21,13 @@ "symfony/console": "^5.4.12" }, "require-dev": { - "doctrine/coding-standard": "^9.0.0", + "doctrine/coding-standard": "^10.0.0", "php-standard-library/psalm-plugin": "^2.0.2", - "phpunit/phpunit": "^9.5.0", + "phpunit/phpunit": "^9.5.23", "psalm/plugin-phpunit": "^0.17.0", - "roave/infection-static-analysis-plugin": "^1.7", - "squizlabs/php_codesniffer": "^3.5.8", - "vimeo/psalm": "^4.7.2" + "roave/infection-static-analysis-plugin": "^1.22.0", + "squizlabs/php_codesniffer": "^3.7.1", + "vimeo/psalm": "^4.26.0" }, "config": { "sort-packages": true, diff --git a/composer.lock b/composer.lock index 33a8a90e..f0a30bb0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a7a1861c9ee388450344a33174ba8ad4", + "content-hash": "a7b2a5eeb09216929b5544228650def9", "packages": [ { "name": "azjezz/psl", @@ -148,16 +148,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.4.5", + "version": "7.5.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82" + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1dd98b0564cb3f6bd16ce683cb755f94c10fbd82", - "reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b50a2a1251152e43f6a37f0fa053e730a67d25ba", + "reference": "b50a2a1251152e43f6a37f0fa053e730a67d25ba", "shasum": "" }, "require": { @@ -172,10 +172,10 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", + "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", - "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -185,8 +185,12 @@ }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, "branch-alias": { - "dev-master": "7.4-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -252,7 +256,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.4.5" + "source": "https://github.com/guzzle/guzzle/tree/7.5.0" }, "funding": [ { @@ -268,20 +272,20 @@ "type": "tidelift" } ], - "time": "2022-06-20T22:16:13+00:00" + "time": "2022-08-28T15:39:27+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.5.1", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" + "reference": "b94b2807d85443f9719887892882d0329d1e2598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", - "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", + "reference": "b94b2807d85443f9719887892882d0329d1e2598", "shasum": "" }, "require": { @@ -336,7 +340,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.1" + "source": "https://github.com/guzzle/promises/tree/1.5.2" }, "funding": [ { @@ -352,20 +356,20 @@ "type": "tidelift" } ], - "time": "2021-10-22T20:56:57+00:00" + "time": "2022-08-28T14:55:35+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.4.0", + "version": "2.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "13388f00956b1503577598873fffb5ae994b5737" + "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/13388f00956b1503577598873fffb5ae994b5737", - "reference": "13388f00956b1503577598873fffb5ae994b5737", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/69568e4293f4fa993f3b0e51c9723e1e17c41379", + "reference": "69568e4293f4fa993f3b0e51c9723e1e17c41379", "shasum": "" }, "require": { @@ -379,15 +383,19 @@ "psr/http-message-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", + "bamarni/composer-bin-plugin": "^1.8.1", "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.8 || ^9.3.10" + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, "branch-alias": { "dev-master": "2.4-dev" } @@ -451,7 +459,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.4.0" + "source": "https://github.com/guzzle/psr7/tree/2.4.1" }, "funding": [ { @@ -467,7 +475,7 @@ "type": "tidelift" } ], - "time": "2022-06-20T21:43:11+00:00" + "time": "2022-08-28T14:45:39+00:00" }, { "name": "jwage/changelog-generator", @@ -3649,23 +3657,23 @@ }, { "name": "doctrine/coding-standard", - "version": "9.0.2", + "version": "10.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/coding-standard.git", - "reference": "35a2452c6025cb739c3244b3348bcd1604df07d1" + "reference": "7903671d7d33c231c8921058b7c14b8f57cbacb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/35a2452c6025cb739c3244b3348bcd1604df07d1", - "reference": "35a2452c6025cb739c3244b3348bcd1604df07d1", + "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/7903671d7d33c231c8921058b7c14b8f57cbacb7", + "reference": "7903671d7d33c231c8921058b7c14b8f57cbacb7", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", - "php": "^7.1 || ^8.0", - "slevomat/coding-standard": "^7.0.0", - "squizlabs/php_codesniffer": "^3.6.0" + "php": "^7.2 || ^8.0", + "slevomat/coding-standard": "^8.2", + "squizlabs/php_codesniffer": "^3.7" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -3698,9 +3706,9 @@ ], "support": { "issues": "https://github.com/doctrine/coding-standard/issues", - "source": "https://github.com/doctrine/coding-standard/tree/9.0.2" + "source": "https://github.com/doctrine/coding-standard/tree/10.0.0" }, - "time": "2021-04-12T15:11:14+00:00" + "time": "2022-08-26T10:53:05+00:00" }, { "name": "doctrine/instantiator", @@ -5390,16 +5398,16 @@ }, { "name": "roave/infection-static-analysis-plugin", - "version": "1.21.0", + "version": "1.22.0", "source": { "type": "git", "url": "https://github.com/Roave/infection-static-analysis-plugin.git", - "reference": "7d7587684cc5e2425d9ae52e8ab7358936373c0e" + "reference": "34a06cfacf64542b94bd9a406bbb6b4f1cc2767c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/infection-static-analysis-plugin/zipball/7d7587684cc5e2425d9ae52e8ab7358936373c0e", - "reference": "7d7587684cc5e2425d9ae52e8ab7358936373c0e", + "url": "https://api.github.com/repos/Roave/infection-static-analysis-plugin/zipball/34a06cfacf64542b94bd9a406bbb6b4f1cc2767c", + "reference": "34a06cfacf64542b94bd9a406bbb6b4f1cc2767c", "shasum": "" }, "require": { @@ -5407,11 +5415,11 @@ "ocramius/package-versions": "^1.9.0 || ^2.0.0", "php": "~8.0.0|~8.1.0", "sanmai/later": "^0.1.2", - "vimeo/psalm": "^4.24.0" + "vimeo/psalm": "^4.26.0" }, "require-dev": { - "doctrine/coding-standard": "^9.0.0", - "phpunit/phpunit": "^9.5.21" + "doctrine/coding-standard": "^10.0.0", + "phpunit/phpunit": "^9.5.23" }, "bin": [ "bin/roave-infection-static-analysis-plugin" @@ -5435,9 +5443,9 @@ "description": "Static analysis on top of mutation testing - prevents escaped mutants from being invalid according to static analysis", "support": { "issues": "https://github.com/Roave/infection-static-analysis-plugin/issues", - "source": "https://github.com/Roave/infection-static-analysis-plugin/tree/1.21.0" + "source": "https://github.com/Roave/infection-static-analysis-plugin/tree/1.22.0" }, - "time": "2022-06-29T08:30:25+00:00" + "time": "2022-08-29T08:57:35+00:00" }, { "name": "sanmai/later", @@ -6419,16 +6427,16 @@ }, { "name": "sebastian/type", - "version": "3.0.0", + "version": "3.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad" + "reference": "fb44e1cc6e557418387ad815780360057e40753e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", - "reference": "b233b84bc4465aff7b57cf1c4bc75c86d00d6dad", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb44e1cc6e557418387ad815780360057e40753e", + "reference": "fb44e1cc6e557418387ad815780360057e40753e", "shasum": "" }, "require": { @@ -6440,7 +6448,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -6463,7 +6471,7 @@ "homepage": "https://github.com/sebastianbergmann/type", "support": { "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/3.0.0" + "source": "https://github.com/sebastianbergmann/type/tree/3.1.0" }, "funding": [ { @@ -6471,7 +6479,7 @@ "type": "github" } ], - "time": "2022-03-15T09:54:48+00:00" + "time": "2022-08-29T06:55:37+00:00" }, { "name": "sebastian/version", @@ -6592,37 +6600,37 @@ }, { "name": "slevomat/coding-standard", - "version": "7.2.1", + "version": "8.4.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90" + "reference": "02f27326be19633a1b6ba76745390bbf9a4be0b6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/aff06ae7a84e4534bf6f821dc982a93a5d477c90", - "reference": "aff06ae7a84e4534bf6f821dc982a93a5d477c90", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/02f27326be19633a1b6ba76745390bbf9a4be0b6", + "reference": "02f27326be19633a1b6ba76745390bbf9a4be0b6", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.5.1", - "squizlabs/php_codesniffer": "^3.6.2" + "phpstan/phpdoc-parser": ">=1.7.0 <1.8.0", + "squizlabs/php_codesniffer": "^3.7.1" }, "require-dev": { - "phing/phing": "2.17.3", + "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.4.10|1.7.1", + "phpstan/phpstan": "1.4.10|1.8.2", "phpstan/phpstan-deprecation-rules": "1.0.0", "phpstan/phpstan-phpunit": "1.0.0|1.1.1", - "phpstan/phpstan-strict-rules": "1.2.3", - "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" + "phpstan/phpstan-strict-rules": "1.3.0", + "phpunit/phpunit": "7.5.20|8.5.21|9.5.21" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "7.x-dev" + "dev-master": "8.x-dev" } }, "autoload": { @@ -6637,7 +6645,7 @@ "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/7.2.1" + "source": "https://github.com/slevomat/coding-standard/tree/8.4.0" }, "funding": [ { @@ -6649,7 +6657,7 @@ "type": "tidelift" } ], - "time": "2022-05-25T10:58:12+00:00" + "time": "2022-08-09T19:03:45+00:00" }, { "name": "squizlabs/php_codesniffer", From 6edfebcf90bf1d49d4fac538a44754d33b517460 Mon Sep 17 00:00:00 2001 From: George Steel Date: Mon, 29 Aug 2022 10:27:57 +0100 Subject: [PATCH 2/4] CS Fixes - Trailing Commas - SlevomatCodingStandard.Functions.RequireTrailingCommaInCall - SlevomatCodingStandard.Functions.RequireTrailingCommaInDeclaration Signed-off-by: George Steel --- bin/console.php | 28 +++---- .../Command/BumpChangelogForReleaseBranch.php | 6 +- .../Command/CreateMergeUpPullRequest.php | 12 +-- src/Application/Command/CreateMilestones.php | 2 +- src/Application/Command/ReleaseCommand.php | 10 +-- .../SwitchDefaultBranchToNextMinor.php | 8 +- .../BumpAndCommitChangelogVersion.php | 2 +- ...ommitChangelogVersionViaKeepAChangelog.php | 8 +- src/Changelog/ChangelogExists.php | 2 +- src/Changelog/ChangelogExistsViaConsole.php | 2 +- src/Changelog/ChangelogReleaseNotes.php | 6 +- src/Changelog/CommitReleaseChangelog.php | 2 +- ...ommitReleaseChangelogViaKeepAChangelog.php | 6 +- src/Environment/EnvironmentVariables.php | 4 +- src/Git/CheckoutBranch.php | 2 +- src/Git/CheckoutBranchViaConsole.php | 2 +- src/Git/CommitFile.php | 2 +- src/Git/CommitFileViaConsole.php | 6 +- src/Git/CreateTag.php | 2 +- src/Git/CreateTagViaConsole.php | 2 +- src/Git/Fetch.php | 2 +- ...rentUserByReplacingCurrentOriginRemote.php | 2 +- ...getCandidateBranchesFromRemoteBranches.php | 2 +- src/Git/Push.php | 2 +- src/Git/PushViaConsole.php | 2 +- .../Value/MergeTargetCandidateBranches.php | 2 +- .../Api/GraphQL/Query/GetGithubMilestone.php | 2 +- .../Response/IssueOrPullRequest.php | 4 +- .../GetMilestoneChangelog/Response/Label.php | 4 +- .../Response/Milestone.php | 6 +- ...MilestoneFirst100IssuesAndPullRequests.php | 4 +- src/Github/Api/GraphQL/RunGraphQLQuery.php | 4 +- src/Github/Api/GraphQL/RunQuery.php | 2 +- src/Github/Api/V3/CreateMilestone.php | 2 +- .../Api/V3/CreateMilestoneThroughApiCall.php | 12 +-- src/Github/Api/V3/CreatePullRequest.php | 2 +- .../V3/CreatePullRequestThroughApiCall.php | 6 +- src/Github/Api/V3/CreateRelease.php | 2 +- .../Api/V3/CreateReleaseThroughApiCall.php | 6 +- src/Github/Api/V3/SetDefaultBranch.php | 2 +- .../Api/V3/SetDefaultBranchThroughApiCall.php | 6 +- src/Github/CreateReleaseText.php | 4 +- .../CreateReleaseTextThroughChangelog.php | 8 +- .../CreateReleaseTextViaKeepAChangelog.php | 16 ++-- src/Github/Event/MilestoneClosedEvent.php | 4 +- src/Github/GenerateChangelog.php | 2 +- src/Github/JwageGenerateChangelog.php | 6 +- src/Github/MergeMultipleReleaseNotes.php | 8 +- .../BumpChangelogForReleaseBranchTest.php | 8 +- .../CreateMergeUpPullRequestTest.php | 16 ++-- .../unit/Application/CreateMilestonesTest.php | 4 +- test/unit/Application/ReleaseCommandTest.php | 10 +-- .../SwitchDefaultBranchToNextMinorTest.php | 18 ++--- ...tChangelogVersionViaKeepAChangelogTest.php | 22 ++--- .../ChangelogExistsViaConsoleTest.php | 10 +-- .../Changelog/ChangelogReleaseNotesTest.php | 4 +- .../ReleaseChangelogViaKeepAChangelogTest.php | 24 +++--- test/unit/Git/CommitFileViaConsoleTest.php | 6 +- test/unit/Git/CreateTagViaConsoleTest.php | 2 +- ...UserByReplacingCurrentOriginRemoteTest.php | 10 +-- ...andidateBranchesFromRemoteBranchesTest.php | 2 +- test/unit/Git/Value/BranchNameTest.php | 6 +- .../MergeTargetCandidateBranchesTest.php | 80 +++++++++---------- test/unit/Git/Value/SemVerVersionTest.php | 10 +-- .../Response/IssueOrPullRequestTest.php | 8 +- .../Response/MilestoneTest.php | 2 +- ...stoneFirst100IssuesAndPullRequestsTest.php | 4 +- .../Api/GraphQL/RunGraphQLQueryTest.php | 26 +++--- .../Github/Api/V3/CreateMilestoneTest.php | 26 +++--- .../Github/Api/V3/CreatePullRequestTest.php | 10 +-- .../CreatePullRequestThroughApiCallTest.php | 12 +-- test/unit/Github/Api/V3/CreateReleaseTest.php | 12 +-- .../V3/CreateReleaseThroughApiCallTest.php | 8 +- .../V3/SetDefaultBranchThroughApiCallTest.php | 20 ++--- test/unit/Github/CreateChangelogTextTest.php | 8 +- ...CreateReleaseTextViaKeepAChangelogTest.php | 26 +++--- ...entGithubEventFromGithubActionPathTest.php | 2 +- .../Github/JwageGenerateChangelogTest.php | 2 +- .../Github/MergeMultipleReleaseNotesTest.php | 24 +++--- test/unit/Github/Value/RepositoryNameTest.php | 4 +- ...rtGpgKeyFromStringViaTemporaryFileTest.php | 2 +- test/unit/Gpg/SecretKeyIdTest.php | 2 +- 82 files changed, 334 insertions(+), 334 deletions(-) diff --git a/bin/console.php b/bin/console.php index 50b2ddac..f1e2e6ba 100755 --- a/bin/console.php +++ b/bin/console.php @@ -57,7 +57,7 @@ static function (int $errorCode, string $message = '', string $file = '', int $line = 0): bool { throw new ErrorException($message, 0, $errorCode, $file, $line); }, - E_STRICT | E_NOTICE | E_WARNING + E_STRICT | E_NOTICE | E_WARNING, ); $variables = EnvironmentVariables::fromEnvironment(new ImportGpgKeyFromStringViaTemporaryFile()); @@ -72,7 +72,7 @@ static function (int $errorCode, string $message = '', string $file = '', int $l $getMilestone = new GetMilestoneFirst100IssuesAndPullRequests(new RunGraphQLQuery( $makeRequests, $httpClient, - $githubToken + $githubToken, )); $changelogExists = new ChangelogExistsViaConsole(); $checkoutBranch = new CheckoutBranchViaConsole(); @@ -83,12 +83,12 @@ static function (int $errorCode, string $message = '', string $file = '', int $l $checkoutBranch, $commit, $push, - $logger + $logger, ); $createCommitText = new CreateReleaseTextThroughChangelog(JwageGenerateChangelog::create( $makeRequests, $httpClient, - new GitHubOAuthToken($githubToken) + new GitHubOAuthToken($githubToken), )); $createReleaseText = new MergeMultipleReleaseNotes([ new CreateReleaseTextViaKeepAChangelog($changelogExists, new SystemClock(new DateTimeZone('UTC'))), @@ -97,14 +97,14 @@ static function (int $errorCode, string $message = '', string $file = '', int $l $createRelease = new CreateReleaseThroughApiCall( $makeRequests, $httpClient, - $githubToken + $githubToken, ); $bumpChangelogVersion = new BumpAndCommitChangelogVersionViaKeepAChangelog( $changelogExists, $checkoutBranch, $commit, $push, - $logger + $logger, ); $application = new Application(Versions::rootPackageName(), Versions::getVersion('laminas/automatic-releases')); @@ -120,7 +120,7 @@ static function (int $errorCode, string $message = '', string $file = '', int $l $createReleaseText, new CreateTagViaConsole(), $push, - $createRelease + $createRelease, ), new CreateMergeUpPullRequest( $variables, @@ -133,8 +133,8 @@ static function (int $errorCode, string $message = '', string $file = '', int $l new CreatePullRequestThroughApiCall( $makeRequests, $httpClient, - $githubToken - ) + $githubToken, + ), ), new SwitchDefaultBranchToNextMinor( $variables, @@ -145,16 +145,16 @@ static function (int $errorCode, string $message = '', string $file = '', int $l new SetDefaultBranchThroughApiCall( $makeRequests, $httpClient, - $githubToken + $githubToken, ), - $bumpChangelogVersion + $bumpChangelogVersion, ), new BumpChangelogForReleaseBranch( $variables, $loadEvent, $fetch, $getCandidateBranches, - $bumpChangelogVersion + $bumpChangelogVersion, ), new CreateMilestones( $loadEvent, @@ -162,8 +162,8 @@ static function (int $errorCode, string $message = '', string $file = '', int $l $makeRequests, $httpClient, $githubToken, - $logger - ) + $logger, + ), ), ]); diff --git a/src/Application/Command/BumpChangelogForReleaseBranch.php b/src/Application/Command/BumpChangelogForReleaseBranch.php index c3cfaf38..380845cb 100644 --- a/src/Application/Command/BumpChangelogForReleaseBranch.php +++ b/src/Application/Command/BumpChangelogForReleaseBranch.php @@ -29,7 +29,7 @@ public function __construct( LoadCurrentGithubEvent $loadEvent, Fetch $fetch, GetMergeTargetCandidateBranches $getMergeTargets, - BumpAndCommitChangelogVersion $bumpChangelogVersion + BumpAndCommitChangelogVersion $bumpChangelogVersion, ) { parent::__construct('laminas:automatic-releases:bump-changelog'); @@ -51,7 +51,7 @@ public function execute(InputInterface $input, OutputInterface $output): int ($this->fetch)( $repositoryName->uri(), $repositoryName->uriWithTokenAuthentication($this->environment->githubToken()), - $repositoryPath + $repositoryPath, ); $mergeCandidates = ($this->getMergeTargets)($repositoryPath); @@ -65,7 +65,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $repositoryPath, $releaseVersion, $releaseBranch, - $this->environment->signingSecretKey() + $this->environment->signingSecretKey(), ); return 0; diff --git a/src/Application/Command/CreateMergeUpPullRequest.php b/src/Application/Command/CreateMergeUpPullRequest.php index 358dccdb..9fe0299e 100644 --- a/src/Application/Command/CreateMergeUpPullRequest.php +++ b/src/Application/Command/CreateMergeUpPullRequest.php @@ -40,7 +40,7 @@ public function __construct( GetGithubMilestone $getMilestone, CreateReleaseText $createReleaseText, Push $push, - CreatePullRequest $createPullRequest + CreatePullRequest $createPullRequest, ) { parent::__construct('laminas:automatic-releases:create-merge-up-pull-request'); @@ -65,7 +65,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $this->fetch->__invoke( $repositoryName->uri(), $repositoryName->uriWithTokenAuthentication($this->variables->githubToken()), - $repositoryPath + $repositoryPath, ); $mergeCandidates = $this->getMergeCandidates->__invoke($repositoryPath); @@ -77,7 +77,7 @@ public function execute(InputInterface $input, OutputInterface $output): int if ($mergeUpTarget === null) { $output->writeln(Str\format( 'No merge-up candidate for release %s - skipping pull request creation', - $releaseVersion->fullReleaseName() + $releaseVersion->fullReleaseName(), )); return 0; @@ -90,7 +90,7 @@ public function execute(InputInterface $input, OutputInterface $output): int . '-merge-up-into-' . $mergeUpTarget->name() . '_' - . SecureRandom\string(8) // This is to ensure that a new merge-up pull request is created even if one already exists + . SecureRandom\string(8), // This is to ensure that a new merge-up pull request is created even if one already exists ); $releaseNotes = $this->createReleaseText->__invoke( @@ -98,7 +98,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $event->repository(), $event->version(), $releaseBranch, - $repositoryPath + $repositoryPath, ); $this->push->__invoke($repositoryPath, $releaseBranch->name(), $mergeUpBranch->name()); @@ -107,7 +107,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $mergeUpBranch, $mergeUpTarget, 'Merge release ' . $releaseVersion->fullReleaseName() . ' into ' . $mergeUpTarget->name(), - $releaseNotes->contents() + $releaseNotes->contents(), ); return 0; diff --git a/src/Application/Command/CreateMilestones.php b/src/Application/Command/CreateMilestones.php index 2e41544c..3c580fd1 100644 --- a/src/Application/Command/CreateMilestones.php +++ b/src/Application/Command/CreateMilestones.php @@ -20,7 +20,7 @@ final class CreateMilestones extends Command public function __construct( LoadCurrentGithubEvent $loadEvent, - CreateMilestone $createMilestone + CreateMilestone $createMilestone, ) { parent::__construct('laminas:automatic-releases:create-milestones'); diff --git a/src/Application/Command/ReleaseCommand.php b/src/Application/Command/ReleaseCommand.php index d66326d0..52b35826 100644 --- a/src/Application/Command/ReleaseCommand.php +++ b/src/Application/Command/ReleaseCommand.php @@ -44,7 +44,7 @@ public function __construct( CreateReleaseText $createChangelogText, CreateTag $createTag, Push $push, - CreateRelease $createRelease + CreateRelease $createRelease, ) { parent::__construct('laminas:automatic-releases:release'); @@ -71,7 +71,7 @@ public function execute(InputInterface $input, OutputInterface $output): int ($this->fetch)( $repositoryName->uri(), $repositoryName->uriWithTokenAuthentication($this->environment->githubToken()), - $repositoryPath + $repositoryPath, ); $mergeCandidates = ($this->getMergeTargets)($repositoryPath); @@ -90,7 +90,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $repositoryName, $releaseVersion, $releaseBranch, - $repositoryPath + $repositoryPath, ); ($this->commitChangelog)( @@ -98,7 +98,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $repositoryPath, $releaseVersion, $releaseBranch, - $this->environment->signingSecretKey() + $this->environment->signingSecretKey(), ); $tagName = $releaseVersion->fullReleaseName(); @@ -108,7 +108,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $releaseBranch, $tagName, $changelogReleaseNotes->contents(), - $this->environment->signingSecretKey() + $this->environment->signingSecretKey(), ); ($this->push)($repositoryPath, $tagName); ($this->push)($repositoryPath, $tagName, $releaseVersion->targetReleaseBranchName()->name()); diff --git a/src/Application/Command/SwitchDefaultBranchToNextMinor.php b/src/Application/Command/SwitchDefaultBranchToNextMinor.php index 13997545..87cfc562 100644 --- a/src/Application/Command/SwitchDefaultBranchToNextMinor.php +++ b/src/Application/Command/SwitchDefaultBranchToNextMinor.php @@ -34,7 +34,7 @@ public function __construct( GetMergeTargetCandidateBranches $getMergeCandidates, Push $push, SetDefaultBranch $switchDefaultBranch, - BumpAndCommitChangelogVersion $bumpChangelogVersion + BumpAndCommitChangelogVersion $bumpChangelogVersion, ) { parent::__construct('laminas:automatic-releases:switch-default-branch-to-next-minor'); @@ -58,7 +58,7 @@ public function execute(InputInterface $input, OutputInterface $output): int $this->fetch->__invoke( $repositoryName->uri(), $repositoryName->uriWithTokenAuthentication($this->variables->githubToken()), - $repositoryPath + $repositoryPath, ); $mergeCandidates = $this->getMergeCandidates->__invoke($repositoryPath); @@ -77,14 +77,14 @@ public function execute(InputInterface $input, OutputInterface $output): int $this->push->__invoke( $repositoryPath, $newestBranch->name(), - $nextDefaultBranch->name() + $nextDefaultBranch->name(), ); ($this->bumpChangelogVersion)( BumpAndCommitChangelogVersion::BUMP_MINOR, $repositoryPath, $releaseVersion, $nextDefaultBranch, - $this->variables->signingSecretKey() + $this->variables->signingSecretKey(), ); } diff --git a/src/Changelog/BumpAndCommitChangelogVersion.php b/src/Changelog/BumpAndCommitChangelogVersion.php index 02e2c291..25ada334 100644 --- a/src/Changelog/BumpAndCommitChangelogVersion.php +++ b/src/Changelog/BumpAndCommitChangelogVersion.php @@ -22,6 +22,6 @@ public function __invoke( string $repositoryDirectory, SemVerVersion $version, BranchName $sourceBranch, - SecretKeyId $keyId + SecretKeyId $keyId, ): void; } diff --git a/src/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelog.php b/src/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelog.php index a18a065d..9ce6bb49 100644 --- a/src/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelog.php +++ b/src/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelog.php @@ -36,7 +36,7 @@ public function __construct( CheckoutBranch $checkoutBranch, CommitFile $commitFile, Push $push, - LoggerInterface $logger + LoggerInterface $logger, ) { $this->changelogExists = $changelogExists; $this->checkoutBranch = $checkoutBranch; @@ -50,7 +50,7 @@ public function __invoke( string $repositoryDirectory, SemVerVersion $version, BranchName $sourceBranch, - SecretKeyId $keyId + SecretKeyId $keyId, ): void { if (! ($this->changelogExists)($sourceBranch, $repositoryDirectory)) { // No changelog @@ -76,7 +76,7 @@ public function __invoke( $sourceBranch, self::CHANGELOG_FILE, $message, - $keyId + $keyId, ); ($this->push)($repositoryDirectory, $sourceBranch->name()); @@ -85,7 +85,7 @@ public function __invoke( 'BumpAndCommitChangelogVersion: bumped %s to version %s in branch %s', self::CHANGELOG_FILE, $newVersion, - $sourceBranch->name() + $sourceBranch->name(), )); } } diff --git a/src/Changelog/ChangelogExists.php b/src/Changelog/ChangelogExists.php index b511675b..86c95e57 100644 --- a/src/Changelog/ChangelogExists.php +++ b/src/Changelog/ChangelogExists.php @@ -13,6 +13,6 @@ interface ChangelogExists */ public function __invoke( BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): bool; } diff --git a/src/Changelog/ChangelogExistsViaConsole.php b/src/Changelog/ChangelogExistsViaConsole.php index d3946bfe..ecdd1e4b 100644 --- a/src/Changelog/ChangelogExistsViaConsole.php +++ b/src/Changelog/ChangelogExistsViaConsole.php @@ -14,7 +14,7 @@ class ChangelogExistsViaConsole implements ChangelogExists */ public function __invoke( BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): bool { try { Shell\execute('git', ['show', 'origin/' . $sourceBranch->name() . ':CHANGELOG.md'], $repositoryDirectory); diff --git a/src/Changelog/ChangelogReleaseNotes.php b/src/Changelog/ChangelogReleaseNotes.php index a216cd9d..4cf791f3 100644 --- a/src/Changelog/ChangelogReleaseNotes.php +++ b/src/Changelog/ChangelogReleaseNotes.php @@ -40,7 +40,7 @@ public static function writeChangelogFile(string $changelogFile, self $releaseNo $editor->update( $changelogFile, $changelogEntry, - $releaseNotes->changelogEntry + $releaseNotes->changelogEntry, ); } @@ -49,7 +49,7 @@ public static function writeChangelogFile(string $changelogFile, self $releaseNo */ public function __construct( string $contents, - ?ChangelogEntry $changelogEntry = null + ?ChangelogEntry $changelogEntry = null, ) { if ($changelogEntry) { $changelogEntry = clone $changelogEntry; @@ -73,7 +73,7 @@ public function merge(self $next): self if ($this->changelogEntry && $next->changelogEntry) { throw new RuntimeException( 'Aborting: Both current release notes and next contain a ChangelogEntry;' - . ' only one CreateReleaseText implementation should resolve one.' + . ' only one CreateReleaseText implementation should resolve one.', ); } diff --git a/src/Changelog/CommitReleaseChangelog.php b/src/Changelog/CommitReleaseChangelog.php index 5ad8c14b..d08f99db 100644 --- a/src/Changelog/CommitReleaseChangelog.php +++ b/src/Changelog/CommitReleaseChangelog.php @@ -18,6 +18,6 @@ public function __invoke( string $repositoryDirectory, SemVerVersion $version, BranchName $sourceBranch, - SecretKeyId $keyId + SecretKeyId $keyId, ): void; } diff --git a/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php b/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php index 88c0c6ae..8993344b 100644 --- a/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php +++ b/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php @@ -35,7 +35,7 @@ public function __construct( CheckoutBranch $checkoutBranch, CommitFile $commitFile, Push $push, - LoggerInterface $logger + LoggerInterface $logger, ) { $this->changelogExists = $changelogExists; $this->checkoutBranch = $checkoutBranch; @@ -52,7 +52,7 @@ public function __invoke( string $repositoryDirectory, SemVerVersion $version, BranchName $sourceBranch, - SecretKeyId $keyId + SecretKeyId $keyId, ): void { if (! $releaseNotes->requiresUpdatingChangelogFile()) { // Nothing to commit @@ -83,7 +83,7 @@ public function __invoke( $sourceBranch, self::CHANGELOG_FILE, $message, - $keyId + $keyId, ); ($this->push)($repositoryDirectory, $sourceBranch->name()); diff --git a/src/Environment/EnvironmentVariables.php b/src/Environment/EnvironmentVariables.php index 66973280..0b09237d 100644 --- a/src/Environment/EnvironmentVariables.php +++ b/src/Environment/EnvironmentVariables.php @@ -62,7 +62,7 @@ private function __construct( string $gitAuthorEmail, string $githubEventPath, string $workspacePath, - string $logLevel + string $logLevel, ) { $this->githubToken = $githubToken; $this->signingSecretKey = $signingSecretKey; @@ -75,7 +75,7 @@ private function __construct( Psl\invariant( Iter\contains(self::LOG_LEVELS, $logLevel), 'LOG_LEVEL env MUST be a valid monolog/monolog log level constant name or value;' - . ' see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels' + . ' see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels', ); $this->logLevel = $logLevel; diff --git a/src/Git/CheckoutBranch.php b/src/Git/CheckoutBranch.php index 0aa87054..321c6c62 100644 --- a/src/Git/CheckoutBranch.php +++ b/src/Git/CheckoutBranch.php @@ -13,6 +13,6 @@ interface CheckoutBranch */ public function __invoke( string $repositoryDirectory, - BranchName $branchName + BranchName $branchName, ): void; } diff --git a/src/Git/CheckoutBranchViaConsole.php b/src/Git/CheckoutBranchViaConsole.php index 178bad16..39e7a8c4 100644 --- a/src/Git/CheckoutBranchViaConsole.php +++ b/src/Git/CheckoutBranchViaConsole.php @@ -11,7 +11,7 @@ class CheckoutBranchViaConsole implements CheckoutBranch { public function __invoke( string $repositoryDirectory, - BranchName $branchName + BranchName $branchName, ): void { Shell\execute('git', ['switch', $branchName->name()], $repositoryDirectory); } diff --git a/src/Git/CommitFile.php b/src/Git/CommitFile.php index efd7232c..a9cfcb7e 100644 --- a/src/Git/CommitFile.php +++ b/src/Git/CommitFile.php @@ -19,6 +19,6 @@ public function __invoke( BranchName $sourceBranch, string $filename, string $commitMessage, - SecretKeyId $keyId + SecretKeyId $keyId, ): void; } diff --git a/src/Git/CommitFileViaConsole.php b/src/Git/CommitFileViaConsole.php index a78c1a82..708ee381 100644 --- a/src/Git/CommitFileViaConsole.php +++ b/src/Git/CommitFileViaConsole.php @@ -17,7 +17,7 @@ public function __invoke( BranchName $sourceBranch, string $filename, string $commitMessage, - SecretKeyId $keyId + SecretKeyId $keyId, ): void { $this->assertWeAreOnBranch($sourceBranch, $repositoryDirectory, $filename); @@ -32,7 +32,7 @@ public function __invoke( private function assertWeAreOnBranch( BranchName $expectedBranch, string $repositoryDirectory, - string $filename + string $filename, ): void { $output = Str\trim(Shell\execute('git', ['branch', '--show-current'], $repositoryDirectory)); @@ -40,7 +40,7 @@ private function assertWeAreOnBranch( 'CommitFile: Cannot commit file %s to branch %s, as a different branch is currently checked out (%s).', $filename, $expectedBranch->name(), - $output + $output, )); } } diff --git a/src/Git/CreateTag.php b/src/Git/CreateTag.php index 95d88453..fb6b3cc3 100644 --- a/src/Git/CreateTag.php +++ b/src/Git/CreateTag.php @@ -15,6 +15,6 @@ public function __invoke( BranchName $sourceBranch, string $tagName, string $changelog, - SecretKeyId $keyId + SecretKeyId $keyId, ): void; } diff --git a/src/Git/CreateTagViaConsole.php b/src/Git/CreateTagViaConsole.php index 73d0cf1b..33a71f1d 100644 --- a/src/Git/CreateTagViaConsole.php +++ b/src/Git/CreateTagViaConsole.php @@ -18,7 +18,7 @@ public function __invoke( BranchName $sourceBranch, string $tagName, string $changelog, - SecretKeyId $keyId + SecretKeyId $keyId, ): void { $tagFileName = Filesystem\create_temporary_file(Env\temp_dir(), 'created_tag'); diff --git a/src/Git/Fetch.php b/src/Git/Fetch.php index 404b2ffb..bfdd0467 100644 --- a/src/Git/Fetch.php +++ b/src/Git/Fetch.php @@ -12,6 +12,6 @@ interface Fetch public function __invoke( UriInterface $repositoryUri, UriInterface $uriWithCredentials, - string $repositoryRootDirectory + string $repositoryRootDirectory, ): void; } diff --git a/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php b/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php index 4d71cbf0..f34c97ec 100644 --- a/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php +++ b/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php @@ -22,7 +22,7 @@ public function __construct(EnvironmentVariables $variables) public function __invoke( UriInterface $repositoryUri, UriInterface $uriWithCredentials, - string $repositoryRootDirectory + string $repositoryRootDirectory, ): void { Shell\execute('git', ['config', '--global', '--add', 'safe.directory', '*'], $repositoryRootDirectory); diff --git a/src/Git/GetMergeTargetCandidateBranchesFromRemoteBranches.php b/src/Git/GetMergeTargetCandidateBranchesFromRemoteBranches.php index c17e78b5..c4c10198 100644 --- a/src/Git/GetMergeTargetCandidateBranchesFromRemoteBranches.php +++ b/src/Git/GetMergeTargetCandidateBranchesFromRemoteBranches.php @@ -24,7 +24,7 @@ public function __invoke(string $repositoryRootDirectory): MergeTargetCandidateB $sanitizedBranch = Regex\replace( Str\trim($branch, "* \t\n\r\0\x0B"), '~^(?:remotes/)?origin/~', - '' + '', ); return BranchName::fromName($sanitizedBranch); diff --git a/src/Git/Push.php b/src/Git/Push.php index 569258a9..1d50a0dd 100644 --- a/src/Git/Push.php +++ b/src/Git/Push.php @@ -14,6 +14,6 @@ interface Push public function __invoke( string $repositoryDirectory, string $symbol, - ?string $alias = null + ?string $alias = null, ): void; } diff --git a/src/Git/PushViaConsole.php b/src/Git/PushViaConsole.php index f25bdad7..98f2c54a 100644 --- a/src/Git/PushViaConsole.php +++ b/src/Git/PushViaConsole.php @@ -12,7 +12,7 @@ final class PushViaConsole implements Push public function __invoke( string $repositoryDirectory, string $symbol, - ?string $alias = null + ?string $alias = null, ): void { if ($alias === null) { Shell\execute('git', ['push', 'origin', $symbol], $repositoryDirectory); diff --git a/src/Git/Value/MergeTargetCandidateBranches.php b/src/Git/Value/MergeTargetCandidateBranches.php index 1239abdb..d731d53f 100644 --- a/src/Git/Value/MergeTargetCandidateBranches.php +++ b/src/Git/Value/MergeTargetCandidateBranches.php @@ -90,7 +90,7 @@ public function newestFutureReleaseBranchAfter(SemVerVersion $version): BranchNa Vec\reverse($this->sortedBranches), static function (BranchName $branch) use ($nextMinor): bool { return $nextMinor->lessThanEqual($branch->targetMinorReleaseVersion()); - } + }, ); return Iter\first($futureReleaseBranch) ?? $nextMinor->targetReleaseBranchName(); diff --git a/src/Github/Api/GraphQL/Query/GetGithubMilestone.php b/src/Github/Api/GraphQL/Query/GetGithubMilestone.php index 2f78fb59..a61ce7d7 100644 --- a/src/Github/Api/GraphQL/Query/GetGithubMilestone.php +++ b/src/Github/Api/GraphQL/Query/GetGithubMilestone.php @@ -11,6 +11,6 @@ interface GetGithubMilestone { public function __invoke( RepositoryName $repositoryName, - int $milestoneNumber + int $milestoneNumber, ): Milestone; } diff --git a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequest.php b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequest.php index 23810f1e..7d39371d 100644 --- a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequest.php +++ b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequest.php @@ -34,7 +34,7 @@ private function __construct( Author $author, array $labels, bool $closed, - UriInterface $url + UriInterface $url, ) { $this->number = $number; $this->title = $title; @@ -72,7 +72,7 @@ public static function fromPayload(array $payload): self Author::fromPayload($payload['author']), Vec\map($payload['labels']['nodes'], Label::fromPayload(...)), isset($payload['merged']) ? $payload['merged'] || $payload['closed'] : $payload['closed'], - new Uri($payload['url']) + new Uri($payload['url']), ); } diff --git a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Label.php b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Label.php index 9b2d3c1e..927d2e3e 100644 --- a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Label.php +++ b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Label.php @@ -26,7 +26,7 @@ final class Label private function __construct( string $colour, string $name, - UriInterface $url + UriInterface $url, ) { $this->colour = $colour; $this->name = $name; @@ -54,7 +54,7 @@ public static function fromPayload(array $payload): self return new self( $payload['color'], $payload['name'], - new Uri($payload['url']) + new Uri($payload['url']), ); } diff --git a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Milestone.php b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Milestone.php index 4500dbd3..366689ce 100644 --- a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Milestone.php +++ b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Milestone.php @@ -37,7 +37,7 @@ private function __construct( string $title, ?string $description, array $entries, - UriInterface $url + UriInterface $url, ) { $this->number = $number; $this->closed = $closed; @@ -78,9 +78,9 @@ public static function fromPayload(array $payload): self $payload['description'], Vec\concat( Vec\map($payload['issues']['nodes'], IssueOrPullRequest::fromPayload(...)), - Vec\map($payload['pullRequests']['nodes'], IssueOrPullRequest::fromPayload(...)) + Vec\map($payload['pullRequests']['nodes'], IssueOrPullRequest::fromPayload(...)), ), - new Uri($payload['url']) + new Uri($payload['url']), ); } diff --git a/src/Github/Api/GraphQL/Query/GetMilestoneFirst100IssuesAndPullRequests.php b/src/Github/Api/GraphQL/Query/GetMilestoneFirst100IssuesAndPullRequests.php index 3611c045..911a2750 100644 --- a/src/Github/Api/GraphQL/Query/GetMilestoneFirst100IssuesAndPullRequests.php +++ b/src/Github/Api/GraphQL/Query/GetMilestoneFirst100IssuesAndPullRequests.php @@ -75,7 +75,7 @@ public function __construct(RunQuery $runQuery) public function __invoke( RepositoryName $repositoryName, - int $milestoneNumber + int $milestoneNumber, ): Milestone { $queryResult = $this->runQuery->__invoke( self::QUERY, @@ -83,7 +83,7 @@ public function __invoke( 'repositoryName' => $repositoryName->name(), 'owner' => $repositoryName->owner(), 'milestoneNumber' => $milestoneNumber, - ] + ], ); $queryResult = Type\shape([ diff --git a/src/Github/Api/GraphQL/RunGraphQLQuery.php b/src/Github/Api/GraphQL/RunGraphQLQuery.php index 0d73f34f..b308d1ae 100644 --- a/src/Github/Api/GraphQL/RunGraphQLQuery.php +++ b/src/Github/Api/GraphQL/RunGraphQLQuery.php @@ -26,7 +26,7 @@ final class RunGraphQLQuery implements RunQuery public function __construct( RequestFactoryInterface $messageFactory, ClientInterface $client, - string $apiToken + string $apiToken, ) { $this->messageFactory = $messageFactory; $this->client = $client; @@ -36,7 +36,7 @@ public function __construct( /** {@inheritDoc} */ public function __invoke( string $query, - array $variables = [] + array $variables = [], ): array { $request = $this->messageFactory ->createRequest('POST', self::ENDPOINT) diff --git a/src/Github/Api/GraphQL/RunQuery.php b/src/Github/Api/GraphQL/RunQuery.php index 69607400..bfed9c1f 100644 --- a/src/Github/Api/GraphQL/RunQuery.php +++ b/src/Github/Api/GraphQL/RunQuery.php @@ -14,6 +14,6 @@ interface RunQuery */ public function __invoke( string $query, - array $variables = [] + array $variables = [], ): array; } diff --git a/src/Github/Api/V3/CreateMilestone.php b/src/Github/Api/V3/CreateMilestone.php index da8687eb..39b4c112 100644 --- a/src/Github/Api/V3/CreateMilestone.php +++ b/src/Github/Api/V3/CreateMilestone.php @@ -11,6 +11,6 @@ interface CreateMilestone { public function __invoke( RepositoryName $repository, - SemVerVersion $version + SemVerVersion $version, ): void; } diff --git a/src/Github/Api/V3/CreateMilestoneThroughApiCall.php b/src/Github/Api/V3/CreateMilestoneThroughApiCall.php index 46cac5df..b8949c0b 100644 --- a/src/Github/Api/V3/CreateMilestoneThroughApiCall.php +++ b/src/Github/Api/V3/CreateMilestoneThroughApiCall.php @@ -31,7 +31,7 @@ public function __construct( RequestFactoryInterface $messageFactory, ClientInterface $client, string $apiToken, - LoggerInterface $logger + LoggerInterface $logger, ) { $this->messageFactory = $messageFactory; $this->client = $client; @@ -45,13 +45,13 @@ public function __invoke(RepositoryName $repository, SemVerVersion $version): vo '[CreateMilestoneThroughApiCall] Creating milestone "%s" for "%s/%s"', $version->fullReleaseName(), $repository->owner(), - $repository->name() + $repository->name(), )); $request = $this->messageFactory ->createRequest( 'POST', - self::API_ROOT . 'repos/' . $repository->owner() . '/' . $repository->name() . '/milestones' + self::API_ROOT . 'repos/' . $repository->owner() . '/' . $repository->name() . '/milestones', ) ->withAddedHeader('Content-Type', 'application/json') ->withAddedHeader('User-Agent', 'Ocramius\'s minimal API V3 client') @@ -76,9 +76,9 @@ public function __invoke(RepositoryName $repository, SemVerVersion $version): vo $this->logger->error( Str\format( '[CreateMilestoneThroughApiCall] Failed to create milestone "%s"', - $version->fullReleaseName() + $version->fullReleaseName(), ), - ['exception' => $responseData] + ['exception' => $responseData], ); throw CreateMilestoneFailed::forVersion($version->fullReleaseName()); @@ -88,7 +88,7 @@ public function __invoke(RepositoryName $repository, SemVerVersion $version): vo $this->logger->info(Str\format( '[CreateMilestoneThroughApiCall] Milestone "%s" created', - $version->fullReleaseName() + $version->fullReleaseName(), )); } diff --git a/src/Github/Api/V3/CreatePullRequest.php b/src/Github/Api/V3/CreatePullRequest.php index 65e234e1..844726c0 100644 --- a/src/Github/Api/V3/CreatePullRequest.php +++ b/src/Github/Api/V3/CreatePullRequest.php @@ -15,6 +15,6 @@ public function __invoke( BranchName $head, BranchName $target, string $title, - string $body + string $body, ): void; } diff --git a/src/Github/Api/V3/CreatePullRequestThroughApiCall.php b/src/Github/Api/V3/CreatePullRequestThroughApiCall.php index 3d557732..7ad53a4b 100644 --- a/src/Github/Api/V3/CreatePullRequestThroughApiCall.php +++ b/src/Github/Api/V3/CreatePullRequestThroughApiCall.php @@ -26,7 +26,7 @@ final class CreatePullRequestThroughApiCall implements CreatePullRequest public function __construct( RequestFactoryInterface $messageFactory, ClientInterface $client, - string $apiToken + string $apiToken, ) { $this->messageFactory = $messageFactory; $this->client = $client; @@ -38,12 +38,12 @@ public function __invoke( BranchName $head, BranchName $target, string $title, - string $body + string $body, ): void { $request = $this->messageFactory ->createRequest( 'POST', - self::API_ROOT . 'repos/' . $repository->owner() . '/' . $repository->name() . '/pulls' + self::API_ROOT . 'repos/' . $repository->owner() . '/' . $repository->name() . '/pulls', ) ->withAddedHeader('Content-Type', 'application/json') ->withAddedHeader('User-Agent', 'Ocramius\'s minimal API V3 client') diff --git a/src/Github/Api/V3/CreateRelease.php b/src/Github/Api/V3/CreateRelease.php index 8d64965a..d897a945 100644 --- a/src/Github/Api/V3/CreateRelease.php +++ b/src/Github/Api/V3/CreateRelease.php @@ -14,6 +14,6 @@ interface CreateRelease public function __invoke( RepositoryName $repository, SemVerVersion $version, - string $releaseNotes + string $releaseNotes, ): UriInterface; } diff --git a/src/Github/Api/V3/CreateReleaseThroughApiCall.php b/src/Github/Api/V3/CreateReleaseThroughApiCall.php index 183f35f1..13f2c99d 100644 --- a/src/Github/Api/V3/CreateReleaseThroughApiCall.php +++ b/src/Github/Api/V3/CreateReleaseThroughApiCall.php @@ -29,7 +29,7 @@ final class CreateReleaseThroughApiCall implements CreateRelease public function __construct( RequestFactoryInterface $messageFactory, ClientInterface $client, - string $apiToken + string $apiToken, ) { $this->messageFactory = $messageFactory; $this->client = $client; @@ -39,12 +39,12 @@ public function __construct( public function __invoke( RepositoryName $repository, SemVerVersion $version, - string $releaseNotes + string $releaseNotes, ): UriInterface { $request = $this->messageFactory ->createRequest( 'POST', - self::API_ROOT . 'repos/' . $repository->owner() . '/' . $repository->name() . '/releases' + self::API_ROOT . 'repos/' . $repository->owner() . '/' . $repository->name() . '/releases', ) ->withAddedHeader('Content-Type', 'application/json') ->withAddedHeader('User-Agent', 'Ocramius\'s minimal API V3 client') diff --git a/src/Github/Api/V3/SetDefaultBranch.php b/src/Github/Api/V3/SetDefaultBranch.php index eaf0674c..55927ecf 100644 --- a/src/Github/Api/V3/SetDefaultBranch.php +++ b/src/Github/Api/V3/SetDefaultBranch.php @@ -12,6 +12,6 @@ interface SetDefaultBranch /** @psalm-param non-empty-string $title */ public function __invoke( RepositoryName $repository, - BranchName $defaultBranch + BranchName $defaultBranch, ): void; } diff --git a/src/Github/Api/V3/SetDefaultBranchThroughApiCall.php b/src/Github/Api/V3/SetDefaultBranchThroughApiCall.php index bfaa0eca..a9f72ff5 100644 --- a/src/Github/Api/V3/SetDefaultBranchThroughApiCall.php +++ b/src/Github/Api/V3/SetDefaultBranchThroughApiCall.php @@ -26,7 +26,7 @@ final class SetDefaultBranchThroughApiCall implements SetDefaultBranch public function __construct( RequestFactoryInterface $messageFactory, ClientInterface $client, - string $apiToken + string $apiToken, ) { $this->messageFactory = $messageFactory; $this->client = $client; @@ -35,12 +35,12 @@ public function __construct( public function __invoke( RepositoryName $repository, - BranchName $defaultBranch + BranchName $defaultBranch, ): void { $request = $this->messageFactory ->createRequest( 'PATCH', - self::API_ROOT . 'repos/' . $repository->owner() . '/' . $repository->name() + self::API_ROOT . 'repos/' . $repository->owner() . '/' . $repository->name(), ) ->withAddedHeader('Content-Type', 'application/json') ->withAddedHeader('User-Agent', 'Ocramius\'s minimal API V3 client') diff --git a/src/Github/CreateReleaseText.php b/src/Github/CreateReleaseText.php index 0b0cc370..b3da2f22 100644 --- a/src/Github/CreateReleaseText.php +++ b/src/Github/CreateReleaseText.php @@ -20,7 +20,7 @@ public function __invoke( RepositoryName $repositoryName, SemVerVersion $semVerVersion, BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): ChangelogReleaseNotes; /** @psalm-param non-empty-string $repositoryDirectory */ @@ -29,6 +29,6 @@ public function canCreateReleaseText( RepositoryName $repositoryName, SemVerVersion $semVerVersion, BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): bool; } diff --git a/src/Github/CreateReleaseTextThroughChangelog.php b/src/Github/CreateReleaseTextThroughChangelog.php index bbeb1d89..5a2adc64 100644 --- a/src/Github/CreateReleaseTextThroughChangelog.php +++ b/src/Github/CreateReleaseTextThroughChangelog.php @@ -40,7 +40,7 @@ public function __invoke( RepositoryName $repositoryName, SemVerVersion $semVerVersion, BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): ChangelogReleaseNotes { $text = Str\replace_every(self::TEMPLATE, [ '%release%' => $this->markdownLink($milestone->title(), $milestone->url()), @@ -48,9 +48,9 @@ public function __invoke( '%changelogText%' => $this->normalizeChangelog( $this->generateChangelog->__invoke( $repositoryName, - $semVerVersion + $semVerVersion, ), - $semVerVersion->fullReleaseName() + $semVerVersion->fullReleaseName(), ), ]); @@ -64,7 +64,7 @@ public function canCreateReleaseText( RepositoryName $repositoryName, SemVerVersion $semVerVersion, BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): bool { return true; } diff --git a/src/Github/CreateReleaseTextViaKeepAChangelog.php b/src/Github/CreateReleaseTextViaKeepAChangelog.php index 49b04d74..6c253217 100644 --- a/src/Github/CreateReleaseTextViaKeepAChangelog.php +++ b/src/Github/CreateReleaseTextViaKeepAChangelog.php @@ -48,11 +48,11 @@ public function __invoke( RepositoryName $repositoryName, SemVerVersion $semVerVersion, BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): ChangelogReleaseNotes { $changelogEntry = $this->fetchChangelogEntry( $this->fetchChangelogContentsFromBranch($sourceBranch, $repositoryDirectory), - $semVerVersion->fullReleaseName() + $semVerVersion->fullReleaseName(), ); $contents = $changelogEntry->contents(); @@ -62,9 +62,9 @@ public function __invoke( return new ChangelogReleaseNotes( $this->updateReleaseDate( $this->removeDefaultContents($contents), - $semVerVersion->fullReleaseName() + $semVerVersion->fullReleaseName(), ), - $changelogEntry + $changelogEntry, ); } @@ -73,7 +73,7 @@ public function canCreateReleaseText( RepositoryName $repositoryName, SemVerVersion $semVerVersion, BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): bool { if (! ($this->changelogExists)($sourceBranch, $repositoryDirectory)) { return false; @@ -83,7 +83,7 @@ public function canCreateReleaseText( $changelog = (new ChangelogParser()) ->findChangelogForVersion( $this->fetchChangelogContentsFromBranch($sourceBranch, $repositoryDirectory), - $semVerVersion->fullReleaseName() + $semVerVersion->fullReleaseName(), ); return ! Str\is_empty($changelog); @@ -99,7 +99,7 @@ public function canCreateReleaseText( */ private function fetchChangelogContentsFromBranch( BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): string { $contents = Shell\execute('git', ['show', 'origin/' . $sourceBranch->name() . ':CHANGELOG.md'], $repositoryDirectory); @@ -140,7 +140,7 @@ private function removeDefaultContents(string $changelog): string "/\n\#{3} " . $section . "\n\n- Nothing.\n/s", '', ), - $changelog + $changelog, ); return Type\non_empty_string()->assert($contents); diff --git a/src/Github/Event/MilestoneClosedEvent.php b/src/Github/Event/MilestoneClosedEvent.php index 49739ba7..1e1536f9 100644 --- a/src/Github/Event/MilestoneClosedEvent.php +++ b/src/Github/Event/MilestoneClosedEvent.php @@ -19,7 +19,7 @@ final class MilestoneClosedEvent private function __construct( SemVerVersion $version, RepositoryName $repository, - int $milestoneNumber + int $milestoneNumber, ) { $this->version = $version; $this->repository = $repository; @@ -42,7 +42,7 @@ public static function fromEventJson(string $json): self return new self( SemVerVersion::fromMilestoneName($event['milestone']['title']), RepositoryName::fromFullName($event['repository']['full_name']), - $event['milestone']['number'] + $event['milestone']['number'], ); } diff --git a/src/Github/GenerateChangelog.php b/src/Github/GenerateChangelog.php index aae80d6c..dd4a0c17 100644 --- a/src/Github/GenerateChangelog.php +++ b/src/Github/GenerateChangelog.php @@ -11,6 +11,6 @@ interface GenerateChangelog { public function __invoke( RepositoryName $repositoryName, - SemVerVersion $semVerVersion + SemVerVersion $semVerVersion, ): string; } diff --git a/src/Github/JwageGenerateChangelog.php b/src/Github/JwageGenerateChangelog.php index 52138bb9..e49dee6f 100644 --- a/src/Github/JwageGenerateChangelog.php +++ b/src/Github/JwageGenerateChangelog.php @@ -32,7 +32,7 @@ public function __construct(ChangelogGenerator $changelogGenerator, GitHubCreden public static function create( RequestFactoryInterface $messageFactory, ClientInterface $client, - GitHubCredentials $gitHubCredentials + GitHubCredentials $gitHubCredentials, ): self { $issueClient = new IssueClient($messageFactory, $client); $issueFactory = new IssueFactory(); @@ -45,7 +45,7 @@ public static function create( public function __invoke( RepositoryName $repositoryName, - SemVerVersion $semVerVersion + SemVerVersion $semVerVersion, ): string { $config = (new ChangelogConfig()) ->setUser($repositoryName->owner()) @@ -57,7 +57,7 @@ public function __invoke( $this->changelogGenerator->generate( $config, - $output + $output, ); return $output->fetch(); diff --git a/src/Github/MergeMultipleReleaseNotes.php b/src/Github/MergeMultipleReleaseNotes.php index abf7b313..bb55901c 100644 --- a/src/Github/MergeMultipleReleaseNotes.php +++ b/src/Github/MergeMultipleReleaseNotes.php @@ -29,7 +29,7 @@ public function __invoke( RepositoryName $repositoryName, SemVerVersion $semVerVersion, BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): ChangelogReleaseNotes { $items = Vec\map( Vec\filter( @@ -42,7 +42,7 @@ public function __invoke( $releaseNotes = Iter\reduce( $items, static fn (?ChangelogReleaseNotes $releaseNotes, ChangelogReleaseNotes $item): ChangelogReleaseNotes => $releaseNotes ? $releaseNotes->merge($item) : $item, - null + null, ); return Type\instance_of(ChangelogReleaseNotes::class)->assert($releaseNotes); @@ -53,7 +53,7 @@ public function canCreateReleaseText( RepositoryName $repositoryName, SemVerVersion $semVerVersion, BranchName $sourceBranch, - string $repositoryDirectory + string $repositoryDirectory, ): bool { foreach ($this->releaseTextGenerators as $generator) { if ( @@ -62,7 +62,7 @@ public function canCreateReleaseText( $repositoryName, $semVerVersion, $sourceBranch, - $repositoryDirectory + $repositoryDirectory, ) ) { return true; diff --git a/test/unit/Application/BumpChangelogForReleaseBranchTest.php b/test/unit/Application/BumpChangelogForReleaseBranchTest.php index 8c9d6531..3c863abf 100644 --- a/test/unit/Application/BumpChangelogForReleaseBranchTest.php +++ b/test/unit/Application/BumpChangelogForReleaseBranchTest.php @@ -52,7 +52,7 @@ protected function setUp(): void $this->loadEvent, $this->fetch, $this->getMergeTargets, - $this->bumpChangelogVersion + $this->bumpChangelogVersion, ); $this->event = MilestoneClosedEvent::fromEventJson(<<< 'JSON' @@ -85,7 +85,7 @@ public function testWillBumpChangelogVersion(): void $branches = MergeTargetCandidateBranches::fromAllBranches( BranchName::fromName('1.1.x'), BranchName::fromName('1.2.x'), - BranchName::fromName('1.3.x') + BranchName::fromName('1.3.x'), ); $this->loadEvent->method('__invoke')->willReturn($this->event); @@ -96,7 +96,7 @@ public function testWillBumpChangelogVersion(): void ->with( 'https://github.com/foo/bar.git', 'https://github-auth-token:x-oauth-basic@github.com/foo/bar.git', - $workspace + $workspace, ); $this->getMergeTargets->expects(self::once()) ->method('__invoke') @@ -109,7 +109,7 @@ public function testWillBumpChangelogVersion(): void BumpAndCommitChangelogVersion::BUMP_PATCH, $workspace, self::equalTo(SemVerVersion::fromMilestoneName('1.2.3')), - self::equalTo(BranchName::fromName('1.2.x')) + self::equalTo(BranchName::fromName('1.2.x')), ); self::assertSame(0, $this->command->run(new ArrayInput([]), new NullOutput())); diff --git a/test/unit/Application/CreateMergeUpPullRequestTest.php b/test/unit/Application/CreateMergeUpPullRequestTest.php index 194f64c8..f7f8cc62 100644 --- a/test/unit/Application/CreateMergeUpPullRequestTest.php +++ b/test/unit/Application/CreateMergeUpPullRequestTest.php @@ -74,7 +74,7 @@ protected function setUp(): void $this->getMilestone, $this->createReleaseText, $this->push, - $this->createPullRequest + $this->createPullRequest, ); $this->event = MilestoneClosedEvent::fromEventJson(<<<'JSON' @@ -88,7 +88,7 @@ protected function setUp(): void }, "action": "closed" } -JSON +JSON, ); $this->branches = MergeTargetCandidateBranches::fromAllBranches( @@ -145,7 +145,7 @@ public function testWillCreateMergeUpPullRequest(): void ->with( 'https://github.com/foo/bar.git', 'https://github-auth-token:x-oauth-basic@github.com/foo/bar.git', - $workspace + $workspace, ); $this->getMergeTargets->method('__invoke') @@ -167,7 +167,7 @@ public function testWillCreateMergeUpPullRequest(): void ->with( self::equalTo($this->milestone), self::equalTo(RepositoryName::fromFullName('foo/bar')), - self::equalTo($this->releaseVersion) + self::equalTo($this->releaseVersion), ) ->willReturn($releaseNotes); @@ -176,7 +176,7 @@ public function testWillCreateMergeUpPullRequest(): void ->with( $workspace, '1.2.x', - self::stringStartsWith('1.2.x-merge-up-into-1.3.x_') + self::stringStartsWith('1.2.x-merge-up-into-1.3.x_'), ); $this->createPullRequest->expects(self::once()) @@ -190,7 +190,7 @@ public function testWillCreateMergeUpPullRequest(): void }), self::equalTo(BranchName::fromName('1.3.x')), 'Merge release 1.2.3 into 1.3.x', - 'text of the changelog' + 'text of the changelog', ); self::assertSame(0, $this->command->run(new ArrayInput([]), new NullOutput())); @@ -215,7 +215,7 @@ public function testWillSkipMergeUpPullRequestOnNoMergeUpCandidate(): void ->with( 'https://github.com/foo/bar.git', 'https://github-auth-token:x-oauth-basic@github.com/foo/bar.git', - $workspace + $workspace, ); $this->getMergeTargets->method('__invoke') @@ -250,7 +250,7 @@ public function testWillSkipMergeUpPullRequestOnNoMergeUpCandidate(): void OUTPUT , - $output->fetch() + $output->fetch(), ); } } diff --git a/test/unit/Application/CreateMilestonesTest.php b/test/unit/Application/CreateMilestonesTest.php index 3aedb865..01ca68e8 100644 --- a/test/unit/Application/CreateMilestonesTest.php +++ b/test/unit/Application/CreateMilestonesTest.php @@ -42,7 +42,7 @@ protected function setUp(): void $this->command = new CreateMilestones( $this->loadEvent, - $this->createMilestone + $this->createMilestone, ); $this->event = MilestoneClosedEvent::fromEventJson(<<<'JSON' @@ -56,7 +56,7 @@ protected function setUp(): void }, "action": "closed" } - JSON + JSON, ); $this->releaseVersion = SemVerVersion::fromMilestoneName('1.2.3'); diff --git a/test/unit/Application/ReleaseCommandTest.php b/test/unit/Application/ReleaseCommandTest.php index b6e5b995..d8ed9a01 100644 --- a/test/unit/Application/ReleaseCommandTest.php +++ b/test/unit/Application/ReleaseCommandTest.php @@ -98,7 +98,7 @@ protected function setUp(): void }, "action": "closed" } -JSON +JSON, ); $this->branches = MergeTargetCandidateBranches::fromAllBranches( @@ -155,7 +155,7 @@ public function testWillRelease(): void ->with( 'https://github.com/foo/bar.git', 'https://github-auth-token:x-oauth-basic@github.com/foo/bar.git', - $workspace + $workspace, ); $this->getMergeTargets->method('__invoke') @@ -192,7 +192,7 @@ public function testWillRelease(): void $releaseNotes, self::equalTo($workspace), self::equalTo($this->releaseVersion), - self::equalTo(BranchName::fromName('1.2.x')) + self::equalTo(BranchName::fromName('1.2.x')), ); $this->createTag->expects(self::once()) @@ -202,7 +202,7 @@ public function testWillRelease(): void self::equalTo(BranchName::fromName('1.2.x')), '1.2.3', 'text of the changelog', - self::equalTo($this->signingKey) + self::equalTo($this->signingKey), ); $this->push->expects(self::exactly(2)) @@ -214,7 +214,7 @@ public function testWillRelease(): void ->with( self::equalTo(RepositoryName::fromFullName('foo/bar')), self::equalTo($this->releaseVersion), - 'text of the changelog' + 'text of the changelog', ); self::assertSame(0, $this->command->run(new ArrayInput([]), new NullOutput())); diff --git a/test/unit/Application/SwitchDefaultBranchToNextMinorTest.php b/test/unit/Application/SwitchDefaultBranchToNextMinorTest.php index f9ecc534..a63a576d 100644 --- a/test/unit/Application/SwitchDefaultBranchToNextMinorTest.php +++ b/test/unit/Application/SwitchDefaultBranchToNextMinorTest.php @@ -66,7 +66,7 @@ protected function setUp(): void $this->getMergeTargets, $this->push, $this->setDefaultBranch, - $this->bumpChangelogVersion + $this->bumpChangelogVersion, ); $this->event = MilestoneClosedEvent::fromEventJson(<<<'JSON' @@ -80,7 +80,7 @@ protected function setUp(): void }, "action": "closed" } -JSON +JSON, ); $key = (new ImportGpgKeyFromStringViaTemporaryFile()) @@ -116,7 +116,7 @@ public function testWillSwitchToExistingNewestDefaultBranch(): void ->with( 'https://github.com/foo/bar.git', 'https://github-auth-token:x-oauth-basic@github.com/foo/bar.git', - $workspace + $workspace, ); $this->getMergeTargets->method('__invoke') @@ -138,7 +138,7 @@ public function testWillSwitchToExistingNewestDefaultBranch(): void ->method('__invoke') ->with( self::equalTo(RepositoryName::fromFullName('foo/bar')), - self::equalTo(BranchName::fromName('1.3.x')) + self::equalTo(BranchName::fromName('1.3.x')), ); self::assertSame(0, $this->command->run(new ArrayInput([]), new NullOutput())); @@ -163,7 +163,7 @@ public function testWillSwitchToNewlyCreatedDefaultBranchWhenNoNewerReleaseBranc ->with( 'https://github.com/foo/bar.git', 'https://github-auth-token:x-oauth-basic@github.com/foo/bar.git', - $workspace + $workspace, ); $this->getMergeTargets->method('__invoke') @@ -184,14 +184,14 @@ public function testWillSwitchToNewlyCreatedDefaultBranchWhenNoNewerReleaseBranc BumpAndCommitChangelogVersion::BUMP_MINOR, $workspace, SemVerVersion::fromMilestoneName('1.2.3'), - BranchName::fromName('1.3.x') + BranchName::fromName('1.3.x'), ); $this->setDefaultBranch->expects(self::once()) ->method('__invoke') ->with( self::equalTo(RepositoryName::fromFullName('foo/bar')), - self::equalTo(BranchName::fromName('1.3.x')) + self::equalTo(BranchName::fromName('1.3.x')), ); self::assertSame(0, $this->command->run(new ArrayInput([]), new NullOutput())); @@ -216,7 +216,7 @@ public function testWillNotSwitchDefaultBranchIfNoBranchesExist(): void ->with( 'https://github.com/foo/bar.git', 'https://github-auth-token:x-oauth-basic@github.com/foo/bar.git', - $workspace + $workspace, ); $this->getMergeTargets->method('__invoke') @@ -244,7 +244,7 @@ public function testWillNotSwitchDefaultBranchIfNoBranchesExist(): void OUTPUT , - $output->fetch() + $output->fetch(), ); } diff --git a/test/unit/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelogTest.php b/test/unit/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelogTest.php index ac1230ee..2ee48008 100644 --- a/test/unit/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelogTest.php +++ b/test/unit/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelogTest.php @@ -50,7 +50,7 @@ protected function setUp(): void $this->checkoutBranch, $this->commitFile, $this->push, - $this->logger + $this->logger, ); $this->key = (new ImportGpgKeyFromStringViaTemporaryFile()) @@ -77,7 +77,7 @@ public function testReturnsEarlyWhenNoChangelogFilePresent(): void $repoDir, $version, $sourceBranch, - $this->key + $this->key, ); } @@ -110,7 +110,7 @@ public function bumpTypes(): iterable public function testAddsNewReleaseVersionUsingBumpTypeToChangelogFileAndCommitsAndPushes( string $bumpType, string $branchName, - string $expectedVersion + string $expectedVersion, ): void { $changelogFile = $this->createMockChangelog(); $repoDir = Filesystem\get_directory($changelogFile); @@ -130,7 +130,7 @@ public function testAddsNewReleaseVersionUsingBumpTypeToChangelogFileAndCommitsA ->with(self::stringContains(Str\format( 'Bumped CHANGELOG.md to version %s in branch %s', $expectedVersion, - $branchName + $branchName, ))); $this->checkoutBranch @@ -138,7 +138,7 @@ public function testAddsNewReleaseVersionUsingBumpTypeToChangelogFileAndCommitsA ->method('__invoke') ->with( self::equalTo($repoDir), - $sourceBranch + $sourceBranch, ); $this->commitFile @@ -150,8 +150,8 @@ public function testAddsNewReleaseVersionUsingBumpTypeToChangelogFileAndCommitsA 'CHANGELOG.md', self::stringContains(Str\format( 'Bumps changelog version to %s', - $expectedVersion - )) + $expectedVersion, + )), ); $this->push @@ -164,7 +164,7 @@ public function testAddsNewReleaseVersionUsingBumpTypeToChangelogFileAndCommitsA $this->checkoutBranch, $this->commitFile, $this->push, - $this->logger + $this->logger, ); $bumpAndCommitChangelog( @@ -172,7 +172,7 @@ public function testAddsNewReleaseVersionUsingBumpTypeToChangelogFileAndCommitsA $repoDir, $version, $sourceBranch, - $this->key + $this->key, ); $changelogContents = read($changelogFile); @@ -182,8 +182,8 @@ public function testAddsNewReleaseVersionUsingBumpTypeToChangelogFileAndCommitsA Str\format( 'Could not locate entry for new version %s in file %s', $expectedVersion, - $changelogFile - ) + $changelogFile, + ), ); } diff --git a/test/unit/Changelog/ChangelogExistsViaConsoleTest.php b/test/unit/Changelog/ChangelogExistsViaConsoleTest.php index 0f099317..12d2c014 100644 --- a/test/unit/Changelog/ChangelogExistsViaConsoleTest.php +++ b/test/unit/Changelog/ChangelogExistsViaConsoleTest.php @@ -22,8 +22,8 @@ public function testReturnsFalseWhenChangelogIsNotPresentInBranch(): void self::assertFalse( (new ChangelogExistsViaConsole())( BranchName::fromName('0.99.x'), - $workingDir - ) + $workingDir, + ), ); } @@ -34,8 +34,8 @@ public function testReturnsTrueWhenChangelogIsPresentInBranch(): void self::assertTrue( (new ChangelogExistsViaConsole())( BranchName::fromName('1.0.x'), - $workingDir - ) + $workingDir, + ), ); } @@ -78,7 +78,7 @@ private function createMockRepositoryWithChangelog(): string - Nothing. - CHANGELOG + CHANGELOG, ); Shell\execute('git', ['init', '.'], $repo); diff --git a/test/unit/Changelog/ChangelogReleaseNotesTest.php b/test/unit/Changelog/ChangelogReleaseNotesTest.php index 842a5161..eee6e00e 100644 --- a/test/unit/Changelog/ChangelogReleaseNotesTest.php +++ b/test/unit/Changelog/ChangelogReleaseNotesTest.php @@ -119,7 +119,7 @@ public function testMergeAppendsContentsOfNextInstanceWithCurrentAndReturnsNewIn $this->assertNotSame($second, $merged); $this->assertMatchesRegularExpression( '/' . $original->contents() . '.*' . $second->contents() . '/s', - $merged->contents() + $merged->contents(), ); } @@ -156,7 +156,7 @@ public function releaseNotesProvider(): iterable public function testMergedInstanceContainsChangelogEntryFromTheInstanceThatHadOne( ChangelogReleaseNotes $original, ChangelogReleaseNotes $secondary, - ChangelogEntry $expectedEntry + ChangelogEntry $expectedEntry, ): void { $merged = $original->merge($secondary); diff --git a/test/unit/Changelog/ReleaseChangelogViaKeepAChangelogTest.php b/test/unit/Changelog/ReleaseChangelogViaKeepAChangelogTest.php index 4bad0991..4c706c6a 100644 --- a/test/unit/Changelog/ReleaseChangelogViaKeepAChangelogTest.php +++ b/test/unit/Changelog/ReleaseChangelogViaKeepAChangelogTest.php @@ -63,7 +63,7 @@ protected function setUp(): void $this->checkoutBranch, $this->commitFile, $this->push, - $this->logger + $this->logger, ); $this->key = (new ImportGpgKeyFromStringViaTemporaryFile()) @@ -99,8 +99,8 @@ public function testNoOpWhenChangelogFileDoesNotExist(): void __DIR__, SemVerVersion::fromMilestoneName('0.99.99'), BranchName::fromName('0.99.x'), - $this->key - ) + $this->key, + ), ); } @@ -138,8 +138,8 @@ public function testNoOpWhenUnableToFindMatchingChangelogEntry(): void $checkout, SemVerVersion::fromMilestoneName('1.0.0'), $branch, - $this->key - ) + $this->key, + ), ); } @@ -171,7 +171,7 @@ public function testWritesCommitsAndPushesChangelogWhenFoundAndReadyToRelease(): - Nothing. CHANGELOG, - $this->frozenClock->now()->format('Y-m-d') + $this->frozenClock->now()->format('Y-m-d'), )); $repositoryPath = $this->createMockRepositoryWithChangelog($existingChangelog); $checkout = $this->checkoutMockRepositoryWithChangelog($repositoryPath); @@ -195,7 +195,7 @@ public function testWritesCommitsAndPushesChangelogWhenFoundAndReadyToRelease(): $this->equalTo($checkout), $this->equalTo($sourceBranch), $this->equalTo('CHANGELOG.md'), - $this->stringContains('1.0.0 readiness') + $this->stringContains('1.0.0 readiness'), ); $this->push @@ -212,8 +212,8 @@ public function testWritesCommitsAndPushesChangelogWhenFoundAndReadyToRelease(): $checkout, SemVerVersion::fromMilestoneName('1.0.0'), BranchName::fromName('1.0.x'), - $this->key - ) + $this->key, + ), ); $changelogFile = $checkout . '/CHANGELOG.md'; @@ -223,7 +223,7 @@ public function testWritesCommitsAndPushesChangelogWhenFoundAndReadyToRelease(): Vec\values(Dict\take(Str\split(self::READY_CHANGELOG, "\n"), 4)), "\n", ), - $contents + $contents, ); $this->assertStringContainsString($expectedChangelog, $contents); $this->assertStringNotContainsString($existingChangelog, $contents); @@ -234,7 +234,7 @@ public function testWritesCommitsAndPushesChangelogWhenFoundAndReadyToRelease(): */ private function createMockRepositoryWithChangelog( string $template, - string $filename = 'CHANGELOG.md' + string $filename = 'CHANGELOG.md', ): string { $repo = Type\non_empty_string() ->assert(Filesystem\create_temporary_file(Env\temp_dir(), 'ReleaseChangelogViaKeepAChangelog')); @@ -243,7 +243,7 @@ private function createMockRepositoryWithChangelog( Filesystem\create_directory($repo); write( $repo . '/' . $filename, - $template + $template, ); Shell\execute('git', ['init', '.'], $repo); diff --git a/test/unit/Git/CommitFileViaConsoleTest.php b/test/unit/Git/CommitFileViaConsoleTest.php index dccc40a5..471cb442 100644 --- a/test/unit/Git/CommitFileViaConsoleTest.php +++ b/test/unit/Git/CommitFileViaConsoleTest.php @@ -50,7 +50,7 @@ public function testAddsAndCommitsFileProvidedWithAuthorAndCommitMessageProvided { write( $this->checkout . '/README.md', - "# README\n\nThis is a test file to test commits from laminas/automatic-releases." + "# README\n\nThis is a test file to test commits from laminas/automatic-releases.", ); $commitMessage = 'Commit initiated via unit test'; @@ -61,7 +61,7 @@ public function testAddsAndCommitsFileProvidedWithAuthorAndCommitMessageProvided BranchName::fromName('1.0.x'), 'README.md', $commitMessage, - $this->key + $this->key, ); $commitDetails = Shell\execute('git', ['show', '-1', '--pretty=raw'], $this->checkout); @@ -85,7 +85,7 @@ public function testFailsIfNotOnCorrectBranch(): void BranchName::fromName('1.0.x'), 'README.md', 'commit message', - $this->key + $this->key, ); } } diff --git a/test/unit/Git/CreateTagViaConsoleTest.php b/test/unit/Git/CreateTagViaConsoleTest.php index 4875944c..7d4c131f 100644 --- a/test/unit/Git/CreateTagViaConsoleTest.php +++ b/test/unit/Git/CreateTagViaConsoleTest.php @@ -57,7 +57,7 @@ public function testCreatesSignedTag(): void BranchName::fromName('tag-branch'), 'name-of-the-tag', 'changelog text for the tag', - $this->key + $this->key, ); Shell\execute('git', ['tag', '-v', 'name-of-the-tag'], $this->repository); diff --git a/test/unit/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemoteTest.php b/test/unit/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemoteTest.php index a4547a11..0a58b3ca 100644 --- a/test/unit/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemoteTest.php +++ b/test/unit/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemoteTest.php @@ -67,11 +67,11 @@ public function testFetchesAndSetsCurrentUser(): void self::assertSame( 'Mr. Magoo Set', - Str\trim(Shell\execute('git', ['config', '--get', 'user.name'], $this->destination)) + Str\trim(Shell\execute('git', ['config', '--get', 'user.name'], $this->destination)), ); self::assertSame( 'magoo-set@example.com', - Str\trim(Shell\execute('git', ['config', '--get', 'user.email'], $this->destination)) + Str\trim(Shell\execute('git', ['config', '--get', 'user.email'], $this->destination)), ); $fetchedBranches = Shell\execute('git', ['branch', '-r'], $this->destination); @@ -94,11 +94,11 @@ public function testFetchesAndSetsCurrentUserWithoutOrigin(): void self::assertSame( 'Mr. Magoo Set', - Str\trim(Shell\execute('git', ['config', '--get', 'user.name'], $this->destination)) + Str\trim(Shell\execute('git', ['config', '--get', 'user.name'], $this->destination)), ); self::assertSame( 'magoo-set@example.com', - Str\trim(Shell\execute('git', ['config', '--get', 'user.email'], $this->destination)) + Str\trim(Shell\execute('git', ['config', '--get', 'user.email'], $this->destination)), ); $fetchedBranches = Shell\execute('git', ['branch', '-r'], $this->destination); @@ -142,7 +142,7 @@ public function testGlobalGitConfigurationIsAdaptedToAllowCheckedOutRepositoryUs self::assertSame( '*', - Str\trim(Shell\execute('git', ['config', '--get', 'safe.directory'], $this->destination)) + Str\trim(Shell\execute('git', ['config', '--get', 'safe.directory'], $this->destination)), ); } } diff --git a/test/unit/Git/GetMergeTargetCandidateBranchesFromRemoteBranchesTest.php b/test/unit/Git/GetMergeTargetCandidateBranchesFromRemoteBranchesTest.php index b58709f2..5aab5d0d 100644 --- a/test/unit/Git/GetMergeTargetCandidateBranchesFromRemoteBranchesTest.php +++ b/test/unit/Git/GetMergeTargetCandidateBranchesFromRemoteBranchesTest.php @@ -59,7 +59,7 @@ public function testFetchesMergeTargetCandidates(): void BranchName::fromName('master'), ), (new GetMergeTargetCandidateBranchesFromRemoteBranches()) - ->__invoke($this->destination) + ->__invoke($this->destination), ); } } diff --git a/test/unit/Git/Value/BranchNameTest.php b/test/unit/Git/Value/BranchNameTest.php index 284daf6e..08458766 100644 --- a/test/unit/Git/Value/BranchNameTest.php +++ b/test/unit/Git/Value/BranchNameTest.php @@ -83,7 +83,7 @@ public function testIsForVersion(string $milestoneName, string $branchName, bool self::assertSame( $expected, BranchName::fromName($branchName) - ->isForVersion(SemVerVersion::fromMilestoneName($milestoneName)) + ->isForVersion(SemVerVersion::fromMilestoneName($milestoneName)), ); } @@ -112,7 +112,7 @@ public function testIsForNewerVersionThan(string $milestoneName, string $branchN self::assertSame( $expected, BranchName::fromName($branchName) - ->isForNewerVersionThan(SemVerVersion::fromMilestoneName($milestoneName)) + ->isForNewerVersionThan(SemVerVersion::fromMilestoneName($milestoneName)), ); } @@ -142,7 +142,7 @@ public function testTargetMinorReleaseVersion(string $branchName, string $expect self::assertEquals( SemVerVersion::fromMilestoneName($expectedVersion), BranchName::fromName($branchName) - ->targetMinorReleaseVersion() + ->targetMinorReleaseVersion(), ); } diff --git a/test/unit/Git/Value/MergeTargetCandidateBranchesTest.php b/test/unit/Git/Value/MergeTargetCandidateBranchesTest.php index 306cca68..d75b6ee6 100644 --- a/test/unit/Git/Value/MergeTargetCandidateBranchesTest.php +++ b/test/unit/Git/Value/MergeTargetCandidateBranchesTest.php @@ -20,7 +20,7 @@ public function test(): void BranchName::fromName('master'), BranchName::fromName('1.0'), BranchName::fromName('a/b/c'), // filtered out - BranchName::fromName('1.5') + BranchName::fromName('1.5'), ); self::assertNull($branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.99.0'))); @@ -31,27 +31,27 @@ public function test(): void self::assertEquals( BranchName::fromName('1.2'), - $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.2.3')) + $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.2.3')), ); self::assertEquals( BranchName::fromName('1.4'), // note: there is no 1.3 - $branches->branchToMergeUp(SemVerVersion::fromMilestoneName('1.2.3')) + $branches->branchToMergeUp(SemVerVersion::fromMilestoneName('1.2.3')), ); self::assertEquals( BranchName::fromName('1.5'), - $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.5.99')) + $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.5.99')), ); self::assertNull($branches->branchToMergeUp(SemVerVersion::fromMilestoneName('1.5.99'))); self::assertNull($branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.6.0'))); self::assertEquals( BranchName::fromName('1.0'), - $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.0.1')) + $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.0.1')), ); self::assertEquals( BranchName::fromName('1.1'), - $branches->branchToMergeUp(SemVerVersion::fromMilestoneName('1.0.1')) + $branches->branchToMergeUp(SemVerVersion::fromMilestoneName('1.0.1')), ); } @@ -60,28 +60,28 @@ public function testCannotGetNextMajorBranchIfNoneExists(): void $branches = MergeTargetCandidateBranches::fromAllBranches( BranchName::fromName('1.1'), BranchName::fromName('1.2'), - BranchName::fromName('potato') + BranchName::fromName('potato'), ); self::assertNull( $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.6.0')), - 'Cannot release next minor, since next minor branch does not exist' + 'Cannot release next minor, since next minor branch does not exist', ); self::assertNull( $branches->branchToMergeUp(SemVerVersion::fromMilestoneName('1.6.0')), - 'Cannot merge up next minor, since no next branch exists' + 'Cannot merge up next minor, since no next branch exists', ); self::assertNull( $branches->targetBranchFor(SemVerVersion::fromMilestoneName('2.0.0')), - 'Cannot release next major, since next major branch does not exist' + 'Cannot release next major, since next major branch does not exist', ); self::assertNull( $branches->branchToMergeUp(SemVerVersion::fromMilestoneName('2.0.0')), - 'Cannot merge up next major, since no next branch exists' + 'Cannot merge up next major, since no next branch exists', ); self::assertNull( $branches->branchToMergeUp(SemVerVersion::fromMilestoneName('1.2.1')), - 'Cannot merge up: no master branch exists' + 'Cannot merge up: no master branch exists', ); } @@ -90,12 +90,12 @@ public function testWillNotPickTargetIfNoMatchingReleaseBranchAndNewerReleaseBra { $branches = MergeTargetCandidateBranches::fromAllBranches( BranchName::fromName('1.2.x'), - BranchName::fromName('master') + BranchName::fromName('master'), ); self::assertNull( $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.1.0')), - '1.1.0 can\'t have a target branch, since 1.2.x already exists' + '1.1.0 can\'t have a target branch, since 1.2.x already exists', ); } @@ -104,12 +104,12 @@ public function testWillNotPickPatchTargetIfNoMatchingReleaseBranchAndNewerRelea { $branches = MergeTargetCandidateBranches::fromAllBranches( BranchName::fromName('1.0.x'), - BranchName::fromName('master') + BranchName::fromName('master'), ); self::assertNull( $branches->targetBranchFor(SemVerVersion::fromMilestoneName('1.1.1')), - '1.1.1 can\'t have a target branch, since 1.1.x doesn\'t exist, but patches require a release branch' + '1.1.1 can\'t have a target branch, since 1.1.x doesn\'t exist, but patches require a release branch', ); } @@ -123,39 +123,39 @@ public function testWillComputeFutureReleaseBranchFromCurrentRelease(): void self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.0.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.0.0')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.1.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.1.0')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.1.1')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.1.1')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.2.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.2.0')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.3.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.3.0')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.3.1')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.3.1')), ); self::assertEquals( BranchName::fromName('1.5.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.4.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.4.0')), ); self::assertEquals( BranchName::fromName('1.6.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.5.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.5.0')), ); self::assertEquals( BranchName::fromName('2.1.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('2.0.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('2.0.0')), ); } @@ -170,39 +170,39 @@ public function testWillIgnoreMasterBranchWhenComputingFutureReleaseBranchName() self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.0.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.0.0')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.1.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.1.0')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.1.1')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.1.1')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.2.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.2.0')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.3.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.3.0')), ); self::assertEquals( BranchName::fromName('1.4.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.3.1')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.3.1')), ); self::assertEquals( BranchName::fromName('1.5.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.4.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.4.0')), ); self::assertEquals( BranchName::fromName('1.6.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.5.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('1.5.0')), ); self::assertEquals( BranchName::fromName('2.1.x'), - $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('2.0.0')) + $branches->newestFutureReleaseBranchAfter(SemVerVersion::fromMilestoneName('2.0.0')), ); } @@ -232,7 +232,7 @@ public function testNewestReleaseBranch(): void BranchName::fromName('1.1'), BranchName::fromName('1.1.x'), BranchName::fromName('1.2.x'), - )->newestReleaseBranch() + )->newestReleaseBranch(), ); self::assertEquals( @@ -242,7 +242,7 @@ public function testNewestReleaseBranch(): void BranchName::fromName('1.1.x'), BranchName::fromName('1.4.x'), BranchName::fromName('1.2.x'), - )->newestReleaseBranch() + )->newestReleaseBranch(), ); self::assertEquals( @@ -253,7 +253,7 @@ public function testNewestReleaseBranch(): void BranchName::fromName('1.4.x'), BranchName::fromName('1.2.x'), BranchName::fromName('2.0.x'), - )->newestReleaseBranch() + )->newestReleaseBranch(), ); self::assertEquals( @@ -262,15 +262,15 @@ public function testNewestReleaseBranch(): void BranchName::fromName('1.1.x'), BranchName::fromName('2.0.x'), BranchName::fromName('master'), - )->newestReleaseBranch() + )->newestReleaseBranch(), ); self::assertNull( MergeTargetCandidateBranches::fromAllBranches( BranchName::fromName('foo'), BranchName::fromName('develop'), - BranchName::fromName('master') - )->newestReleaseBranch() + BranchName::fromName('master'), + )->newestReleaseBranch(), ); } } diff --git a/test/unit/Git/Value/SemVerVersionTest.php b/test/unit/Git/Value/SemVerVersionTest.php index 9f394697..453420b3 100644 --- a/test/unit/Git/Value/SemVerVersionTest.php +++ b/test/unit/Git/Value/SemVerVersionTest.php @@ -18,7 +18,7 @@ public function testDetectedReleaseVersions( string $milestoneName, int $expectedMajor, int $expectedMinor, - string $expectedVersionName + string $expectedVersionName, ): void { $version = SemVerVersion::fromMilestoneName($milestoneName); @@ -75,7 +75,7 @@ public function testReleaseBranchNames(string $milestoneName, string $expectedTa self::assertEquals( BranchName::fromName($expectedTargetBranch), SemVerVersion::fromMilestoneName($milestoneName) - ->targetReleaseBranchName() + ->targetReleaseBranchName(), ); } @@ -97,7 +97,7 @@ public function testIsNewMinorRelease(string $milestoneName, bool $expected): vo self::assertSame( $expected, SemVerVersion::fromMilestoneName($milestoneName) - ->isNewMinorRelease() + ->isNewMinorRelease(), ); } @@ -125,7 +125,7 @@ public function testIsNewMajorRelease(string $milestoneName, bool $expected): vo self::assertSame( $expected, SemVerVersion::fromMilestoneName($milestoneName) - ->isNewMajorRelease() + ->isNewMajorRelease(), ); } @@ -156,7 +156,7 @@ public function testLessThanEqual(string $a, string $b, bool $expected): void self::assertEquals( $expected, SemVerVersion::fromMilestoneName($a) - ->lessThanEqual(SemVerVersion::fromMilestoneName($b)) + ->lessThanEqual(SemVerVersion::fromMilestoneName($b)), ); } diff --git a/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequestTest.php b/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequestTest.php index bebfddec..5997e334 100644 --- a/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequestTest.php +++ b/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequestTest.php @@ -47,7 +47,7 @@ public function testIssue(): void 'login' => 'Magoo', 'url' => 'https://example.com/author', ]), - $issue->author() + $issue->author(), ); self::assertEquals( [ @@ -62,7 +62,7 @@ public function testIssue(): void 'url' => 'https://example.com/question', ]), ], - $issue->labels() + $issue->labels(), ); } @@ -103,7 +103,7 @@ public function testPullRequest(): void 'login' => 'Magoo', 'url' => 'http://example.com/author', ]), - $issue->author() + $issue->author(), ); self::assertEquals( [ @@ -118,7 +118,7 @@ public function testPullRequest(): void 'url' => 'http://example.com/question', ]), ], - $issue->labels() + $issue->labels(), ); } } diff --git a/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/MilestoneTest.php b/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/MilestoneTest.php index aea9b2f3..aee49e1a 100644 --- a/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/MilestoneTest.php +++ b/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/MilestoneTest.php @@ -85,7 +85,7 @@ public function test(): void ], ]), ], - $milestone->entries() + $milestone->entries(), ); self::assertSame(123, $milestone->number()); diff --git a/test/unit/Github/Api/GraphQL/Query/GetMilestoneFirst100IssuesAndPullRequestsTest.php b/test/unit/Github/Api/GraphQL/Query/GetMilestoneFirst100IssuesAndPullRequestsTest.php index 02582926..16ba2d49 100644 --- a/test/unit/Github/Api/GraphQL/Query/GetMilestoneFirst100IssuesAndPullRequestsTest.php +++ b/test/unit/Github/Api/GraphQL/Query/GetMilestoneFirst100IssuesAndPullRequestsTest.php @@ -37,7 +37,7 @@ public function testRetrievesMilestone(): void 'repositoryName' => 'bar', 'owner' => 'foo', 'milestoneNumber' => 123, - ] + ], ) ->willReturn([ 'repository' => [ @@ -88,7 +88,7 @@ public function testRetrievesMilestone(): void $this->query->__invoke( RepositoryName::fromFullName('foo/bar'), - 123 + 123, ); } } diff --git a/test/unit/Github/Api/GraphQL/RunGraphQLQueryTest.php b/test/unit/Github/Api/GraphQL/RunGraphQLQueryTest.php index 09fabb8b..baa545b8 100644 --- a/test/unit/Github/Api/GraphQL/RunGraphQLQueryTest.php +++ b/test/unit/Github/Api/GraphQL/RunGraphQLQueryTest.php @@ -38,7 +38,7 @@ protected function setUp(): void $this->runQuery = new RunGraphQLQuery( $messageFactory, $this->httpClient, - $this->apiToken + $this->apiToken, ); $messageFactory @@ -55,7 +55,7 @@ public function testSuccessfulRequest(): void { "data": {"foo": "bar"} } -JSON +JSON, ); $this @@ -70,12 +70,12 @@ public function testSuccessfulRequest(): void 'User-Agent' => ['Ocramius\'s minimal GraphQL client - stolen from Dunglas'], 'Authorization' => ['bearer ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertSame( '{"query":"the-query","variables":{"a":"b"}}', - $request->getBody()->__toString() + $request->getBody()->__toString(), ); return true; @@ -84,7 +84,7 @@ public function testSuccessfulRequest(): void self::assertSame( ['foo' => 'bar'], - $this->runQuery->__invoke('the-query', ['a' => 'b']) + $this->runQuery->__invoke('the-query', ['a' => 'b']), ); } @@ -102,7 +102,7 @@ public function testWillThrowIfGraphQLResponseIsNotSuccessful(int $responseCode) { "data": {"foo": "bar"} } -JSON +JSON, ); $this @@ -117,12 +117,12 @@ public function testWillThrowIfGraphQLResponseIsNotSuccessful(int $responseCode) 'User-Agent' => ['Ocramius\'s minimal GraphQL client - stolen from Dunglas'], 'Authorization' => ['bearer ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertSame( '{"query":"the-query","variables":{"a":"b"}}', - $request->getBody()->__toString() + $request->getBody()->__toString(), ); return true; @@ -133,7 +133,7 @@ public function testWillThrowIfGraphQLResponseIsNotSuccessful(int $responseCode) self::assertSame( ['foo' => 'bar'], - $this->runQuery->__invoke('the-query', ['a' => 'b']) + $this->runQuery->__invoke('the-query', ['a' => 'b']), ); } @@ -157,7 +157,7 @@ public function testWillThrowIfGraphQLResponseIncludesErrorsInResponse(): void "errors": ["nope"], "data": {"foo": "bar"} } -JSON +JSON, ); $this @@ -172,12 +172,12 @@ public function testWillThrowIfGraphQLResponseIncludesErrorsInResponse(): void 'User-Agent' => ['Ocramius\'s minimal GraphQL client - stolen from Dunglas'], 'Authorization' => ['bearer ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertSame( '{"query":"the-query","variables":{"a":"b"}}', - $request->getBody()->__toString() + $request->getBody()->__toString(), ); return true; @@ -189,7 +189,7 @@ public function testWillThrowIfGraphQLResponseIncludesErrorsInResponse(): void self::assertSame( ['foo' => 'bar'], - $this->runQuery->__invoke('the-query', ['a' => 'b']) + $this->runQuery->__invoke('the-query', ['a' => 'b']), ); } } diff --git a/test/unit/Github/Api/V3/CreateMilestoneTest.php b/test/unit/Github/Api/V3/CreateMilestoneTest.php index 75603882..d045a363 100644 --- a/test/unit/Github/Api/V3/CreateMilestoneTest.php +++ b/test/unit/Github/Api/V3/CreateMilestoneTest.php @@ -40,7 +40,7 @@ protected function setUp(): void $this->messageFactory, $this->httpClient, $this->apiToken, - $this->createMock(LoggerInterface::class) + $this->createMock(LoggerInterface::class), ); } @@ -58,7 +58,7 @@ public function testSuccessfulRequest(): void { "html_url": "https://another-domain.com/the-pr" } - JSON + JSON, ); $this->httpClient @@ -72,7 +72,7 @@ public function testSuccessfulRequest(): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( @@ -82,7 +82,7 @@ public function testSuccessfulRequest(): void "title": "1.2.3" } JSON, - $request->getBody()->__toString() + $request->getBody()->__toString(), ); return true; @@ -91,7 +91,7 @@ public function testSuccessfulRequest(): void $this->createMilestone->__invoke( RepositoryName::fromFullName('foo/bar'), - SemVerVersion::fromMilestoneName('1.2.3') + SemVerVersion::fromMilestoneName('1.2.3'), ); } @@ -117,7 +117,7 @@ public function testExistingMilestone(): void ], "message": "Validation Failed" } - JSON + JSON, ); $this->httpClient @@ -131,7 +131,7 @@ public function testExistingMilestone(): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( @@ -141,7 +141,7 @@ public function testExistingMilestone(): void "title": "2.1.0" } JSON, - $request->getBody()->__toString() + $request->getBody()->__toString(), ); return true; @@ -152,7 +152,7 @@ public function testExistingMilestone(): void $this->createMilestone->__invoke( RepositoryName::fromFullName('foo/bar'), - SemVerVersion::fromMilestoneName('2.1.0') + SemVerVersion::fromMilestoneName('2.1.0'), ); } @@ -170,7 +170,7 @@ public function testMajorMilestone(): void { "html_url": "https://another-domain.com/the-pr" } - JSON + JSON, ); $this->httpClient @@ -184,7 +184,7 @@ public function testMajorMilestone(): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( @@ -194,7 +194,7 @@ public function testMajorMilestone(): void "title": "3.0.0" } JSON, - $request->getBody()->__toString() + $request->getBody()->__toString(), ); return true; @@ -203,7 +203,7 @@ public function testMajorMilestone(): void $this->createMilestone->__invoke( RepositoryName::fromFullName('foo/bar'), - SemVerVersion::fromMilestoneName('3.0.0') + SemVerVersion::fromMilestoneName('3.0.0'), ); } } diff --git a/test/unit/Github/Api/V3/CreatePullRequestTest.php b/test/unit/Github/Api/V3/CreatePullRequestTest.php index 7bd24c4c..0a6a7c68 100644 --- a/test/unit/Github/Api/V3/CreatePullRequestTest.php +++ b/test/unit/Github/Api/V3/CreatePullRequestTest.php @@ -41,7 +41,7 @@ protected function setUp(): void $this->createPullRequest = new CreatePullRequestThroughApiCall( $this->messageFactory, $this->httpClient, - $this->apiToken + $this->apiToken, ); } @@ -60,7 +60,7 @@ public function testSuccessfulRequest(): void { "url": "http://another-domain.com/the-pr" } - JSON + JSON, ); $this->httpClient ->expects(self::once()) @@ -73,7 +73,7 @@ public function testSuccessfulRequest(): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( @@ -87,7 +87,7 @@ public function testSuccessfulRequest(): void "draft": false } JSON, - $request->getBody()->__toString() + $request->getBody()->__toString(), ); return true; @@ -99,7 +99,7 @@ public function testSuccessfulRequest(): void BranchName::fromName('the/source-branch'), BranchName::fromName('the/target-branch'), 'the-title', - 'the-body' + 'the-body', ); } } diff --git a/test/unit/Github/Api/V3/CreatePullRequestThroughApiCallTest.php b/test/unit/Github/Api/V3/CreatePullRequestThroughApiCallTest.php index 2c674667..cc6e04b4 100644 --- a/test/unit/Github/Api/V3/CreatePullRequestThroughApiCallTest.php +++ b/test/unit/Github/Api/V3/CreatePullRequestThroughApiCallTest.php @@ -39,7 +39,7 @@ protected function setUp(): void $this->createPullRequest = new CreatePullRequestThroughApiCall( $this->messageFactory, $this->httpClient, - $this->apiToken + $this->apiToken, ); } @@ -72,7 +72,7 @@ public function testSuccessfulRequest(int $responseCode): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( @@ -88,7 +88,7 @@ public function testSuccessfulRequest(int $responseCode): void JSON , $request->getBody() - ->__toString() + ->__toString(), ); return true; @@ -100,7 +100,7 @@ public function testSuccessfulRequest(int $responseCode): void BranchName::fromName('foo-bar-baz'), BranchName::fromName('target-branch-name'), 'My awesome pull request', - 'A description for my awesome pull request' + 'A description for my awesome pull request', ); } @@ -145,7 +145,7 @@ public function testRequestFailedToCreatePullRequestDueToInvalidResponseCode(int BranchName::fromName('foo-bar-baz'), BranchName::fromName('target-branch-name'), 'My awesome pull request', - 'A description for my awesome pull request' + 'A description for my awesome pull request', ); } @@ -186,7 +186,7 @@ public function testRequestFailedToCreatePullRequestDueToInvalidResponseBody(): BranchName::fromName('foo-bar-baz'), BranchName::fromName('target-branch-name'), 'My awesome pull request', - 'A description for my awesome pull request' + 'A description for my awesome pull request', ); } } diff --git a/test/unit/Github/Api/V3/CreateReleaseTest.php b/test/unit/Github/Api/V3/CreateReleaseTest.php index 24e3a16e..23b69910 100644 --- a/test/unit/Github/Api/V3/CreateReleaseTest.php +++ b/test/unit/Github/Api/V3/CreateReleaseTest.php @@ -37,7 +37,7 @@ protected function setUp(): void $this->createRelease = new CreateReleaseThroughApiCall( $this->messageFactory, $this->httpClient, - $this->apiToken + $this->apiToken, ); } @@ -55,7 +55,7 @@ public function testSuccessfulRequest(): void { "html_url": "https://another-domain.com/the-pr" } - JSON + JSON, ); $this->httpClient @@ -69,7 +69,7 @@ public function testSuccessfulRequest(): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( @@ -80,7 +80,7 @@ public function testSuccessfulRequest(): void "body": "the-body" } JSON, - $request->getBody()->__toString() + $request->getBody()->__toString(), ); return true; @@ -92,8 +92,8 @@ public function testSuccessfulRequest(): void $this->createRelease->__invoke( RepositoryName::fromFullName('foo/bar'), SemVerVersion::fromMilestoneName('1.2.3'), - 'the-body' - ) + 'the-body', + ), ); } } diff --git a/test/unit/Github/Api/V3/CreateReleaseThroughApiCallTest.php b/test/unit/Github/Api/V3/CreateReleaseThroughApiCallTest.php index bae240b4..c20a0f75 100644 --- a/test/unit/Github/Api/V3/CreateReleaseThroughApiCallTest.php +++ b/test/unit/Github/Api/V3/CreateReleaseThroughApiCallTest.php @@ -39,7 +39,7 @@ protected function setUp(): void $this->createRelease = new CreateReleaseThroughApiCall( $this->messageFactory, $this->httpClient, - $this->apiToken + $this->apiToken, ); } @@ -72,7 +72,7 @@ public function testSuccessfulRequest(int $responseCode): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( @@ -85,7 +85,7 @@ public function testSuccessfulRequest(int $responseCode): void JSON , $request->getBody() - ->__toString() + ->__toString(), ); return true; @@ -98,7 +98,7 @@ public function testSuccessfulRequest(int $responseCode): void RepositoryName::fromFullName('foo/bar'), SemVerVersion::fromMilestoneName('1.2.3'), 'A description for my awesome release', - ) + ), ); } diff --git a/test/unit/Github/Api/V3/SetDefaultBranchThroughApiCallTest.php b/test/unit/Github/Api/V3/SetDefaultBranchThroughApiCallTest.php index d38e38f7..a6ad1830 100644 --- a/test/unit/Github/Api/V3/SetDefaultBranchThroughApiCallTest.php +++ b/test/unit/Github/Api/V3/SetDefaultBranchThroughApiCallTest.php @@ -39,7 +39,7 @@ protected function setUp(): void $this->createRelease = new SetDefaultBranchThroughApiCall( $this->messageFactory, $this->httpClient, - $this->apiToken + $this->apiToken, ); } @@ -72,13 +72,13 @@ public function testSuccessfulRequest(int $responseCode): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( '{"default_branch": "foo-bar-baz"}', $request->getBody() - ->__toString() + ->__toString(), ); return true; @@ -87,7 +87,7 @@ public function testSuccessfulRequest(int $responseCode): void $this->createRelease->__invoke( RepositoryName::fromFullName('foo/bar'), - BranchName::fromName('foo-bar-baz') + BranchName::fromName('foo-bar-baz'), ); } @@ -124,13 +124,13 @@ public function testRequestFailedToSwitchBranch(): void 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( '{"default_branch": "foo-bar-baz"}', $request->getBody() - ->__toString() + ->__toString(), ); return true; @@ -142,7 +142,7 @@ public function testRequestFailedToSwitchBranch(): void $this->createRelease->__invoke( RepositoryName::fromFullName('foo/bar'), - BranchName::fromName('foo-bar-baz') + BranchName::fromName('foo-bar-baz'), ); } @@ -175,13 +175,13 @@ public function testRequestFailedToSwitchBranchDueToInvalidResponseCode(int $res 'User-Agent' => ['Ocramius\'s minimal API V3 client'], 'Authorization' => ['token ' . $this->apiToken], ], - $request->getHeaders() + $request->getHeaders(), ); self::assertJsonStringEqualsJsonString( '{"default_branch": "foo-bar-baz"}', $request->getBody() - ->__toString() + ->__toString(), ); return true; @@ -193,7 +193,7 @@ public function testRequestFailedToSwitchBranchDueToInvalidResponseCode(int $res $this->createRelease->__invoke( RepositoryName::fromFullName('foo/bar'), - BranchName::fromName('foo-bar-baz') + BranchName::fromName('foo-bar-baz'), ); } diff --git a/test/unit/Github/CreateChangelogTextTest.php b/test/unit/Github/CreateChangelogTextTest.php index ddc6cfc2..3eee1e76 100644 --- a/test/unit/Github/CreateChangelogTextTest.php +++ b/test/unit/Github/CreateChangelogTextTest.php @@ -121,9 +121,9 @@ public function testGeneratedReleaseText(): void $repositoryName, $semVerVersion, BranchName::fromName('2.12.x'), - __DIR__ + __DIR__, ) - ->contents() + ->contents(), ); } @@ -188,8 +188,8 @@ public function testCapableOfGeneratingReleaseTest(): void $repositoryName, $semVerVersion, BranchName::fromName('1.0.x'), - __DIR__ - ) + __DIR__, + ), ); } } diff --git a/test/unit/Github/CreateReleaseTextViaKeepAChangelogTest.php b/test/unit/Github/CreateReleaseTextViaKeepAChangelogTest.php index c4ae69ba..e109824b 100644 --- a/test/unit/Github/CreateReleaseTextViaKeepAChangelogTest.php +++ b/test/unit/Github/CreateReleaseTextViaKeepAChangelogTest.php @@ -36,7 +36,7 @@ public function testReportsCannotCreateReleaseTextIfChangelogFileIsMissing(): vo { $repositoryPath = $this->createMockRepositoryWithChangelog( self::INVALID_CHANGELOG, - 'NOT-A-CHANGELOG.md' + 'NOT-A-CHANGELOG.md', ); $workingPath = $this->checkoutMockRepositoryWithChangelog($repositoryPath); @@ -47,8 +47,8 @@ public function testReportsCannotCreateReleaseTextIfChangelogFileIsMissing(): vo RepositoryName::fromFullName('example/repo'), SemVerVersion::fromMilestoneName('1.0.0'), BranchName::fromName('1.0.x'), - $workingPath - ) + $workingPath, + ), ); } @@ -64,8 +64,8 @@ public function testReportsCannotCreateReleaseTextIfChangelogFileDoesNotContainV RepositoryName::fromFullName('example/repo'), SemVerVersion::fromMilestoneName('1.0.0'), BranchName::fromName('1.0.x'), - $workingPath - ) + $workingPath, + ), ); } @@ -84,8 +84,8 @@ public function testReportsCanCreateReleaseWhenChangelogWithVersionExists(): voi RepositoryName::fromFullName('example/repo'), SemVerVersion::fromMilestoneName('1.0.0'), BranchName::fromName('1.0.x'), - $workingPath - ) + $workingPath, + ), ); } @@ -112,9 +112,9 @@ public function testExtractsReleaseTextViaChangelogFile(): void RepositoryName::fromFullName('example/repo'), SemVerVersion::fromMilestoneName('1.0.0'), BranchName::fromName('1.0.x'), - $workingPath + $workingPath, ) - ->contents() + ->contents(), ); } @@ -125,7 +125,7 @@ public function testExtractsNonEmptySectionsForVersionViaChangelogFile(): void $repositoryPath = $this->createMockRepositoryWithChangelog( $changelogContents, 'CHANGELOG.md', - '2.3.x' + '2.3.x', ); $workingPath = $this->checkoutMockRepositoryWithChangelog($repositoryPath); @@ -149,9 +149,9 @@ public function testExtractsNonEmptySectionsForVersionViaChangelogFile(): void RepositoryName::fromFullName('example/repo'), SemVerVersion::fromMilestoneName('2.3.12'), BranchName::fromName('2.3.x'), - $workingPath + $workingPath, ) - ->contents() + ->contents(), ); } @@ -178,7 +178,7 @@ private function createMockMilestone(): Milestone private function createMockRepositoryWithChangelog( string $template, string $filename = 'CHANGELOG.md', - string $initialBranch = '1.0.x' + string $initialBranch = '1.0.x', ): string { $repo = Filesystem\create_temporary_file(Env\temp_dir(), 'CreateReleaseTextViaKeepAChangelog'); Filesystem\delete_file($repo); diff --git a/test/unit/Github/Event/Factory/LoadCurrentGithubEventFromGithubActionPathTest.php b/test/unit/Github/Event/Factory/LoadCurrentGithubEventFromGithubActionPathTest.php index 5d386794..74ddb014 100644 --- a/test/unit/Github/Event/Factory/LoadCurrentGithubEventFromGithubActionPathTest.php +++ b/test/unit/Github/Event/Factory/LoadCurrentGithubEventFromGithubActionPathTest.php @@ -42,7 +42,7 @@ public function testWillLoadEventFile(): void self::assertEquals( MilestoneClosedEvent::fromEventJson($eventData), (new LoadCurrentGithubEventFromGithubActionPath($variables)) - ->__invoke() + ->__invoke(), ); } } diff --git a/test/unit/Github/JwageGenerateChangelogTest.php b/test/unit/Github/JwageGenerateChangelogTest.php index 31a2c9c8..e3033cdb 100644 --- a/test/unit/Github/JwageGenerateChangelogTest.php +++ b/test/unit/Github/JwageGenerateChangelogTest.php @@ -52,7 +52,7 @@ public function testCreateGenerateChangelog(): void $changeLogGenerator = JwageGenerateChangelog::create( $makeRequests, $httpClient, - $githubToken + $githubToken, ); $this->assertInstanceOf(JwageGenerateChangelog::class, $changeLogGenerator); diff --git a/test/unit/Github/MergeMultipleReleaseNotesTest.php b/test/unit/Github/MergeMultipleReleaseNotesTest.php index 5d1ead37..57028422 100644 --- a/test/unit/Github/MergeMultipleReleaseNotesTest.php +++ b/test/unit/Github/MergeMultipleReleaseNotesTest.php @@ -70,7 +70,7 @@ public function testIndicatesCannotCreateReleaseTextIfNoGeneratorCan(): void self::equalTo($this->repositoryName), self::equalTo($this->version), self::equalTo($this->sourceBranch), - self::equalTo($this->repositoryPath) + self::equalTo($this->repositoryPath), ) ->willReturn(false); $generators[] = $generator; @@ -84,8 +84,8 @@ public function testIndicatesCannotCreateReleaseTextIfNoGeneratorCan(): void $this->repositoryName, $this->version, $this->sourceBranch, - $this->repositoryPath - ) + $this->repositoryPath, + ), ); } @@ -107,7 +107,7 @@ public function testIndicatesCanCreateReleaseTextIfAtLeastOneGeneratorCan(): voi $this->equalTo($this->repositoryName), $this->equalTo($this->version), $this->equalTo($this->sourceBranch), - $this->equalTo($this->repositoryPath) + $this->equalTo($this->repositoryPath), ) ->willReturn(false); $generators[] = $generator; @@ -130,7 +130,7 @@ public function testIndicatesCanCreateReleaseTextIfAtLeastOneGeneratorCan(): voi $this->equalTo($this->repositoryName), $this->equalTo($this->version), $this->equalTo($this->sourceBranch), - $this->equalTo($this->repositoryPath) + $this->equalTo($this->repositoryPath), ) ->willReturn(true); $generators[] = $generator; @@ -144,8 +144,8 @@ public function testIndicatesCanCreateReleaseTextIfAtLeastOneGeneratorCan(): voi $this->repositoryName, $this->version, $this->sourceBranch, - $this->repositoryPath - ) + $this->repositoryPath, + ), ); } @@ -173,7 +173,7 @@ public function testReturnsConcatenatedValuesFromGeneratorsThatCanCreateReleaseT $this->equalTo($this->repositoryName), $this->equalTo($this->version), $this->equalTo($this->sourceBranch), - $this->equalTo($this->repositoryPath) + $this->equalTo($this->repositoryPath), ) ->willReturn(true); $generator @@ -184,7 +184,7 @@ public function testReturnsConcatenatedValuesFromGeneratorsThatCanCreateReleaseT $this->equalTo($this->repositoryName), $this->equalTo($this->version), $this->equalTo($this->sourceBranch), - $this->equalTo($this->repositoryPath) + $this->equalTo($this->repositoryPath), ) ->willReturn(new ChangelogReleaseNotes('GENERATOR ' . $index)); break; @@ -197,7 +197,7 @@ public function testReturnsConcatenatedValuesFromGeneratorsThatCanCreateReleaseT $this->equalTo($this->repositoryName), $this->equalTo($this->version), $this->equalTo($this->sourceBranch), - $this->equalTo($this->repositoryPath) + $this->equalTo($this->repositoryPath), ) ->willReturn(false); $generator @@ -230,8 +230,8 @@ public function testReturnsConcatenatedValuesFromGeneratorsThatCanCreateReleaseT $this->repositoryName, $this->version, $this->sourceBranch, - $this->repositoryPath - )->contents() + $this->repositoryPath, + )->contents(), ); } } diff --git a/test/unit/Github/Value/RepositoryNameTest.php b/test/unit/Github/Value/RepositoryNameTest.php index 525e5104..ef680cb6 100644 --- a/test/unit/Github/Value/RepositoryNameTest.php +++ b/test/unit/Github/Value/RepositoryNameTest.php @@ -20,13 +20,13 @@ public function test(): void 'https://github.com/foo/bar.git', $repositoryName ->uri() - ->__toString() + ->__toString(), ); self::assertSame( 'https://token:x-oauth-basic@github.com/foo/bar.git', $repositoryName ->uriWithTokenAuthentication('token') - ->__toString() + ->__toString(), ); /** @psalm-suppress UnusedMethodCall */ diff --git a/test/unit/Gpg/ImportGpgKeyFromStringViaTemporaryFileTest.php b/test/unit/Gpg/ImportGpgKeyFromStringViaTemporaryFileTest.php index f3ac366d..8edc3be8 100644 --- a/test/unit/Gpg/ImportGpgKeyFromStringViaTemporaryFileTest.php +++ b/test/unit/Gpg/ImportGpgKeyFromStringViaTemporaryFileTest.php @@ -18,7 +18,7 @@ public function testWillImportValidGpgKey(): void self::assertEquals( SecretKeyId::fromBase16String('8CA5C026AE941316'), (new ImportGpgKeyFromStringViaTemporaryFile()) - ->__invoke(read(__DIR__ . '/../../asset/dummy-gpg-key.asc')) + ->__invoke(read(__DIR__ . '/../../asset/dummy-gpg-key.asc')), ); } } diff --git a/test/unit/Gpg/SecretKeyIdTest.php b/test/unit/Gpg/SecretKeyIdTest.php index 3418c835..36e091a2 100644 --- a/test/unit/Gpg/SecretKeyIdTest.php +++ b/test/unit/Gpg/SecretKeyIdTest.php @@ -40,7 +40,7 @@ public function testAcceptsValidKeyIds(string $valid): void self::assertSame( $valid, SecretKeyId::fromBase16String($valid) - ->id() + ->id(), ); } From b6d38ba9c77bebe1332526d0c88075ece7449cc3 Mon Sep 17 00:00:00 2001 From: George Steel Date: Mon, 29 Aug 2022 10:37:29 +0100 Subject: [PATCH 3/4] CS Fixes - Doc Comments & Nowdocs - SlevomatCodingStandard.Commenting.RequireOneLineDocComment - SlevomatCodingStandard.PHP.RequireNowdoc Signed-off-by: George Steel --- src/Changelog/ChangelogExists.php | 4 +-- src/Changelog/ChangelogExistsViaConsole.php | 4 +-- src/Changelog/ChangelogReleaseNotes.php | 16 +++------ src/Changelog/CommitReleaseChangelog.php | 4 +-- ...ommitReleaseChangelogViaKeepAChangelog.php | 4 +-- src/Git/CheckoutBranch.php | 4 +-- .../Response/Milestone.php | 4 +-- src/Github/CreateReleaseText.php | 4 +-- .../CreateMergeUpPullRequestTest.php | 33 ++++++++--------- .../unit/Application/CreateMilestonesTest.php | 9 +++-- test/unit/Application/ReleaseCommandTest.php | 25 ++++++------- .../SwitchDefaultBranchToNextMinorTest.php | 33 ++++++++--------- ...tChangelogVersionViaKeepAChangelogTest.php | 4 +-- .../ChangelogExistsViaConsoleTest.php | 4 +-- .../Changelog/ChangelogReleaseNotesTest.php | 8 ++--- .../ReleaseChangelogViaKeepAChangelogTest.php | 4 +-- test/unit/Git/Value/BranchNameTest.php | 20 +++-------- test/unit/Git/Value/SemVerVersionTest.php | 24 ++++--------- .../Response/LabelTest.php | 4 +-- .../Api/GraphQL/RunGraphQLQueryTest.php | 35 ++++++++++--------- ...CreateReleaseTextViaKeepAChangelogTest.php | 4 +-- .../Github/MergeMultipleReleaseNotesTest.php | 4 +-- test/unit/Gpg/SecretKeyIdTest.php | 8 ++--- 23 files changed, 102 insertions(+), 161 deletions(-) diff --git a/src/Changelog/ChangelogExists.php b/src/Changelog/ChangelogExists.php index 86c95e57..f4dd9b55 100644 --- a/src/Changelog/ChangelogExists.php +++ b/src/Changelog/ChangelogExists.php @@ -8,9 +8,7 @@ interface ChangelogExists { - /** - * @param non-empty-string $repositoryDirectory - */ + /** @param non-empty-string $repositoryDirectory */ public function __invoke( BranchName $sourceBranch, string $repositoryDirectory, diff --git a/src/Changelog/ChangelogExistsViaConsole.php b/src/Changelog/ChangelogExistsViaConsole.php index ecdd1e4b..ab8ecedc 100644 --- a/src/Changelog/ChangelogExistsViaConsole.php +++ b/src/Changelog/ChangelogExistsViaConsole.php @@ -9,9 +9,7 @@ class ChangelogExistsViaConsole implements ChangelogExists { - /** - * @param non-empty-string $repositoryDirectory - */ + /** @param non-empty-string $repositoryDirectory */ public function __invoke( BranchName $sourceBranch, string $repositoryDirectory, diff --git a/src/Changelog/ChangelogReleaseNotes.php b/src/Changelog/ChangelogReleaseNotes.php index 4cf791f3..7c56f0d5 100644 --- a/src/Changelog/ChangelogReleaseNotes.php +++ b/src/Changelog/ChangelogReleaseNotes.php @@ -10,9 +10,7 @@ use Psl\Str; use RuntimeException; -/** - * @psalm-immutable - */ +/** @psalm-immutable */ class ChangelogReleaseNotes { private const CONCATENATION_STRING = "\n\n-----\n\n"; @@ -22,9 +20,7 @@ class ChangelogReleaseNotes /** @psalm-var non-empty-string */ private string $contents; - /** - * @psalm-param non-empty-string $changelogFile - */ + /** @psalm-param non-empty-string $changelogFile */ public static function writeChangelogFile(string $changelogFile, self $releaseNotes): void { // Nothing to do @@ -44,9 +40,7 @@ public static function writeChangelogFile(string $changelogFile, self $releaseNo ); } - /** - * @psalm-param non-empty-string $contents - */ + /** @psalm-param non-empty-string $contents */ public function __construct( string $contents, ?ChangelogEntry $changelogEntry = null, @@ -59,9 +53,7 @@ public function __construct( $this->changelogEntry = $changelogEntry; } - /** - * @psalm-return non-empty-string - */ + /** @psalm-return non-empty-string */ public function contents(): string { return $this->contents; diff --git a/src/Changelog/CommitReleaseChangelog.php b/src/Changelog/CommitReleaseChangelog.php index d08f99db..3f12989b 100644 --- a/src/Changelog/CommitReleaseChangelog.php +++ b/src/Changelog/CommitReleaseChangelog.php @@ -10,9 +10,7 @@ interface CommitReleaseChangelog { - /** - * @psalm-param non-empty-string $repositoryDirectory - */ + /** @psalm-param non-empty-string $repositoryDirectory */ public function __invoke( ChangelogReleaseNotes $releaseNotes, string $repositoryDirectory, diff --git a/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php b/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php index 8993344b..241ded6c 100644 --- a/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php +++ b/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php @@ -44,9 +44,7 @@ public function __construct( $this->logger = $logger; } - /** - * @psalm-param non-empty-string $repositoryDirectory - */ + /** @psalm-param non-empty-string $repositoryDirectory */ public function __invoke( ChangelogReleaseNotes $releaseNotes, string $repositoryDirectory, diff --git a/src/Git/CheckoutBranch.php b/src/Git/CheckoutBranch.php index 321c6c62..4cd6e186 100644 --- a/src/Git/CheckoutBranch.php +++ b/src/Git/CheckoutBranch.php @@ -8,9 +8,7 @@ interface CheckoutBranch { - /** - * @psalm-param non-empty-string $repositoryDirectory - */ + /** @psalm-param non-empty-string $repositoryDirectory */ public function __invoke( string $repositoryDirectory, BranchName $branchName, diff --git a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Milestone.php b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Milestone.php index 366689ce..9fd5ad3c 100644 --- a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Milestone.php +++ b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Milestone.php @@ -116,9 +116,7 @@ public function url(): UriInterface return $this->url; } - /** - * @psalm-suppress ImpureFunctionCall the {@see \Psl\Iter\all()} API is conditionally pure - */ + /** @psalm-suppress ImpureFunctionCall the {@see \Psl\Iter\all()} API is conditionally pure */ public function assertAllIssuesAreClosed(): void { Psl\invariant(Iter\all($this->entries, static function (IssueOrPullRequest $entry): bool { diff --git a/src/Github/CreateReleaseText.php b/src/Github/CreateReleaseText.php index b3da2f22..88b6ecdb 100644 --- a/src/Github/CreateReleaseText.php +++ b/src/Github/CreateReleaseText.php @@ -12,9 +12,7 @@ interface CreateReleaseText { - /** - * @psalm-param non-empty-string $repositoryDirectory - */ + /** @psalm-param non-empty-string $repositoryDirectory */ public function __invoke( Milestone $milestone, RepositoryName $repositoryName, diff --git a/test/unit/Application/CreateMergeUpPullRequestTest.php b/test/unit/Application/CreateMergeUpPullRequestTest.php index f7f8cc62..5b239d45 100644 --- a/test/unit/Application/CreateMergeUpPullRequestTest.php +++ b/test/unit/Application/CreateMergeUpPullRequestTest.php @@ -77,18 +77,19 @@ protected function setUp(): void $this->createPullRequest, ); - $this->event = MilestoneClosedEvent::fromEventJson(<<<'JSON' -{ - "milestone": { - "title": "1.2.3", - "number": 123 - }, - "repository": { - "full_name": "foo/bar" - }, - "action": "closed" -} -JSON, + $this->event = MilestoneClosedEvent::fromEventJson( + <<<'JSON' + { + "milestone": { + "title": "1.2.3", + "number": 123 + }, + "repository": { + "full_name": "foo/bar" + }, + "action": "closed" + } + JSON, ); $this->branches = MergeTargetCandidateBranches::fromAllBranches( @@ -245,10 +246,10 @@ public function testWillSkipMergeUpPullRequestOnNoMergeUpCandidate(): void self::assertSame(0, $this->command->run(new ArrayInput([]), $output)); self::assertSame( - <<fetch(), ); diff --git a/test/unit/Application/CreateMilestonesTest.php b/test/unit/Application/CreateMilestonesTest.php index 01ca68e8..d1b4db08 100644 --- a/test/unit/Application/CreateMilestonesTest.php +++ b/test/unit/Application/CreateMilestonesTest.php @@ -16,9 +16,7 @@ use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Output\NullOutput; -/** - * @covers \Laminas\AutomaticReleases\Application\Command\CreateMilestones - */ +/** @covers \Laminas\AutomaticReleases\Application\Command\CreateMilestones */ final class CreateMilestonesTest extends TestCase { /** @var LoadCurrentGithubEvent&MockObject */ @@ -45,7 +43,8 @@ protected function setUp(): void $this->createMilestone, ); - $this->event = MilestoneClosedEvent::fromEventJson(<<<'JSON' + $this->event = MilestoneClosedEvent::fromEventJson( + <<<'JSON' { "milestone": { "title": "1.2.3", @@ -56,7 +55,7 @@ protected function setUp(): void }, "action": "closed" } - JSON, + JSON, ); $this->releaseVersion = SemVerVersion::fromMilestoneName('1.2.3'); diff --git a/test/unit/Application/ReleaseCommandTest.php b/test/unit/Application/ReleaseCommandTest.php index d8ed9a01..2fb4f83e 100644 --- a/test/unit/Application/ReleaseCommandTest.php +++ b/test/unit/Application/ReleaseCommandTest.php @@ -87,18 +87,19 @@ protected function setUp(): void $this->createRelease, ); - $this->event = MilestoneClosedEvent::fromEventJson(<<<'JSON' -{ - "milestone": { - "title": "1.2.3", - "number": 123 - }, - "repository": { - "full_name": "foo/bar" - }, - "action": "closed" -} -JSON, + $this->event = MilestoneClosedEvent::fromEventJson( + <<<'JSON' + { + "milestone": { + "title": "1.2.3", + "number": 123 + }, + "repository": { + "full_name": "foo/bar" + }, + "action": "closed" + } + JSON, ); $this->branches = MergeTargetCandidateBranches::fromAllBranches( diff --git a/test/unit/Application/SwitchDefaultBranchToNextMinorTest.php b/test/unit/Application/SwitchDefaultBranchToNextMinorTest.php index a63a576d..48b038e3 100644 --- a/test/unit/Application/SwitchDefaultBranchToNextMinorTest.php +++ b/test/unit/Application/SwitchDefaultBranchToNextMinorTest.php @@ -69,18 +69,19 @@ protected function setUp(): void $this->bumpChangelogVersion, ); - $this->event = MilestoneClosedEvent::fromEventJson(<<<'JSON' -{ - "milestone": { - "title": "1.2.3", - "number": 123 - }, - "repository": { - "full_name": "foo/bar" - }, - "action": "closed" -} -JSON, + $this->event = MilestoneClosedEvent::fromEventJson( + <<<'JSON' + { + "milestone": { + "title": "1.2.3", + "number": 123 + }, + "repository": { + "full_name": "foo/bar" + }, + "action": "closed" + } + JSON, ); $key = (new ImportGpgKeyFromStringViaTemporaryFile()) @@ -239,10 +240,10 @@ public function testWillNotSwitchDefaultBranchIfNoBranchesExist(): void self::assertSame(0, $this->command->run(new ArrayInput([]), $output)); self::assertSame( - <<fetch(), ); diff --git a/test/unit/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelogTest.php b/test/unit/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelogTest.php index 2ee48008..7c4f01b5 100644 --- a/test/unit/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelogTest.php +++ b/test/unit/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelogTest.php @@ -187,9 +187,7 @@ public function testAddsNewReleaseVersionUsingBumpTypeToChangelogFileAndCommitsA ); } - /** - * @psalm-return non-empty-string - */ + /** @psalm-return non-empty-string */ private function createMockChangelog(): string { $repo = Filesystem\create_temporary_file(Env\temp_dir(), 'BumpAndCommitChangelogVersion'); diff --git a/test/unit/Changelog/ChangelogExistsViaConsoleTest.php b/test/unit/Changelog/ChangelogExistsViaConsoleTest.php index 12d2c014..ee0ebc83 100644 --- a/test/unit/Changelog/ChangelogExistsViaConsoleTest.php +++ b/test/unit/Changelog/ChangelogExistsViaConsoleTest.php @@ -39,9 +39,7 @@ public function testReturnsTrueWhenChangelogIsPresentInBranch(): void ); } - /** - * @psalm-return non-empty-string - */ + /** @psalm-return non-empty-string */ private function createMockRepositoryWithChangelog(): string { $repo = Filesystem\create_temporary_file(Env\temp_dir(), 'ChangelogExists'); diff --git a/test/unit/Changelog/ChangelogReleaseNotesTest.php b/test/unit/Changelog/ChangelogReleaseNotesTest.php index eee6e00e..319bc053 100644 --- a/test/unit/Changelog/ChangelogReleaseNotesTest.php +++ b/test/unit/Changelog/ChangelogReleaseNotesTest.php @@ -19,9 +19,7 @@ use function Psl\File\read; use function Psl\File\write; -/** - * @covers \Laminas\AutomaticReleases\Changelog\ChangelogReleaseNotes - */ +/** @covers \Laminas\AutomaticReleases\Changelog\ChangelogReleaseNotes */ class ChangelogReleaseNotesTest extends TestCase { public function testInitialContentsAreThoseProvidedToConstructor(): void @@ -150,9 +148,7 @@ public function releaseNotesProvider(): iterable ]; } - /** - * @dataProvider releaseNotesProvider - */ + /** @dataProvider releaseNotesProvider */ public function testMergedInstanceContainsChangelogEntryFromTheInstanceThatHadOne( ChangelogReleaseNotes $original, ChangelogReleaseNotes $secondary, diff --git a/test/unit/Changelog/ReleaseChangelogViaKeepAChangelogTest.php b/test/unit/Changelog/ReleaseChangelogViaKeepAChangelogTest.php index 4c706c6a..0d340d45 100644 --- a/test/unit/Changelog/ReleaseChangelogViaKeepAChangelogTest.php +++ b/test/unit/Changelog/ReleaseChangelogViaKeepAChangelogTest.php @@ -229,9 +229,7 @@ public function testWritesCommitsAndPushesChangelogWhenFoundAndReadyToRelease(): $this->assertStringNotContainsString($existingChangelog, $contents); } - /** - * @psalm-return non-empty-string - */ + /** @psalm-return non-empty-string */ private function createMockRepositoryWithChangelog( string $template, string $filename = 'CHANGELOG.md', diff --git a/test/unit/Git/Value/BranchNameTest.php b/test/unit/Git/Value/BranchNameTest.php index 08458766..01ae32ba 100644 --- a/test/unit/Git/Value/BranchNameTest.php +++ b/test/unit/Git/Value/BranchNameTest.php @@ -11,9 +11,7 @@ final class BranchNameTest extends TestCase { - /** - * @dataProvider genericBranchNames - */ + /** @dataProvider genericBranchNames */ public function testAllowsAnyBranchName(string $inputName): void { $branch = BranchName::fromName($inputName); @@ -44,9 +42,7 @@ public function testDisallowsEmptyBranchName(): void BranchName::fromName(''); } - /** - * @dataProvider releaseBranches - */ + /** @dataProvider releaseBranches */ public function testDetectsReleaseBranchVersions(string $inputName, int $major, int $minor): void { $branch = BranchName::fromName($inputName); @@ -75,9 +71,7 @@ public function testEquals(): void self::assertTrue(BranchName::fromName('foo')->equals(BranchName::fromName('foo'))); } - /** - * @dataProvider versionEqualityProvider - */ + /** @dataProvider versionEqualityProvider */ public function testIsForVersion(string $milestoneName, string $branchName, bool $expected): void { self::assertSame( @@ -104,9 +98,7 @@ public function versionEqualityProvider(): array ]; } - /** - * @dataProvider newerVersionComparisonProvider - */ + /** @dataProvider newerVersionComparisonProvider */ public function testIsForNewerVersionThan(string $milestoneName, string $branchName, bool $expected): void { self::assertSame( @@ -134,9 +126,7 @@ public function newerVersionComparisonProvider(): array ]; } - /** - * @dataProvider targetVersionProvider - */ + /** @dataProvider targetVersionProvider */ public function testTargetMinorReleaseVersion(string $branchName, string $expectedVersion): void { self::assertEquals( diff --git a/test/unit/Git/Value/SemVerVersionTest.php b/test/unit/Git/Value/SemVerVersionTest.php index 453420b3..b22207bf 100644 --- a/test/unit/Git/Value/SemVerVersionTest.php +++ b/test/unit/Git/Value/SemVerVersionTest.php @@ -11,9 +11,7 @@ final class SemVerVersionTest extends TestCase { - /** - * @dataProvider detectableReleases - */ + /** @dataProvider detectableReleases */ public function testDetectedReleaseVersions( string $milestoneName, int $expectedMajor, @@ -41,9 +39,7 @@ public function detectableReleases(): array ]; } - /** - * @dataProvider invalidReleases - */ + /** @dataProvider invalidReleases */ public function testRejectsInvalidReleaseStrings(string $invalid): void { $this->expectException(InvariantViolationException::class); @@ -67,9 +63,7 @@ public function invalidReleases(): array ]; } - /** - * @dataProvider releaseBranchNames - */ + /** @dataProvider releaseBranchNames */ public function testReleaseBranchNames(string $milestoneName, string $expectedTargetBranch): void { self::assertEquals( @@ -89,9 +83,7 @@ public function releaseBranchNames(): array ]; } - /** - * @dataProvider newMinorReleasesProvider - */ + /** @dataProvider newMinorReleasesProvider */ public function testIsNewMinorRelease(string $milestoneName, bool $expected): void { self::assertSame( @@ -117,9 +109,7 @@ public function newMinorReleasesProvider(): array ]; } - /** - * @dataProvider newMajorReleasesProvider - */ + /** @dataProvider newMajorReleasesProvider */ public function testIsNewMajorRelease(string $milestoneName, bool $expected): void { self::assertSame( @@ -148,9 +138,7 @@ public function newMajorReleasesProvider(): array ]; } - /** - * @dataProvider lessThanEqualProvider - */ + /** @dataProvider lessThanEqualProvider */ public function testLessThanEqual(string $a, string $b, bool $expected): void { self::assertEquals( diff --git a/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/LabelTest.php b/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/LabelTest.php index f50a2f8d..0a368e77 100644 --- a/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/LabelTest.php +++ b/test/unit/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/LabelTest.php @@ -48,9 +48,7 @@ public function testInvalidPayload(array $payload): void Label::fromPayload($payload); } - /** - * @return iterable>> - */ + /** @return iterable>> */ public function provideInvalidPayload(): iterable { yield [ diff --git a/test/unit/Github/Api/GraphQL/RunGraphQLQueryTest.php b/test/unit/Github/Api/GraphQL/RunGraphQLQueryTest.php index baa545b8..a4792abf 100644 --- a/test/unit/Github/Api/GraphQL/RunGraphQLQueryTest.php +++ b/test/unit/Github/Api/GraphQL/RunGraphQLQueryTest.php @@ -51,11 +51,12 @@ public function testSuccessfulRequest(): void { $validResponse = new Response(); - $validResponse->getBody()->write(<<<'JSON' -{ - "data": {"foo": "bar"} -} -JSON, + $validResponse->getBody()->write( + <<<'JSON' + { + "data": {"foo": "bar"} + } + JSON, ); $this @@ -98,11 +99,12 @@ public function testWillThrowIfGraphQLResponseIsNotSuccessful(int $responseCode) $validResponse = (new Response()) ->withStatus($responseCode); - $validResponse->getBody()->write(<<<'JSON' -{ - "data": {"foo": "bar"} -} -JSON, + $validResponse->getBody()->write( + <<<'JSON' + { + "data": {"foo": "bar"} + } + JSON, ); $this @@ -152,12 +154,13 @@ public function testWillThrowIfGraphQLResponseIncludesErrorsInResponse(): void { $validResponse = new Response(); - $validResponse->getBody()->write(<<<'JSON' -{ - "errors": ["nope"], - "data": {"foo": "bar"} -} -JSON, + $validResponse->getBody()->write( + <<<'JSON' + { + "errors": ["nope"], + "data": {"foo": "bar"} + } + JSON, ); $this diff --git a/test/unit/Github/CreateReleaseTextViaKeepAChangelogTest.php b/test/unit/Github/CreateReleaseTextViaKeepAChangelogTest.php index e109824b..384a9a06 100644 --- a/test/unit/Github/CreateReleaseTextViaKeepAChangelogTest.php +++ b/test/unit/Github/CreateReleaseTextViaKeepAChangelogTest.php @@ -172,9 +172,7 @@ private function createMockMilestone(): Milestone ]); } - /** - * @psalm-return non-empty-string - */ + /** @psalm-return non-empty-string */ private function createMockRepositoryWithChangelog( string $template, string $filename = 'CHANGELOG.md', diff --git a/test/unit/Github/MergeMultipleReleaseNotesTest.php b/test/unit/Github/MergeMultipleReleaseNotesTest.php index 57028422..1d3822b4 100644 --- a/test/unit/Github/MergeMultipleReleaseNotesTest.php +++ b/test/unit/Github/MergeMultipleReleaseNotesTest.php @@ -51,9 +51,7 @@ protected function setUp(): void $this->version = SemVerVersion::fromMilestoneName('1.0.1'); } - /** - * @psalm-suppress UnusedVariable - */ + /** @psalm-suppress UnusedVariable */ public function testIndicatesCannotCreateReleaseTextIfNoGeneratorCan(): void { /** @psalm-var non-empty-list $generators */ diff --git a/test/unit/Gpg/SecretKeyIdTest.php b/test/unit/Gpg/SecretKeyIdTest.php index 36e091a2..61cd39e5 100644 --- a/test/unit/Gpg/SecretKeyIdTest.php +++ b/test/unit/Gpg/SecretKeyIdTest.php @@ -10,9 +10,7 @@ final class SecretKeyIdTest extends TestCase { - /** - * @dataProvider invalidKeys - */ + /** @dataProvider invalidKeys */ public function testRejectsInvalidKeyIds(string $invalid): void { $this->expectException(InvariantViolationException::class); @@ -32,9 +30,7 @@ public function invalidKeys(): array ]; } - /** - * @dataProvider validKeys - */ + /** @dataProvider validKeys */ public function testAcceptsValidKeyIds(string $valid): void { self::assertSame( From 3144dfa1849c46f74e7684ac0ea2843fe67bc40f Mon Sep 17 00:00:00 2001 From: George Steel Date: Mon, 29 Aug 2022 11:00:37 +0100 Subject: [PATCH 4/4] CS Fixes - Union types for nullables and constructor property promotion - SlevomatCodingStandard.Classes.RequireConstructorPropertyPromotion - SlevomatCodingStandard.TypeHints.UnionTypeHintFormat Signed-off-by: George Steel --- .../Command/BumpChangelogForReleaseBranch.php | 22 +--- .../Command/CreateMergeUpPullRequest.php | 34 ++---- src/Application/Command/CreateMilestones.php | 10 +- src/Application/Command/ReleaseCommand.php | 42 ++----- .../SwitchDefaultBranchToNextMinor.php | 30 ++--- ...ommitChangelogVersionViaKeepAChangelog.php | 21 +--- src/Changelog/ChangelogReleaseNotes.php | 10 +- ...ommitReleaseChangelogViaKeepAChangelog.php | 21 +--- src/Environment/EnvironmentVariables.php | 37 ++----- ...rentUserByReplacingCurrentOriginRemote.php | 5 +- src/Git/Push.php | 2 +- src/Git/PushViaConsole.php | 2 +- .../Value/MergeTargetCandidateBranches.php | 17 +-- src/Git/Value/SemVerVersion.php | 14 +-- .../GetMilestoneChangelog/Response/Author.php | 12 +- .../Response/IssueOrPullRequest.php | 31 ++---- .../GetMilestoneChangelog/Response/Label.php | 15 +-- .../Response/Milestone.php | 32 ++---- ...MilestoneFirst100IssuesAndPullRequests.php | 103 +++++++++--------- src/Github/Api/GraphQL/RunGraphQLQuery.php | 15 +-- .../Api/V3/CreateMilestoneThroughApiCall.php | 21 +--- .../V3/CreatePullRequestThroughApiCall.php | 15 +-- .../Api/V3/CreateReleaseThroughApiCall.php | 16 +-- .../Api/V3/SetDefaultBranchThroughApiCall.php | 15 +-- .../CreateReleaseTextThroughChangelog.php | 21 ++-- .../CreateReleaseTextViaKeepAChangelog.php | 11 +- ...CurrentGithubEventFromGithubActionPath.php | 5 +- src/Github/Event/MilestoneClosedEvent.php | 13 +-- src/Github/JwageGenerateChangelog.php | 11 +- src/Github/MergeMultipleReleaseNotes.php | 2 +- .../Environment/EnvironmentVariablesTest.php | 2 +- 31 files changed, 174 insertions(+), 433 deletions(-) diff --git a/src/Application/Command/BumpChangelogForReleaseBranch.php b/src/Application/Command/BumpChangelogForReleaseBranch.php index 380845cb..7ab6f29b 100644 --- a/src/Application/Command/BumpChangelogForReleaseBranch.php +++ b/src/Application/Command/BumpChangelogForReleaseBranch.php @@ -18,26 +18,14 @@ final class BumpChangelogForReleaseBranch extends Command { - private Variables $environment; - private LoadCurrentGithubEvent $loadEvent; - private Fetch $fetch; - private GetMergeTargetCandidateBranches $getMergeTargets; - private BumpAndCommitChangelogVersion $bumpChangelogVersion; - public function __construct( - Variables $environment, - LoadCurrentGithubEvent $loadEvent, - Fetch $fetch, - GetMergeTargetCandidateBranches $getMergeTargets, - BumpAndCommitChangelogVersion $bumpChangelogVersion, + private readonly Variables $environment, + private readonly LoadCurrentGithubEvent $loadEvent, + private readonly Fetch $fetch, + private readonly GetMergeTargetCandidateBranches $getMergeTargets, + private readonly BumpAndCommitChangelogVersion $bumpChangelogVersion, ) { parent::__construct('laminas:automatic-releases:bump-changelog'); - - $this->environment = $environment; - $this->loadEvent = $loadEvent; - $this->fetch = $fetch; - $this->getMergeTargets = $getMergeTargets; - $this->bumpChangelogVersion = $bumpChangelogVersion; } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Application/Command/CreateMergeUpPullRequest.php b/src/Application/Command/CreateMergeUpPullRequest.php index 9fe0299e..6c34d334 100644 --- a/src/Application/Command/CreateMergeUpPullRequest.php +++ b/src/Application/Command/CreateMergeUpPullRequest.php @@ -23,35 +23,17 @@ final class CreateMergeUpPullRequest extends Command { - private Variables $variables; - private LoadCurrentGithubEvent $loadGithubEvent; - private Fetch $fetch; - private GetMergeTargetCandidateBranches $getMergeCandidates; - private GetGithubMilestone $getMilestone; - private CreateReleaseText $createReleaseText; - private Push $push; - private CreatePullRequest $createPullRequest; - public function __construct( - Variables $variables, - LoadCurrentGithubEvent $loadGithubEvent, - Fetch $fetch, - GetMergeTargetCandidateBranches $getMergeCandidates, - GetGithubMilestone $getMilestone, - CreateReleaseText $createReleaseText, - Push $push, - CreatePullRequest $createPullRequest, + private readonly Variables $variables, + private readonly LoadCurrentGithubEvent $loadGithubEvent, + private readonly Fetch $fetch, + private readonly GetMergeTargetCandidateBranches $getMergeCandidates, + private readonly GetGithubMilestone $getMilestone, + private readonly CreateReleaseText $createReleaseText, + private readonly Push $push, + private readonly CreatePullRequest $createPullRequest, ) { parent::__construct('laminas:automatic-releases:create-merge-up-pull-request'); - - $this->variables = $variables; - $this->loadGithubEvent = $loadGithubEvent; - $this->fetch = $fetch; - $this->getMergeCandidates = $getMergeCandidates; - $this->getMilestone = $getMilestone; - $this->createReleaseText = $createReleaseText; - $this->push = $push; - $this->createPullRequest = $createPullRequest; } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Application/Command/CreateMilestones.php b/src/Application/Command/CreateMilestones.php index 3c580fd1..d864dcef 100644 --- a/src/Application/Command/CreateMilestones.php +++ b/src/Application/Command/CreateMilestones.php @@ -15,17 +15,11 @@ final class CreateMilestones extends Command { - private LoadCurrentGithubEvent $loadEvent; - private CreateMilestone $createMilestone; - public function __construct( - LoadCurrentGithubEvent $loadEvent, - CreateMilestone $createMilestone, + private readonly LoadCurrentGithubEvent $loadEvent, + private readonly CreateMilestone $createMilestone, ) { parent::__construct('laminas:automatic-releases:create-milestones'); - - $this->loadEvent = $loadEvent; - $this->createMilestone = $createMilestone; } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Application/Command/ReleaseCommand.php b/src/Application/Command/ReleaseCommand.php index 52b35826..af346f5a 100644 --- a/src/Application/Command/ReleaseCommand.php +++ b/src/Application/Command/ReleaseCommand.php @@ -23,41 +23,19 @@ final class ReleaseCommand extends Command { - private Variables $environment; - private LoadCurrentGithubEvent $loadEvent; - private Fetch $fetch; - private GetMergeTargetCandidateBranches $getMergeTargets; - private GetGithubMilestone $getMilestone; - private CommitReleaseChangelog $commitChangelog; - private CreateReleaseText $createChangelogText; - private CreateTag $createTag; - private Push $push; - private CreateRelease $createRelease; - public function __construct( - Variables $environment, - LoadCurrentGithubEvent $loadEvent, - Fetch $fetch, - GetMergeTargetCandidateBranches $getMergeTargets, - GetGithubMilestone $getMilestone, - CommitReleaseChangelog $commitChangelog, - CreateReleaseText $createChangelogText, - CreateTag $createTag, - Push $push, - CreateRelease $createRelease, + private readonly Variables $environment, + private readonly LoadCurrentGithubEvent $loadEvent, + private readonly Fetch $fetch, + private readonly GetMergeTargetCandidateBranches $getMergeTargets, + private readonly GetGithubMilestone $getMilestone, + private readonly CommitReleaseChangelog $commitChangelog, + private readonly CreateReleaseText $createChangelogText, + private readonly CreateTag $createTag, + private readonly Push $push, + private readonly CreateRelease $createRelease, ) { parent::__construct('laminas:automatic-releases:release'); - - $this->environment = $environment; - $this->loadEvent = $loadEvent; - $this->fetch = $fetch; - $this->getMergeTargets = $getMergeTargets; - $this->getMilestone = $getMilestone; - $this->commitChangelog = $commitChangelog; - $this->createChangelogText = $createChangelogText; - $this->createTag = $createTag; - $this->push = $push; - $this->createRelease = $createRelease; } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Application/Command/SwitchDefaultBranchToNextMinor.php b/src/Application/Command/SwitchDefaultBranchToNextMinor.php index 87cfc562..8db1ce59 100644 --- a/src/Application/Command/SwitchDefaultBranchToNextMinor.php +++ b/src/Application/Command/SwitchDefaultBranchToNextMinor.php @@ -19,32 +19,16 @@ final class SwitchDefaultBranchToNextMinor extends Command { - private Variables $variables; - private LoadCurrentGithubEvent $loadGithubEvent; - private Fetch $fetch; - private GetMergeTargetCandidateBranches $getMergeCandidates; - private Push $push; - private SetDefaultBranch $switchDefaultBranch; - private BumpAndCommitChangelogVersion $bumpChangelogVersion; - public function __construct( - Variables $variables, - LoadCurrentGithubEvent $loadGithubEvent, - Fetch $fetch, - GetMergeTargetCandidateBranches $getMergeCandidates, - Push $push, - SetDefaultBranch $switchDefaultBranch, - BumpAndCommitChangelogVersion $bumpChangelogVersion, + private readonly Variables $variables, + private readonly LoadCurrentGithubEvent $loadGithubEvent, + private readonly Fetch $fetch, + private readonly GetMergeTargetCandidateBranches $getMergeCandidates, + private readonly Push $push, + private readonly SetDefaultBranch $switchDefaultBranch, + private readonly BumpAndCommitChangelogVersion $bumpChangelogVersion, ) { parent::__construct('laminas:automatic-releases:switch-default-branch-to-next-minor'); - - $this->variables = $variables; - $this->loadGithubEvent = $loadGithubEvent; - $this->fetch = $fetch; - $this->getMergeCandidates = $getMergeCandidates; - $this->push = $push; - $this->switchDefaultBranch = $switchDefaultBranch; - $this->bumpChangelogVersion = $bumpChangelogVersion; } public function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelog.php b/src/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelog.php index 9ce6bb49..338fbd9b 100644 --- a/src/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelog.php +++ b/src/Changelog/BumpAndCommitChangelogVersionViaKeepAChangelog.php @@ -25,24 +25,13 @@ class BumpAndCommitChangelogVersionViaKeepAChangelog implements BumpAndCommitCha Updates the %s file to add a changelog entry for a new %s version. COMMIT; - private ChangelogExists $changelogExists; - private CheckoutBranch $checkoutBranch; - private CommitFile $commitFile; - private Push $push; - private LoggerInterface $logger; - public function __construct( - ChangelogExists $changelogExists, - CheckoutBranch $checkoutBranch, - CommitFile $commitFile, - Push $push, - LoggerInterface $logger, + private readonly ChangelogExists $changelogExists, + private readonly CheckoutBranch $checkoutBranch, + private readonly CommitFile $commitFile, + private readonly Push $push, + private readonly LoggerInterface $logger, ) { - $this->changelogExists = $changelogExists; - $this->checkoutBranch = $checkoutBranch; - $this->commitFile = $commitFile; - $this->push = $push; - $this->logger = $logger; } public function __invoke( diff --git a/src/Changelog/ChangelogReleaseNotes.php b/src/Changelog/ChangelogReleaseNotes.php index 7c56f0d5..711df2c1 100644 --- a/src/Changelog/ChangelogReleaseNotes.php +++ b/src/Changelog/ChangelogReleaseNotes.php @@ -15,11 +15,6 @@ class ChangelogReleaseNotes { private const CONCATENATION_STRING = "\n\n-----\n\n"; - private ?ChangelogEntry $changelogEntry; - - /** @psalm-var non-empty-string */ - private string $contents; - /** @psalm-param non-empty-string $changelogFile */ public static function writeChangelogFile(string $changelogFile, self $releaseNotes): void { @@ -42,14 +37,13 @@ public static function writeChangelogFile(string $changelogFile, self $releaseNo /** @psalm-param non-empty-string $contents */ public function __construct( - string $contents, - ?ChangelogEntry $changelogEntry = null, + private string $contents, + private ChangelogEntry|null $changelogEntry = null, ) { if ($changelogEntry) { $changelogEntry = clone $changelogEntry; } - $this->contents = $contents; $this->changelogEntry = $changelogEntry; } diff --git a/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php b/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php index 241ded6c..a5beb2ae 100644 --- a/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php +++ b/src/Changelog/CommitReleaseChangelogViaKeepAChangelog.php @@ -24,24 +24,13 @@ final class CommitReleaseChangelogViaKeepAChangelog implements CommitReleaseChan Updates the %s to set the release date. COMMIT; - private ChangelogExists $changelogExists; - private CheckoutBranch $checkoutBranch; - private CommitFile $commitFile; - private Push $push; - private LoggerInterface $logger; - public function __construct( - ChangelogExists $changelogExists, - CheckoutBranch $checkoutBranch, - CommitFile $commitFile, - Push $push, - LoggerInterface $logger, + private readonly ChangelogExists $changelogExists, + private readonly CheckoutBranch $checkoutBranch, + private readonly CommitFile $commitFile, + private readonly Push $push, + private readonly LoggerInterface $logger, ) { - $this->changelogExists = $changelogExists; - $this->checkoutBranch = $checkoutBranch; - $this->commitFile = $commitFile; - $this->push = $push; - $this->logger = $logger; } /** @psalm-param non-empty-string $repositoryDirectory */ diff --git a/src/Environment/EnvironmentVariables.php b/src/Environment/EnvironmentVariables.php index 0b09237d..3906a998 100644 --- a/src/Environment/EnvironmentVariables.php +++ b/src/Environment/EnvironmentVariables.php @@ -33,20 +33,6 @@ class EnvironmentVariables implements Variables 'EMERGENCY', ]; - /** @psalm-var non-empty-string */ - private string $githubToken; - private SecretKeyId $signingSecretKey; - /** @psalm-var non-empty-string */ - private string $gitAuthorName; - /** @psalm-var non-empty-string */ - private string $gitAuthorEmail; - /** @psalm-var non-empty-string */ - private string $githubEventPath; - /** @psalm-var non-empty-string */ - private string $workspacePath; - /** @psalm-var non-empty-string */ - private string $logLevel; - /** * @psalm-param non-empty-string $githubToken * @psalm-param non-empty-string $gitAuthorName @@ -56,29 +42,20 @@ class EnvironmentVariables implements Variables * @psalm-param non-empty-string $logLevel */ private function __construct( - string $githubToken, - SecretKeyId $signingSecretKey, - string $gitAuthorName, - string $gitAuthorEmail, - string $githubEventPath, - string $workspacePath, - string $logLevel, + private readonly string $githubToken, + private readonly SecretKeyId $signingSecretKey, + private readonly string $gitAuthorName, + private readonly string $gitAuthorEmail, + private readonly string $githubEventPath, + private readonly string $workspacePath, + private readonly string $logLevel, ) { - $this->githubToken = $githubToken; - $this->signingSecretKey = $signingSecretKey; - $this->gitAuthorName = $gitAuthorName; - $this->gitAuthorEmail = $gitAuthorEmail; - $this->githubEventPath = $githubEventPath; - $this->workspacePath = $workspacePath; - /** @psalm-suppress ImpureFunctionCall the {@see \Psl\Iter\contains()} API is conditionally pure */ Psl\invariant( Iter\contains(self::LOG_LEVELS, $logLevel), 'LOG_LEVEL env MUST be a valid monolog/monolog log level constant name or value;' . ' see https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels', ); - - $this->logLevel = $logLevel; } public static function fromEnvironment(ImportGpgKeyFromString $importKey): self diff --git a/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php b/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php index f34c97ec..23c51514 100644 --- a/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php +++ b/src/Git/FetchAndSetCurrentUserByReplacingCurrentOriginRemote.php @@ -12,11 +12,8 @@ final class FetchAndSetCurrentUserByReplacingCurrentOriginRemote implements Fetch { - private EnvironmentVariables $variables; - - public function __construct(EnvironmentVariables $variables) + public function __construct(private readonly EnvironmentVariables $variables) { - $this->variables = $variables; } public function __invoke( diff --git a/src/Git/Push.php b/src/Git/Push.php index 1d50a0dd..db0c7db9 100644 --- a/src/Git/Push.php +++ b/src/Git/Push.php @@ -14,6 +14,6 @@ interface Push public function __invoke( string $repositoryDirectory, string $symbol, - ?string $alias = null, + string|null $alias = null, ): void; } diff --git a/src/Git/PushViaConsole.php b/src/Git/PushViaConsole.php index 98f2c54a..7627275e 100644 --- a/src/Git/PushViaConsole.php +++ b/src/Git/PushViaConsole.php @@ -12,7 +12,7 @@ final class PushViaConsole implements Push public function __invoke( string $repositoryDirectory, string $symbol, - ?string $alias = null, + string|null $alias = null, ): void { if ($alias === null) { Shell\execute('git', ['push', 'origin', $symbol], $repositoryDirectory); diff --git a/src/Git/Value/MergeTargetCandidateBranches.php b/src/Git/Value/MergeTargetCandidateBranches.php index d731d53f..c8c2f610 100644 --- a/src/Git/Value/MergeTargetCandidateBranches.php +++ b/src/Git/Value/MergeTargetCandidateBranches.php @@ -13,18 +13,11 @@ final class MergeTargetCandidateBranches { /** - * @var BranchName[] branches that can be used for releases, sorted in ascending version number - * @psalm-var list - */ - private array $sortedBranches; - - /** - * @param BranchName[] $sortedBranches + * @param BranchName[] $sortedBranches branches that can be used for releases, sorted in ascending version number * @psalm-param list $sortedBranches */ - private function __construct(array $sortedBranches) + private function __construct(private readonly array $sortedBranches) { - $this->sortedBranches = $sortedBranches; } public static function fromAllBranches(BranchName ...$branches): self @@ -40,7 +33,7 @@ public static function fromAllBranches(BranchName ...$branches): self return new self($mergeTargetBranches); } - public function targetBranchFor(SemVerVersion $version): ?BranchName + public function targetBranchFor(SemVerVersion $version): BranchName|null { foreach ($this->sortedBranches as $branch) { if ($branch->isForNewerVersionThan($version)) { @@ -55,7 +48,7 @@ public function targetBranchFor(SemVerVersion $version): ?BranchName return null; } - public function branchToMergeUp(SemVerVersion $version): ?BranchName + public function branchToMergeUp(SemVerVersion $version): BranchName|null { $targetBranch = $this->targetBranchFor($version); @@ -77,7 +70,7 @@ public function branchToMergeUp(SemVerVersion $version): ?BranchName : $branch; } - public function newestReleaseBranch(): ?BranchName + public function newestReleaseBranch(): BranchName|null { return Iter\first(Vec\reverse($this->sortedBranches)); } diff --git a/src/Git/Value/SemVerVersion.php b/src/Git/Value/SemVerVersion.php index ec758905..d1032e69 100644 --- a/src/Git/Value/SemVerVersion.php +++ b/src/Git/Value/SemVerVersion.php @@ -10,15 +10,11 @@ /** @psalm-immutable */ final class SemVerVersion { - private int $major; - private int $minor; - private int $patch; - - private function __construct(int $major, int $minor, int $patch) - { - $this->major = $major; - $this->minor = $minor; - $this->patch = $patch; + private function __construct( + private readonly int $major, + private readonly int $minor, + private readonly int $patch, + ) { } /** diff --git a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Author.php b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Author.php index e1e96f9b..6fa0a932 100644 --- a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Author.php +++ b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/Author.php @@ -10,15 +10,11 @@ final class Author { - /** @psalm-var non-empty-string */ - private string $name; - private UriInterface $url; - /** @psalm-param non-empty-string $name */ - private function __construct(string $name, UriInterface $url) - { - $this->name = $name; - $this->url = $url; + private function __construct( + private readonly string $name, + private readonly UriInterface $url, + ) { } /** @param array $payload */ diff --git a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequest.php b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequest.php index 7d39371d..f1f05dc1 100644 --- a/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequest.php +++ b/src/Github/Api/GraphQL/Query/GetMilestoneChangelog/Response/IssueOrPullRequest.php @@ -12,36 +12,19 @@ /** @psalm-immutable */ final class IssueOrPullRequest { - private int $number; - /** @psalm-var non-empty-string */ - private string $title; - private Author $author; - /** - * @var array - * @psalm-var list