Skip to content

Commit

Permalink
Add support for PHP 8.4
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan3dc committed Nov 18, 2024
1 parent 39d0bf4 commit 237f70e
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 16 deletions.
1 change: 1 addition & 0 deletions .github/workflows/buildcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
composer:
- ""
- "--prefer-lowest"
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Changelog
=========

Adds methods in Progress to return the current value and total value of the progress bar. (#206)
--------

## 3.10.0 - 2024-11-18

### Added

* [Progress] Added methods to get the current and total values. [#206](https://github.com/thephpleague/climate/pull/206)

### Changed

* [Support] Added support for PHP 8.4.

--------

## 3.9.0 - 2024-10-30
Expand Down
6 changes: 3 additions & 3 deletions src/Argument/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function all()
*
* @return bool
*/
public function defined($name, array $argv = null)
public function defined($name, ?array $argv = null)
{
// The argument isn't defined if it's not defined by the calling code.
if (!$this->exists($name)) {
Expand Down Expand Up @@ -217,7 +217,7 @@ public function description($description)
* @param CLImate $climate
* @param array $argv
*/
public function usage(CLImate $climate, array $argv = null)
public function usage(CLImate $climate, ?array $argv = null)
{
$this->summary
->setClimate($climate)
Expand All @@ -232,7 +232,7 @@ public function usage(CLImate $climate, array $argv = null)
*
* @param array $argv
*/
public function parse(array $argv = null)
public function parse(?array $argv = null)
{
$this->parser->setFilter($this->filter, $this->all());

Expand Down
8 changes: 4 additions & 4 deletions src/Argument/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function setFilter($filter, $arguments)
* @return void
* @throws InvalidArgumentException if required arguments aren't defined.
*/
public function parse(array $argv = null)
public function parse(?array $argv = null)
{
$cliArguments = $this->arguments($argv);

Expand Down Expand Up @@ -103,7 +103,7 @@ public function parse(array $argv = null)
*
* @return string
*/
public function command(array $argv = null)
public function command(?array $argv = null)
{
return $this->getCommandAndArguments($argv)['command'];
}
Expand All @@ -115,7 +115,7 @@ public function command(array $argv = null)
*
* @return array
*/
public function arguments(array $argv = null)
public function arguments(?array $argv = null)
{
return $this->getCommandAndArguments($argv)['arguments'];
}
Expand Down Expand Up @@ -315,7 +315,7 @@ protected function findPrefixedArgument($name)
* @param array $argv
* @return array
*/
protected function getCommandAndArguments(array $argv = null)
protected function getCommandAndArguments(?array $argv = null)
{
// If no $argv is provided then use the global PHP defined $argv.
if (is_null($argv)) {
Expand Down
2 changes: 1 addition & 1 deletion src/CLImate.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public function to($writer)
* @param array $argv
* @return void
*/
public function usage(array $argv = null)
public function usage(?array $argv = null)
{
$this->arguments->usage($this, $argv);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Logger extends AbstractLogger
* @param string $level One of the LogLevel constants
* @param CLImate $climate An existing CLImate instance to use for output
*/
public function __construct($level = LogLevel::INFO, CLImate $climate = null)
public function __construct($level = LogLevel::INFO, ?CLImate $climate = null)
{
$this->level = $this->convertLevel($level);

Expand Down
2 changes: 1 addition & 1 deletion src/TerminalObject/Dynamic/Animation.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Animation extends DynamicTerminalObject
*/
protected $keyframes;

public function __construct($art, Sleeper $sleeper = null, Keyframe $keyframes = null)
public function __construct($art, ?Sleeper $sleeper = null, ?Keyframe $keyframes = null)
{
// Add the default art directory
$this->addDir(__DIR__ . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . '..' . \DIRECTORY_SEPARATOR . 'ASCII');
Expand Down
2 changes: 1 addition & 1 deletion src/TerminalObject/Dynamic/Checkboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Checkboxes extends InputAbstract
*/
protected $checkboxes;

public function __construct($prompt, array $options, ReaderInterface $reader = null)
public function __construct($prompt, array $options, ?ReaderInterface $reader = null)
{
$this->prompt = $prompt;
$this->reader = $reader ?: new Stdin();
Expand Down
2 changes: 1 addition & 1 deletion src/TerminalObject/Dynamic/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Confirm extends Input
/**
* @inheritdoc
*/
public function __construct($prompt, ReaderInterface $reader = null)
public function __construct($prompt, ?ReaderInterface $reader = null)
{
parent::__construct($prompt, $reader);

Expand Down
2 changes: 1 addition & 1 deletion src/TerminalObject/Dynamic/Input.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Input extends InputAbstract
*/
protected $default = '';

public function __construct($prompt, ReaderInterface $reader = null)
public function __construct($prompt, ?ReaderInterface $reader = null)
{
$this->prompt = $prompt;
$this->reader = $reader ?: new Stdin();
Expand Down
2 changes: 1 addition & 1 deletion src/TerminalObject/Dynamic/Progress.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public function forceRedraw($force = true)
* @param iterable $items Array or any other iterable object
* @param callable $callback A handler to run on each item
*/
public function each($items, callable $callback = null)
public function each($items, ?callable $callback = null)
{
if ($items instanceof \Traversable) {
$items = iterator_to_array($items);
Expand Down
2 changes: 1 addition & 1 deletion src/TerminalObject/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Router
*/
protected $basic;

public function __construct(DynamicRouter $dynamic = null, BasicRouter $basic = null)
public function __construct(?DynamicRouter $dynamic = null, ?BasicRouter $basic = null)
{
$this->dynamic = $dynamic ?: new DynamicRouter();
$this->basic = $basic ?: new BasicRouter();
Expand Down
2 changes: 1 addition & 1 deletion src/Util/UtilFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class UtilFactory
*/
public $cursor;

public function __construct(System $system = null, Cursor $cursor = null)
public function __construct(?System $system = null, ?Cursor $cursor = null)
{
$this->system = $system ?: SystemFactory::getInstance();
$this->cursor = $cursor ?: new Cursor();
Expand Down

0 comments on commit 237f70e

Please sign in to comment.