Skip to content

Commit

Permalink
Merge pull request #253 from php-school/strict-types
Browse files Browse the repository at this point in the history
Add strict_types everywhere
  • Loading branch information
AydinHassan authored Dec 16, 2021
2 parents 112d36f + c5bf170 commit bad5e01
Show file tree
Hide file tree
Showing 95 changed files with 131 additions and 29 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip

### Removed

## [4.3.0]
### Fixed
- PHP 8.1 Support (#252, #249)

### Added
- declare(strict_types=1) everywhere

## [4.2.0]
### Added
- Yes/no comfirmation dialogue (#248)
- Yes/no confirmation dialogue (#248)
- Ability to add multiple checkbox and radio items (#241)

## [4.1.0]
Expand Down
1 change: 1 addition & 0 deletions examples/ascii-art.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/basic-centered.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/basic-separation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/basic.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/borders.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/checkbox-item.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/confirm-cancellable.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/confirm.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/crazy-redraw.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/crazy-separation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/custom-item-register.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\Builder\SplitItemBuilder;
use PhpSchool\CliMenu\CliMenu;
Expand Down
1 change: 1 addition & 0 deletions examples/custom-mapping.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/custom-styles.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/disabled-items.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/draw.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\Action\ExitAction;
use PhpSchool\CliMenu\Builder\SplitItemBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/flash.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/input-advanced.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/input-custom.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/input-number.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/input-password.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/input-text.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/item-extra-toggling.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/item-extra.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/nested-submenu.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/radio-item.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/redraw.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/remove-defaults.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/shortcuts.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\Builder\SplitItemBuilder;
use PhpSchool\CliMenu\CliMenu;
Expand Down
1 change: 1 addition & 0 deletions examples/split-checkbox-item.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\Builder\SplitItemBuilder;
use PhpSchool\CliMenu\CliMenu;
Expand Down
1 change: 1 addition & 0 deletions examples/split-item.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\Builder\SplitItemBuilder;
use PhpSchool\CliMenu\CliMenu;
Expand Down
1 change: 1 addition & 0 deletions examples/split-radio-item.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\Builder\SplitItemBuilder;
use PhpSchool\CliMenu\CliMenu;
Expand Down
1 change: 1 addition & 0 deletions examples/submenu.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions examples/useful-separation.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

use PhpSchool\CliMenu\CliMenu;
use PhpSchool\CliMenu\Builder\CliMenuBuilder;
Expand Down
1 change: 1 addition & 0 deletions src/Action/ExitAction.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Action;

Expand Down
1 change: 1 addition & 0 deletions src/Action/GoBackAction.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Action;

Expand Down
1 change: 1 addition & 0 deletions src/Builder/CliMenuBuilder.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Builder;

Expand Down
1 change: 1 addition & 0 deletions src/Builder/SplitItemBuilder.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Builder;

Expand Down
1 change: 1 addition & 0 deletions src/CliMenu.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu;

Expand Down
1 change: 1 addition & 0 deletions src/Dialogue/CancellableConfirm.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Dialogue;

Expand Down
1 change: 1 addition & 0 deletions src/Dialogue/Confirm.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Dialogue;

Expand Down
1 change: 1 addition & 0 deletions src/Dialogue/Dialogue.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Dialogue;

Expand Down
1 change: 1 addition & 0 deletions src/Dialogue/Flash.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Dialogue;

Expand Down
1 change: 1 addition & 0 deletions src/Exception/InvalidShortcutException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Exception;

Expand Down
1 change: 1 addition & 0 deletions src/Exception/InvalidTerminalException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Exception;

Expand Down
1 change: 1 addition & 0 deletions src/Exception/MenuNotOpenException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Exception;

Expand Down
1 change: 1 addition & 0 deletions src/Frame.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu;

Expand Down
1 change: 1 addition & 0 deletions src/Input/Input.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Input;

Expand Down
1 change: 1 addition & 0 deletions src/Input/InputIO.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Input;

Expand Down
1 change: 1 addition & 0 deletions src/Input/InputResult.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Input;

Expand Down
5 changes: 3 additions & 2 deletions src/Input/Number.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Input;

Expand Down Expand Up @@ -92,11 +93,11 @@ public function setValidator(callable $validator) : Input
public function ask() : InputResult
{
$this->inputIO->registerControlCallback(InputCharacter::UP, function (string $input) {
return $this->validate($input) ? (int) $input + 1 : $input;
return $this->validate($input) ? (string) ((int) $input + 1) : $input;
});

$this->inputIO->registerControlCallback(InputCharacter::DOWN, function (string $input) {
return $this->validate($input) ? (int) $input - 1 : $input;
return $this->validate($input) ? (string) ((int) $input - 1) : $input;
});

return $this->inputIO->collect($this);
Expand Down
1 change: 1 addition & 0 deletions src/Input/Password.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Input;

Expand Down
1 change: 1 addition & 0 deletions src/Input/Text.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\Input;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/AsciiArtItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/CheckboxItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/LineBreakItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/MenuItemInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/MenuMenuItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/RadioItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/SelectableItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/SplitItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
1 change: 1 addition & 0 deletions src/MenuItem/StaticItem.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);

namespace PhpSchool\CliMenu\MenuItem;

Expand Down
Loading

0 comments on commit bad5e01

Please sign in to comment.