diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 97a2562..693c415 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -15,9 +15,6 @@ jobs:
- operating-system: ubuntu-latest
php: 7.3
phpunit: 8
- - operating-system: ubuntu-latest
- php: 7.4
- phpunit: 8
- operating-system: ubuntu-latest
php: 8.1
phpunit: 9
@@ -36,8 +33,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- - name: PHPUnit Tests
- uses: php-actions/phpunit@v3
+ - uses: php-actions/phpunit@v3
with:
configuration: phpunit.xml.dist
version: ${{ matrix.phpunit }}
diff --git a/.gitignore b/.gitignore
index 8256bc1..8323baa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,5 @@
/bin/git-scan.phar
/bin/phpunit
/extern
+/dist
+/tmp
diff --git a/composer.json b/composer.json
index e495c02..abc23a6 100644
--- a/composer.json
+++ b/composer.json
@@ -10,9 +10,9 @@
],
"require": {
"php": ">=7.3.0",
- "symfony/console": "^4.4",
- "symfony/process": "^4.4",
- "symfony/filesystem": "^4.4",
+ "symfony/console": "~5.4",
+ "symfony/process": "~5.4",
+ "symfony/filesystem": "~5.4",
"symfony/finder": "^4.4",
"civicrm/composer-downloads-plugin": "~3.0"
},
diff --git a/composer.lock b/composer.lock
index b7b0a75..c89acac 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": "59bae10d7028af1914a2558243ed6135",
+ "content-hash": "c42314448bb7b0a90262853b464891ee",
"packages": [
{
"name": "civicrm/composer-downloads-plugin",
@@ -106,43 +106,46 @@
},
{
"name": "symfony/console",
- "version": "v4.4.43",
+ "version": "v5.4.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "8a2628d2d5639f35113dc1b833ecd91e1ed1cf46"
+ "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/8a2628d2d5639f35113dc1b833ecd91e1ed1cf46",
- "reference": "8a2628d2d5639f35113dc1b833ecd91e1ed1cf46",
+ "url": "https://api.github.com/repos/symfony/console/zipball/c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed",
+ "reference": "c4ba980ca61a9eb18ee6bcc73f28e475852bb1ed",
"shasum": ""
},
"require": {
- "php": ">=7.1.3",
+ "php": ">=7.2.5",
+ "symfony/deprecation-contracts": "^2.1|^3",
"symfony/polyfill-mbstring": "~1.0",
- "symfony/polyfill-php73": "^1.8",
+ "symfony/polyfill-php73": "^1.9",
"symfony/polyfill-php80": "^1.16",
- "symfony/service-contracts": "^1.1|^2"
+ "symfony/service-contracts": "^1.1|^2|^3",
+ "symfony/string": "^5.1|^6.0"
},
"conflict": {
"psr/log": ">=3",
- "symfony/dependency-injection": "<3.4",
- "symfony/event-dispatcher": "<4.3|>=5",
+ "symfony/dependency-injection": "<4.4",
+ "symfony/dotenv": "<5.1",
+ "symfony/event-dispatcher": "<4.4",
"symfony/lock": "<4.4",
- "symfony/process": "<3.3"
+ "symfony/process": "<4.4"
},
"provide": {
"psr/log-implementation": "1.0|2.0"
},
"require-dev": {
"psr/log": "^1|^2",
- "symfony/config": "^3.4|^4.0|^5.0",
- "symfony/dependency-injection": "^3.4|^4.0|^5.0",
- "symfony/event-dispatcher": "^4.3",
- "symfony/lock": "^4.4|^5.0",
- "symfony/process": "^3.4|^4.0|^5.0",
- "symfony/var-dumper": "^4.3|^5.0"
+ "symfony/config": "^4.4|^5.0|^6.0",
+ "symfony/dependency-injection": "^4.4|^5.0|^6.0",
+ "symfony/event-dispatcher": "^4.4|^5.0|^6.0",
+ "symfony/lock": "^4.4|^5.0|^6.0",
+ "symfony/process": "^4.4|^5.0|^6.0",
+ "symfony/var-dumper": "^4.4|^5.0|^6.0"
},
"suggest": {
"psr/log": "For using the console logger",
@@ -175,6 +178,15 @@
],
"description": "Eases the creation of beautiful and testable command line interfaces",
"homepage": "https://symfony.com",
+ "keywords": [
+ "cli",
+ "command-line",
+ "console",
+ "terminal"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/console/tree/v5.4.47"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -189,7 +201,7 @@
"type": "tidelift"
}
],
- "time": "2022-06-23T12:22:25+00:00"
+ "time": "2024-11-06T11:30:55+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -257,23 +269,27 @@
},
{
"name": "symfony/filesystem",
- "version": "v4.4.42",
+ "version": "v5.4.45",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5"
+ "reference": "57c8294ed37d4a055b77057827c67f9558c95c54"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/815412ee8971209bd4c1eecd5f4f481eacd44bf5",
- "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/57c8294ed37d4a055b77057827c67f9558c95c54",
+ "reference": "57c8294ed37d4a055b77057827c67f9558c95c54",
"shasum": ""
},
"require": {
- "php": ">=7.1.3",
+ "php": ">=7.2.5",
"symfony/polyfill-ctype": "~1.8",
+ "symfony/polyfill-mbstring": "~1.8",
"symfony/polyfill-php80": "^1.16"
},
+ "require-dev": {
+ "symfony/process": "^5.4|^6.4"
+ },
"type": "library",
"autoload": {
"psr-4": {
@@ -299,6 +315,9 @@
],
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/filesystem/tree/v5.4.45"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -313,7 +332,7 @@
"type": "tidelift"
}
],
- "time": "2022-05-20T08:49:14+00:00"
+ "time": "2024-10-22T13:05:35+00:00"
},
{
"name": "symfony/finder",
@@ -376,20 +395,20 @@
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.26.0",
+ "version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
- "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4"
+ "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
- "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
+ "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
+ "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": ""
},
"require": {
- "php": ">=7.1"
+ "php": ">=7.2"
},
"provide": {
"ext-ctype": "*"
@@ -399,12 +418,9 @@
},
"type": "library",
"extra": {
- "branch-alias": {
- "dev-main": "1.26-dev"
- },
"thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
+ "url": "https://github.com/symfony/polyfill",
+ "name": "symfony/polyfill"
}
},
"autoload": {
@@ -437,6 +453,9 @@
"polyfill",
"portable"
],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -451,40 +470,122 @@
"type": "tidelift"
}
],
- "time": "2022-05-24T11:49:31+00:00"
+ "time": "2024-09-09T11:45:10+00:00"
},
{
- "name": "symfony/polyfill-mbstring",
- "version": "v1.1.1",
+ "name": "symfony/polyfill-intl-grapheme",
+ "version": "v1.31.0",
"source": {
"type": "git",
- "url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "1289d16209491b584839022f29257ad859b8532d"
+ "url": "https://github.com/symfony/polyfill-intl-grapheme.git",
+ "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/1289d16209491b584839022f29257ad859b8532d",
- "reference": "1289d16209491b584839022f29257ad859b8532d",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe",
+ "reference": "b9123926e3b7bc2f98c02ad54f6a4b02b91a8abe",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=7.2"
},
"suggest": {
- "ext-mbstring": "For best performance"
+ "ext-intl": "For best performance"
},
"type": "library",
"extra": {
- "branch-alias": {
- "dev-master": "1.1-dev"
+ "thanks": {
+ "url": "https://github.com/symfony/polyfill",
+ "name": "symfony/polyfill"
}
},
"autoload": {
+ "files": [
+ "bootstrap.php"
+ ],
"psr-4": {
- "Symfony\\Polyfill\\Mbstring\\": ""
+ "Symfony\\Polyfill\\Intl\\Grapheme\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for intl's grapheme_* functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "grapheme",
+ "intl",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.31.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
},
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-09-09T11:45:10+00:00"
+ },
+ {
+ "name": "symfony/polyfill-intl-normalizer",
+ "version": "v1.31.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
+ "reference": "3833d7255cc303546435cb650316bff708a1c75c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c",
+ "reference": "3833d7255cc303546435cb650316bff708a1c75c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2"
+ },
+ "suggest": {
+ "ext-intl": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "thanks": {
+ "url": "https://github.com/symfony/polyfill",
+ "name": "symfony/polyfill"
+ }
+ },
+ "autoload": {
"files": [
"bootstrap.php"
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Intl\\Normalizer\\": ""
+ },
+ "classmap": [
+ "Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
@@ -501,6 +602,87 @@
"homepage": "https://symfony.com/contributors"
}
],
+ "description": "Symfony polyfill for intl's Normalizer class and related functions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "intl",
+ "normalizer",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-09-09T11:45:10+00:00"
+ },
+ {
+ "name": "symfony/polyfill-mbstring",
+ "version": "v1.31.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
+ "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
+ "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2"
+ },
+ "provide": {
+ "ext-mbstring": "*"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "thanks": {
+ "url": "https://github.com/symfony/polyfill",
+ "name": "symfony/polyfill"
+ }
+ },
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ],
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
@@ -510,7 +692,24 @@
"portable",
"shim"
],
- "time": "2016-01-20T09:13:37+00:00"
+ "support": {
+ "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-php73",
@@ -590,29 +789,26 @@
},
{
"name": "symfony/polyfill-php80",
- "version": "v1.26.0",
+ "version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
- "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
+ "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
- "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
+ "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
+ "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"shasum": ""
},
"require": {
- "php": ">=7.1"
+ "php": ">=7.2"
},
"type": "library",
"extra": {
- "branch-alias": {
- "dev-main": "1.26-dev"
- },
"thanks": {
- "name": "symfony/polyfill",
- "url": "https://github.com/symfony/polyfill"
+ "url": "https://github.com/symfony/polyfill",
+ "name": "symfony/polyfill"
}
},
"autoload": {
@@ -652,6 +848,9 @@
"portable",
"shim"
],
+ "support": {
+ "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -666,24 +865,24 @@
"type": "tidelift"
}
],
- "time": "2022-05-10T07:21:04+00:00"
+ "time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/process",
- "version": "v4.4.41",
+ "version": "v5.4.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "9eedd60225506d56e42210a70c21bb80ca8456ce"
+ "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/9eedd60225506d56e42210a70c21bb80ca8456ce",
- "reference": "9eedd60225506d56e42210a70c21bb80ca8456ce",
+ "url": "https://api.github.com/repos/symfony/process/zipball/5d1662fb32ebc94f17ddb8d635454a776066733d",
+ "reference": "5d1662fb32ebc94f17ddb8d635454a776066733d",
"shasum": ""
},
"require": {
- "php": ">=7.1.3",
+ "php": ">=7.2.5",
"symfony/polyfill-php80": "^1.16"
},
"type": "library",
@@ -711,6 +910,9 @@
],
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/process/tree/v5.4.47"
+ },
"funding": [
{
"url": "https://symfony.com/sponsor",
@@ -725,7 +927,7 @@
"type": "tidelift"
}
],
- "time": "2022-04-04T10:19:07+00:00"
+ "time": "2024-11-06T11:36:42+00:00"
},
{
"name": "symfony/service-contracts",
@@ -807,6 +1009,92 @@
],
"time": "2022-05-30T19:17:29+00:00"
},
+ {
+ "name": "symfony/string",
+ "version": "v5.4.47",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/string.git",
+ "reference": "136ca7d72f72b599f2631aca474a4f8e26719799"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799",
+ "reference": "136ca7d72f72b599f2631aca474a4f8e26719799",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2.5",
+ "symfony/polyfill-ctype": "~1.8",
+ "symfony/polyfill-intl-grapheme": "~1.0",
+ "symfony/polyfill-intl-normalizer": "~1.0",
+ "symfony/polyfill-mbstring": "~1.0",
+ "symfony/polyfill-php80": "~1.15"
+ },
+ "conflict": {
+ "symfony/translation-contracts": ">=3.0"
+ },
+ "require-dev": {
+ "symfony/error-handler": "^4.4|^5.0|^6.0",
+ "symfony/http-client": "^4.4|^5.0|^6.0",
+ "symfony/translation-contracts": "^1.1|^2",
+ "symfony/var-exporter": "^4.4|^5.0|^6.0"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "Resources/functions.php"
+ ],
+ "psr-4": {
+ "Symfony\\Component\\String\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "grapheme",
+ "i18n",
+ "string",
+ "unicode",
+ "utf-8",
+ "utf8"
+ ],
+ "support": {
+ "source": "https://github.com/symfony/string/tree/v5.4.47"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-11-10T20:33:58+00:00"
+ },
{
"name": "togos/gitignore",
"version": "1.1.1",
diff --git a/src/GitScan/Command/AutoMergeCommand.php b/src/GitScan/Command/AutoMergeCommand.php
index 71fabaa..4a9e5db 100644
--- a/src/GitScan/Command/AutoMergeCommand.php
+++ b/src/GitScan/Command/AutoMergeCommand.php
@@ -70,7 +70,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getOption('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$registeredSources = json_decode(file_get_contents(dirname(__DIR__) . '/AutoMergeRule.json'), 1);
$rules = array();
foreach ($this->getPatchExprs($input, $output) as $expr) {
@@ -122,6 +122,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
if (!empty($rules)) {
return 1;
}
+
+ return 0;
}
/**
diff --git a/src/GitScan/Command/BranchCommand.php b/src/GitScan/Command/BranchCommand.php
index afb5e4d..f7486eb 100644
--- a/src/GitScan/Command/BranchCommand.php
+++ b/src/GitScan/Command/BranchCommand.php
@@ -44,7 +44,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getOption('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('delete') || $input->getOption('force-delete')) {
return $this->executeDelete($input, $output);
}
@@ -53,7 +53,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}
}
- protected function executeCreate(InputInterface $input, OutputInterface $output) {
+ protected function executeCreate(InputInterface $input, OutputInterface $output): int {
if (!$input->getArgument('head')) {
throw new \RuntimeException("Missing argument \"head\". Please specify the name of original base branch.");
}
@@ -97,9 +97,10 @@ function (GitRepo $gitRepo, $oldBranch, $newBranch) use ($input, $output, $helpe
});
$batch->runAllOk($output, $input->getOption('dry-run'));
+ return 0;
}
- protected function executeDelete(InputInterface $input, OutputInterface $output) {
+ protected function executeDelete(InputInterface $input, OutputInterface $output): int {
$helper = $this->getHelper('question');
$scanner = new \GitScan\GitRepoScanner();
$gitRepos = $scanner->scan($input->getOption('path'));
@@ -131,6 +132,7 @@ protected function executeDelete(InputInterface $input, OutputInterface $output)
}
$batch->runAllOk($output, $input->getOption('dry-run'));
+ return 0;
}
}
diff --git a/src/GitScan/Command/DiffCommand.php b/src/GitScan/Command/DiffCommand.php
index 249a97b..6546238 100644
--- a/src/GitScan/Command/DiffCommand.php
+++ b/src/GitScan/Command/DiffCommand.php
@@ -45,7 +45,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getArgument('to'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$fromDoc = $this->getCheckoutDocument($input->getArgument('from'));
$toDoc = $this->getCheckoutDocument($input->getArgument('to'));
@@ -82,6 +82,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln('Unsupported output format');
return 1;
}
+ return 0;
}
/**
diff --git a/src/GitScan/Command/ExportCommand.php b/src/GitScan/Command/ExportCommand.php
index 0c77f42..244a339 100644
--- a/src/GitScan/Command/ExportCommand.php
+++ b/src/GitScan/Command/ExportCommand.php
@@ -34,12 +34,12 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getArgument('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$scanner = new \GitScan\GitRepoScanner();
$paths = $input->getArgument('path');
if (count($paths) != 1) {
$output->writeln('Expected only one root path');
- return;
+ return 1;
}
$gitRepos = $scanner->scan($paths);
@@ -48,6 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
->importRepos($gitRepos)
->toJson()
);
+ return 0;
}
}
diff --git a/src/GitScan/Command/ForeachCommand.php b/src/GitScan/Command/ForeachCommand.php
index ccf565a..8ee1809 100644
--- a/src/GitScan/Command/ForeachCommand.php
+++ b/src/GitScan/Command/ForeachCommand.php
@@ -58,7 +58,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getArgument('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
if (!$input->getOption('command')) {
$output->writeln("Missing required option: --command");
return 1;
@@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$output->writeln("[[ {$gitRepo->getPath()} ]]");
}
- $process = new \Symfony\Component\Process\Process($input->getOption('command'));
+ $process = \Symfony\Component\Process\Process::fromShellCommandline($input->getOption('command'));
$process->setWorkingDirectory($gitRepo->getPath());
// $process->setEnv(...); sucks in Debian/Ubuntu
Env::set('path', $this->fs->makePathRelative($gitRepo->getPath(), $topLevel));
diff --git a/src/GitScan/Command/HashCommand.php b/src/GitScan/Command/HashCommand.php
index d2f2142..a978354 100644
--- a/src/GitScan/Command/HashCommand.php
+++ b/src/GitScan/Command/HashCommand.php
@@ -34,15 +34,16 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getArgument('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$scanner = new \GitScan\GitRepoScanner();
$paths = $input->getArgument('path');
if (count($paths) != 1) {
$output->writeln('Expected only one root path');
- return;
+ return 1;
}
$output->writeln($scanner->hash($paths[0]));
+ return 0;
}
}
diff --git a/src/GitScan/Command/LsCommand.php b/src/GitScan/Command/LsCommand.php
index 44b6d84..bd9d549 100644
--- a/src/GitScan/Command/LsCommand.php
+++ b/src/GitScan/Command/LsCommand.php
@@ -39,12 +39,12 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getArgument('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$scanner = new \GitScan\GitRepoScanner();
$paths = $input->getArgument('path');
if (count($paths) != 1) {
$output->writeln('Expected only one root path');
- return;
+ return 1;
}
$gitRepos = $scanner->scan($paths);
@@ -56,6 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$path = rtrim($path, '/');
$output->writeln($path);
}
+ return 0;
}
}
diff --git a/src/GitScan/Command/PushCommand.php b/src/GitScan/Command/PushCommand.php
index da30583..0a987c6 100644
--- a/src/GitScan/Command/PushCommand.php
+++ b/src/GitScan/Command/PushCommand.php
@@ -40,7 +40,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getOption('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$scanner = new \GitScan\GitRepoScanner();
$gitRepos = $scanner->scan($input->getOption('path'));
$remote = $input->getArgument('remote');
@@ -80,6 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}
$batch->runAllOk($output, $input->getOption('dry-run'));
+ return 0;
}
}
diff --git a/src/GitScan/Command/StatusCommand.php b/src/GitScan/Command/StatusCommand.php
index e18a741..d0ca61d 100644
--- a/src/GitScan/Command/StatusCommand.php
+++ b/src/GitScan/Command/StatusCommand.php
@@ -45,7 +45,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getArgument('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$output->writeln("[[ Finding repositories ]]");
$scanner = new \GitScan\GitRepoScanner();
$gitRepos = $scanner->scan($input->getArgument('path'));
@@ -143,6 +143,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
$output->writeln("NOTE: Omitted information about $hiddenCount repo(s). To display all, use --status=all.");
}
}
+ return 0;
}
public function getUniqueChars($items) {
diff --git a/src/GitScan/Command/TagCommand.php b/src/GitScan/Command/TagCommand.php
index becdd81..1cc942a 100644
--- a/src/GitScan/Command/TagCommand.php
+++ b/src/GitScan/Command/TagCommand.php
@@ -43,7 +43,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getOption('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('delete')) {
return $this->executeDelete($input, $output);
}
@@ -52,7 +52,7 @@ protected function execute(InputInterface $input, OutputInterface $output) {
}
}
- protected function executeCreate(InputInterface $input, OutputInterface $output) {
+ protected function executeCreate(InputInterface $input, OutputInterface $output): int {
if (!$input->getArgument('head')) {
throw new \RuntimeException("Missing argument \"head\". Please specify the name of original base branch.");
}
@@ -96,9 +96,10 @@ function (GitRepo $gitRepo, $oldBranch, $newTag) use ($input, $output, $helper,
});
$batch->runAllOk($output, $input->getOption('dry-run'));
+ return 0;
}
- protected function executeDelete(InputInterface $input, OutputInterface $output) {
+ protected function executeDelete(InputInterface $input, OutputInterface $output): int {
$scanner = new \GitScan\GitRepoScanner();
$gitRepos = $scanner->scan($input->getOption('path'));
$batch = new ProcessBatch('Deleting branch(es)...');
@@ -128,6 +129,7 @@ protected function executeDelete(InputInterface $input, OutputInterface $output)
}
$batch->runAllOk($output, $input->getOption('dry-run'));
+ return 0;
}
}
diff --git a/src/GitScan/Command/UpdateCommand.php b/src/GitScan/Command/UpdateCommand.php
index bb4a59e..3a6a5d1 100644
--- a/src/GitScan/Command/UpdateCommand.php
+++ b/src/GitScan/Command/UpdateCommand.php
@@ -35,7 +35,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) {
$this->fs->validateExists($input->getArgument('path'));
}
- protected function execute(InputInterface $input, OutputInterface $output) {
+ protected function execute(InputInterface $input, OutputInterface $output): int {
$statusCode = 0;
$output->writeln("[[ Finding repositories ]]");
diff --git a/src/GitScan/Exception/ProcessErrorException.php b/src/GitScan/Exception/ProcessErrorException.php
index 9c0366d..e7828d5 100644
--- a/src/GitScan/Exception/ProcessErrorException.php
+++ b/src/GitScan/Exception/ProcessErrorException.php
@@ -7,7 +7,7 @@ class ProcessErrorException extends \RuntimeException {
*/
private $process;
- public function __construct(\Symfony\Component\Process\Process $process, $message = "", $code = 0, Exception $previous = NULL) {
+ public function __construct(\Symfony\Component\Process\Process $process, $message = "", $code = 0, ?\Throwable $previous = NULL) {
$this->process = $process;
if (empty($message)) {
$message = $this->createReport($process);
diff --git a/src/GitScan/GitRepo.php b/src/GitScan/GitRepo.php
index c24b3a2..208d889 100644
--- a/src/GitScan/GitRepo.php
+++ b/src/GitScan/GitRepo.php
@@ -499,7 +499,7 @@ public function initClone($upstream, ?string $branch = NULL): void {
* @return \Symfony\Component\Process\Process
*/
public function command($command) {
- $process = new \Symfony\Component\Process\Process($command);
+ $process = \Symfony\Component\Process\Process::fromShellCommandline($command);
$process->setWorkingDirectory($this->getPath());
return $process;
}
diff --git a/src/GitScan/GitRepoScanner.php b/src/GitScan/GitRepoScanner.php
index dd5521b..5e48dbf 100644
--- a/src/GitScan/GitRepoScanner.php
+++ b/src/GitScan/GitRepoScanner.php
@@ -20,7 +20,7 @@ class GitRepoScanner {
* @param FileSystem $fs
* @param \GitScan\Config|NULL $config
*/
- public function __construct($fs = NULL, \GitScan\Config $config = NULL) {
+ public function __construct($fs = NULL, ?\GitScan\Config $config = NULL) {
$this->fs = $fs ?: new Filesystem();
$this->config = $config ?: Config::load();
}
diff --git a/tests/GitScan/GitScanTestCase.php b/tests/GitScan/GitScanTestCase.php
index 64ca63f..d4377a1 100644
--- a/tests/GitScan/GitScanTestCase.php
+++ b/tests/GitScan/GitScanTestCase.php
@@ -51,7 +51,7 @@ public function tearDown(): void {
* @param string $command
*/
protected function command($subdir, $command) {
- $process = new \Symfony\Component\Process\Process($command);
+ $process = \Symfony\Component\Process\Process::fromShellCommandline($command);
if ($subdir !== NULL && $subdir !== "") {
$process->setWorkingDirectory($subdir);
}
diff --git a/tests/GitScan/Util/ProcessTest.php b/tests/GitScan/Util/ProcessTest.php
index 09858d4..dd51346 100644
--- a/tests/GitScan/Util/ProcessTest.php
+++ b/tests/GitScan/Util/ProcessTest.php
@@ -6,13 +6,13 @@
class ProcessTest extends \GitScan\GitScanTestCase {
public function testRunOk_pass() {
- $process = ProcessUtil::runOk(new \Symfony\Component\Process\Process("echo times were good"));
+ $process = ProcessUtil::runOk(\Symfony\Component\Process\Process::fromShellCommandline("echo times were good"));
$this->assertEquals("times were good", trim($process->getOutput()));
}
public function testRunOk_fail() {
try {
- ProcessUtil::runOk(new \Symfony\Component\Process\Process("echo tragedy befell the software > /dev/stderr; exit 1"));
+ ProcessUtil::runOk(\Symfony\Component\Process\Process::fromShellCommandline("echo tragedy befell the software > /dev/stderr; exit 1"));
$this->fail("Failed to generate expected exception");
}
catch (\GitScan\Exception\ProcessErrorException $e) {