1
0
mirror of https://github.com/thephpleague/climate.git synced 2025-09-04 19:45:49 +02:00

Add support for PHP 8.4

This commit is contained in:
Craig Duncan
2024-11-18 09:09:55 +00:00
parent 39d0bf433f
commit 237f70e103
13 changed files with 30 additions and 16 deletions

View File

@@ -19,6 +19,7 @@ jobs:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
composer:
- ""
- "--prefer-lowest"

View File

@@ -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

View File

@@ -142,7 +142,7 @@ class Manager
*
* @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)) {
@@ -217,7 +217,7 @@ class Manager
* @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)
@@ -232,7 +232,7 @@ class Manager
*
* @param array $argv
*/
public function parse(array $argv = null)
public function parse(?array $argv = null)
{
$this->parser->setFilter($this->filter, $this->all());

View File

@@ -68,7 +68,7 @@ class Parser
* @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);
@@ -103,7 +103,7 @@ class Parser
*
* @return string
*/
public function command(array $argv = null)
public function command(?array $argv = null)
{
return $this->getCommandAndArguments($argv)['command'];
}
@@ -115,7 +115,7 @@ class Parser
*
* @return array
*/
public function arguments(array $argv = null)
public function arguments(?array $argv = null)
{
return $this->getCommandAndArguments($argv)['arguments'];
}
@@ -315,7 +315,7 @@ class Parser
* @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)) {

View File

@@ -257,7 +257,7 @@ class CLImate
* @param array $argv
* @return void
*/
public function usage(array $argv = null)
public function usage(?array $argv = null)
{
$this->arguments->usage($this, $argv);
}

View File

@@ -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);

View File

@@ -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');

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -169,7 +169,7 @@ class Progress extends DynamicTerminalObject
* @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);

View File

@@ -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();

View File

@@ -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();