Skip to content

Commit

Permalink
Update the coding standards using phpcbf
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan3dc committed Oct 30, 2024
1 parent 4869248 commit 540f61e
Show file tree
Hide file tree
Showing 30 changed files with 84 additions and 64 deletions.
1 change: 1 addition & 0 deletions src/Argument/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace League\CLImate\Argument;

use League\CLImate\Exceptions\UnexpectedValueException;

use function is_array;

class Argument
Expand Down
2 changes: 1 addition & 1 deletion src/Decorator/Component/BackgroundColor.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class BackgroundColor extends Color
*
* @const integer ADD
*/
const ADD = 10;
public const ADD = 10;

/**
* Get the code for the requested color
Expand Down
3 changes: 2 additions & 1 deletion src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Psr\Log\AbstractLogger;
use Psr\Log\InvalidArgumentException;
use Psr\Log\LogLevel;

use function array_key_exists;
use function is_array;
use function str_replace;
Expand Down Expand Up @@ -50,7 +51,7 @@ public function __construct($level = LogLevel::INFO, CLImate $climate = null)
$this->level = $this->convertLevel($level);

if ($climate === null) {
$climate = new CLImate;
$climate = new CLImate();
}
$this->climate = $climate;

Expand Down
4 changes: 3 additions & 1 deletion src/TerminalObject/Basic/BasicTerminalObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

abstract class BasicTerminalObject implements BasicTerminalObjectInterface
{
use SettingsImporter, ParserImporter, UtilImporter;
use SettingsImporter;
use ParserImporter;
use UtilImporter;

/**
* Set the property if there is a valid value
Expand Down
2 changes: 1 addition & 1 deletion src/TerminalObject/Basic/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ protected function buildHeaderRow()
$header_row = $this->getHeaderRow();
if ($header_row) {
$this->addLine($this->buildRow($header_row));
$this->addLine((new Border)->char('=')->length($this->table_width)->result());
$this->addLine((new Border())->char('=')->length($this->table_width)->result());
}
}

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 @@ -138,7 +138,7 @@ protected function setSleeper($sleeper = null)
*/
protected function setKeyFrames($keyframes)
{
$this->keyframes = $keyframes ?: new Keyframe;
$this->keyframes = $keyframes ?: new Keyframe();
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/TerminalObject/Dynamic/Animation/Keyframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

class Keyframe
{
use StringLength, ParserImporter, UtilImporter;
use StringLength;
use ParserImporter;
use UtilImporter;

/**
* Get the enter keyframes for the desired direction
Expand Down
4 changes: 3 additions & 1 deletion src/TerminalObject/Dynamic/Checkbox/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

class Checkbox
{
use StringLength, ParserImporter, UtilImporter;
use StringLength;
use ParserImporter;
use UtilImporter;

/**
* The value of the checkbox
Expand Down
6 changes: 4 additions & 2 deletions src/TerminalObject/Dynamic/Checkbox/CheckboxGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

class CheckboxGroup
{
use OutputImporter, ParserImporter, UtilImporter;
use OutputImporter;
use ParserImporter;
use UtilImporter;

protected $checkboxes = [];

Expand Down Expand Up @@ -136,7 +138,7 @@ protected function getCurrent()
*/
protected function getCurrentKey($direction, $option, $key)
{
$method = 'get' . ucwords($direction). 'Key';
$method = 'get' . ucwords($direction) . 'Key';

return $this->{$method}($option, $key);
}
Expand Down
10 changes: 5 additions & 5 deletions src/TerminalObject/Dynamic/Checkboxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ protected function handleCharacter($char)
case "\n":
$this->output->sameLine()->write($this->util->cursor->defaultStyle());
$this->output->sameLine()->write("\e[0m");
return true; // Break the while loop as well
return true; // Break the while loop as well

case "\e":
$this->handleAnsi();
break;
break;

case ' ':
$this->checkboxes->toggleCurrent();
break;
break;
}

return false;
Expand All @@ -136,12 +136,12 @@ protected function handleAnsi()
// Up arrow
case '[A':
$this->checkboxes->setCurrent('previous');
break;
break;

// Down arrow
case '[B':
$this->checkboxes->setCurrent('next');
break;
break;
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/TerminalObject/Dynamic/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
namespace League\CLImate\TerminalObject\Dynamic;

use League\CLImate\Util\Reader\ReaderInterface;

use function in_array;
use function strtolower;
use function substr;

class Confirm extends Input
{


/**
* @inheritdoc
*/
Expand Down
5 changes: 4 additions & 1 deletion src/TerminalObject/Dynamic/DynamicTerminalObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@

abstract class DynamicTerminalObject implements DynamicTerminalObjectInterface
{
use SettingsImporter, ParserImporter, OutputImporter, UtilImporter;
use SettingsImporter;
use ParserImporter;
use OutputImporter;
use UtilImporter;
}
1 change: 1 addition & 0 deletions src/TerminalObject/Dynamic/Spinner.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace League\CLImate\TerminalObject\Dynamic;

use League\CLImate\Exceptions\UnexpectedValueException;

use function array_merge;
use function count;
use function microtime;
Expand Down
5 changes: 4 additions & 1 deletion src/TerminalObject/Router/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

class Router
{
use ParserImporter, SettingsImporter, OutputImporter, UtilImporter;
use ParserImporter;
use SettingsImporter;
use OutputImporter;
use UtilImporter;

/**
* An instance of the Settings Manager class
Expand Down
6 changes: 3 additions & 3 deletions src/Util/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ class Output

public function __construct()
{
$this->add('out', new Writer\StdOut);
$this->add('error', new Writer\StdErr);
$this->add('buffer', new Writer\Buffer);
$this->add('out', new Writer\StdOut());
$this->add('error', new Writer\StdErr());
$this->add('buffer', new Writer\Buffer());

$this->defaultTo('out');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Util/System/Windows.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function systemHasAnsiSupport()
return (function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT))
|| false !== getenv('ANSICON')
|| 'ON' === getenv('ConEmuANSI')
|| 'Hyper' === getenv('TERM_PROGRAM')
|| 'Hyper' === getenv('TERM_PROGRAM')
|| 'xterm' === getenv('TERM');
}
}
6 changes: 5 additions & 1 deletion tests/Animation/AnimationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

class AnimationTest extends TestBase
{
use ExitToTopFrames, ExitToBottomFrames, ExitToLeftFrames, ExitToRightFrames, RunFrames;
use ExitToTopFrames;
use ExitToBottomFrames;
use ExitToLeftFrames;
use ExitToRightFrames;
use RunFrames;


private function addArt(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/Argument/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ManagerTest extends TestCase

public function setUp(): void
{
$this->manager = new Manager;
$this->manager = new Manager();
}


Expand Down
2 changes: 1 addition & 1 deletion tests/ArgumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function it_throws_an_exception_when_building_arguments_from_an_unknown_t
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage("Please provide an argument name or object.");

$this->cli->arguments->add(new \stdClass);
$this->cli->arguments->add(new \stdClass());
}

protected function getFullArguments()
Expand Down
16 changes: 8 additions & 8 deletions tests/BufferTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class BufferTest extends TestBase
/** @test */
public function it_can_buffer_content()
{
$buffer = new Buffer;
$output = new Output;
$buffer = new Buffer();
$output = new Output();
$output->add('buffer', $buffer);
$output->defaultTo('buffer');

Expand All @@ -23,8 +23,8 @@ public function it_can_buffer_content()
/** @test */
public function it_can_buffer_content_without_a_new_line()
{
$buffer = new Buffer;
$output = new Output;
$buffer = new Buffer();
$output = new Output();
$output->add('buffer', $buffer);
$output->defaultTo('buffer');

Expand All @@ -36,8 +36,8 @@ public function it_can_buffer_content_without_a_new_line()
/** @test */
public function it_can_buffer_multiple_lines()
{
$buffer = new Buffer;
$output = new Output;
$buffer = new Buffer();
$output = new Output();
$output->add('buffer', $buffer);
$output->defaultTo('buffer');

Expand All @@ -50,8 +50,8 @@ public function it_can_buffer_multiple_lines()
/** @test */
public function it_can_clean_buffered_content()
{
$buffer = new Buffer;
$output = new Output;
$buffer = new Buffer();
$output = new Output();
$output->add('buffer', $buffer);
$output->defaultTo('buffer');

Expand Down
4 changes: 2 additions & 2 deletions tests/CLImateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function it_can_be_extended_using_a_basic_object()
$this->shouldWrite("\e[mThis just outputs this.\e[0m");
$this->shouldHavePersisted();

$this->cli->extend(new BasicObject);
$this->cli->extend(new BasicObject());
$this->cli->basicObject();
}

Expand All @@ -83,7 +83,7 @@ public function it_can_be_extended_using_a_basic_object_with_argument_setter()
$this->shouldWrite("\e[mHey: This is the thing that will print to the console.\e[0m");
$this->shouldHavePersisted();

$this->cli->extend(new BasicObjectArgument);
$this->cli->extend(new BasicObjectArgument());
$this->cli->basicObjectArgument('This is the thing that will print to the console.');
}

Expand Down
12 changes: 6 additions & 6 deletions tests/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function it_can_write_to_a_file()
->with($this->file->url(), 'a')
->andReturn(fopen($this->file->url(), 'a'));

$output = new Output;
$output = new Output();
$output->add('file', $file);
$output->defaultTo('file');

Expand All @@ -49,7 +49,7 @@ public function it_will_accept_a_resource()
{
$resource = fopen($this->file->url(), 'a');
$file = $this->getFileMock($resource);
$output = new Output;
$output = new Output();
$output->add('file', $file);
$output->defaultTo('file');

Expand All @@ -74,7 +74,7 @@ public function it_can_lock_the_file()

$file->lock();

$output = new Output;
$output = new Output();
$output->add('file', $file);
$output->defaultTo('file');

Expand Down Expand Up @@ -120,7 +120,7 @@ public function it_will_yell_when_a_non_writable_resource_is_passed()
$this->expectExceptionMessage("is not writable");

$file = $this->getFileMock($this->file->url());
$output = new Output;
$output = new Output();
$output->add('file', $file);
$output->defaultTo('file');

Expand All @@ -134,7 +134,7 @@ public function it_will_yell_when_a_non_existent_resource_is_passed()
$this->expectExceptionMessage("The resource [something-that-doesnt-exist] is not writable");

$file = $this->getFileMock('something-that-doesnt-exist');
$output = new Output;
$output = new Output();
$output->add('file', $file);
$output->defaultTo('file');

Expand All @@ -154,7 +154,7 @@ public function it_will_yell_when_it_failed_to_open_a_resource()
->with($this->file->url(), 'a')
->andReturn(false);

$output = new Output;
$output = new Output();
$output->add('file', $file);
$output->defaultTo('file');

Expand Down
2 changes: 1 addition & 1 deletion tests/LoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function tearDown(): void

public function testConstructor1()
{
$logger = new Logger;
$logger = new Logger();
$this->assertInstanceOf(LoggerInterface::class, $logger);
$this->assertInstanceOf(Logger::class, $logger);
}
Expand Down
Loading

0 comments on commit 540f61e

Please sign in to comment.