Skip to content

Commit ec530d4

Browse files
authored
Merge pull request #125 from peter279k/3.x-patch
Add the 3.x Patch
2 parents 2650a53 + 01cee2d commit ec530d4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+143
-97
lines changed

.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run:
7+
runs-on: ${{ matrix.operating-system }}
8+
strategy:
9+
matrix:
10+
operating-system: [ubuntu-latest]
11+
php-versions: ['7.2', '7.3', '7.4', '8.0', '8.1']
12+
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v1
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php-versions }}
22+
extensions: mbstring, intl, zip, xml
23+
coverage: none
24+
25+
- name: Install dependencies
26+
run: composer install -n
27+
28+
- name: Run test suite
29+
run: vendor/bin/phpunit --exclude-group github_action
30+
31+
- name: Run demo script
32+
run: example/demo meta --zsh commit arg 0 suggestions && example/demo meta --zsh commit arg 1 valid-values && example/demo zsh --bind demo > zsh

.travis.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"getopt"
1212
],
1313
"require": {
14-
"php": ">=5.3.0",
14+
"php": ">=7.2",
1515
"corneltek/getoptionkit": "^2",
1616
"corneltek/class-template": "^2",
1717
"corneltek/universal": ">= 1.4",
@@ -23,7 +23,8 @@
2323
"require-dev": {
2424
"corneltek/phpunit-testmore": "dev-master",
2525
"satooshi/php-coveralls": "^1",
26-
"phpunit/phpunit": "^4.8 || ^5.7"
26+
"phpunit/phpunit": "^8.5 || ^9.5",
27+
"ext-intl": "*"
2728
},
2829
"license": "MIT",
2930
"authors": [

src/Command/ArchiveCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function options($opts)
6464
->defaultValue(true)
6565
;
6666

67-
$opts->add('c|compress?', 'compress type: gz, bz2')
67+
$opts->add('compress?', 'compress type: gz, bz2')
6868
->defaultValue('gz')
6969
->validValues(array('gz', 'bz2'))
7070
;

src/CommandBase.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,26 +895,31 @@ public function choose($prompt, $choices)
895895
return $chooser->choose( $prompt, $choices );
896896
}
897897

898+
#[\ReturnTypeWillChange]
898899
public function offsetExists($key)
899900
{
900901
return isset($this->commands[$key]);
901902
}
902903

904+
#[\ReturnTypeWillChange]
903905
public function offsetSet($key,$value)
904906
{
905907
$this->commands[$key] = $value;
906908
}
907909

910+
#[\ReturnTypeWillChange]
908911
public function offsetGet($key)
909912
{
910913
return $this->commands[$key];
911914
}
912915

916+
#[\ReturnTypeWillChange]
913917
public function offsetUnset($key)
914918
{
915919
unset($this->commands[$key]);
916920
}
917921

922+
#[\ReturnTypeWillChange]
918923
public function getIterator()
919924
{
920925
return new ArrayIterator($this->commands);

src/Completion/ZshGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function option_flag_item(Option $opt, $cmdSignature) {
187187
// output description
188188
$str .= "[" . addcslashes($opt->desc,'[]:') . "]";
189189

190-
$placeholder = ($opt->valueName) ? $opt->valueName : $opt->isa ? $opt->isa : null;
190+
$placeholder = (($opt->valueName) ? $opt->valueName : $opt->isa) ? $opt->isa : null;
191191

192192
// has anything to complete
193193
if ($opt->validValues || $opt->suggestions || $opt->isa) {

src/Component/Table/Table.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ private function getNumberOfColumns()
128128

129129
$columns = array(count($this->headers));
130130
foreach ($this->rows as $row) {
131+
if (!is_array($row)) {
132+
$row = [];
133+
}
131134
$columns[] = count($row);
132135
}
133136
return $this->numberOfColumns = max($columns);

src/OptionPrinter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace CLIFramework;
1212
use GetOptionKit\OptionCollection;
1313
use GetOptionKit\Option;
14-
use GetOptionKit\OptionPrinter\OptionPrinterInterface;
14+
use GetOptionKit\OptionPrinter\OptionPrinter as OptionPrinterInterface;
1515
use CLIFramework\Formatter;
1616

1717
class OptionPrinter implements OptionPrinterInterface

src/Testing/CommandTestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
namespace CLIFramework\Testing;
3-
use PHPUnit_Framework_TestCase;
3+
use PHPUnit\Framework\TestCase;
44

5-
abstract class CommandTestCase extends PHPUnit_Framework_TestCase
5+
abstract class CommandTestCase extends TestCase
66
{
77
public $app;
88

@@ -15,15 +15,15 @@ public function getApplication()
1515
return $this->app;
1616
}
1717

18-
public function setUp()
18+
protected function setUp(): void
1919
{
2020
if ($this->outputBufferingActive) {
2121
ob_start();
2222
}
2323
$this->app = $this->setupApplication();
2424
}
2525

26-
public function tearDown()
26+
protected function tearDown(): void
2727
{
2828
$this->app = NULL;
2929
if ($this->outputBufferingActive) {

src/Testing/ConsoleTestCase.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22
namespace CLIFramework\Testing;
33

4-
class ConsoleTestCase extends \PHPUnit_Framework_TestCase
4+
use PHPUnit\Framework\TestCase;
5+
6+
class ConsoleTestCase extends TestCase
57
{
68
protected function runScript($path, $input, $callback)
79
{
@@ -21,7 +23,7 @@ protected function runScript($path, $input, $callback)
2123
@fclose($pipes[0]);
2224
@fclose($pipes[1]);
2325
@fclose($pipes[2]);
24-
@pclose($process);
26+
@proc_close($process);
2527
$callback($content);
2628
}
2729
}

0 commit comments

Comments
 (0)