Commit 15249ad8 authored by Jakub Konečný's avatar Jakub Konečný

used typed properties

parent 646ddd2a
Pipeline #186321390 passed with stage
in 49 seconds
Version 2.3.0-dev
- raised minimal version of PHP to 7.4
- used typed properties (possible BC break)
Version 2.2.0
- raised minimal version of PHP to 7.3
......
......@@ -23,7 +23,7 @@
"nette/application": "^3.0",
"nette/utils": "^3.0",
"latte/latte": "^2.5 || ^3.0",
"nexendrie/utils": "^1.7",
"nexendrie/utils": "^1.8",
"symfony/polyfill-php80": "^1.18"
},
"require-dev": {
......
......@@ -14,18 +14,14 @@ namespace Nexendrie\BookComponent;
* @method void onRender(BookControl $book, string $page)
*/
class BookControl extends \Nette\Application\UI\Control {
/** @var string */
private $presenterName;
/** @var string */
private $folder;
private string $presenterName;
private string $folder;
/** @var callable|BookPagesStorage */
protected $pages;
/** @var string */
protected $indexTemplate = __DIR__ . "/bookIndex.latte";
/** @var string */
protected $pageTemplate = __DIR__ . "/bookPage.latte";
protected string $indexTemplate = __DIR__ . "/bookIndex.latte";
protected string $pageTemplate = __DIR__ . "/bookPage.latte";
/** @var callable[] */
public $onRender = [];
public array $onRender = [];
public function __construct(string $presenterName, string $folder) {
$this->presenterName = $presenterName;
......
......@@ -11,12 +11,10 @@ namespace Nexendrie\BookComponent;
*/
class BookPage {
use \Nette\SmartObject;
/** @var string */
protected $slug;
/** @var string */
protected $title;
protected string $slug;
protected string $title;
/** @var array of [IBookPageCondition, string] */
protected $conditions = [];
protected array $conditions = [];
public function __construct(string $slug, string $title) {
$this->slug = $slug;
......
......@@ -9,10 +9,8 @@ use Nexendrie\Utils\Collection;
* @author Jakub Konečný
*/
final class BookPagesStorage extends Collection {
/** @var string */
protected $class = BookPage::class;
/** @var string */
protected $uniqueProperty = "slug";
protected string $class = BookPage::class;
protected ?string $uniqueProperty = "slug";
public function hasPage(string $slug): bool {
return $this->hasItems(["slug" => $slug, "allowed" => true]);
......
......@@ -15,8 +15,7 @@ require __DIR__ . "/../../bootstrap.php";
* @testCase
*/
final class BookControlTest extends \Tester\TestCase {
/** @var BookControl */
private $control;
private BookControl $control;
use \Testbench\TComponent;
use \Testbench\TCompiledContainer;
......
......@@ -14,8 +14,7 @@ require __DIR__ . "/../../bootstrap.php";
* @testCase
*/
final class BookPageTest extends \Tester\TestCase {
/** @var BookPage */
private $page;
private BookPage $page;
protected function setUp() {
$this->page = new BookPage("slug", "title");
......
......@@ -14,8 +14,7 @@ require __DIR__ . "/../../bootstrap.php";
* @testCase
*/
final class BookPagesStorageTest extends \Tester\TestCase {
/** @var BookPagesStorage */
private $storage;
private BookPagesStorage $storage;
protected function setUp() {
$this->storage = new BookPagesStorage();
......
......@@ -13,9 +13,8 @@ require __DIR__ . "/../../bootstrap.php";
*/
final class ConditionCallbackTest extends \Tester\TestCase {
use \Testbench\TCompiledContainer;
/** @var ConditionCallback */
protected $condition;
protected ConditionCallback $condition;
public function setUp() {
$this->condition = $this->getService(ConditionCallback::class);
......
......@@ -13,9 +13,8 @@ require __DIR__ . "/../../bootstrap.php";
*/
final class ConditionPermissionTest extends \Tester\TestCase {
use \Testbench\TCompiledContainer;
/** @var ConditionPermission */
protected $condition;
protected ConditionPermission $condition;
public function setUp() {
$this->condition = $this->getService(ConditionPermission::class);
......
......@@ -14,9 +14,8 @@ require __DIR__ . "/../../bootstrap.php";
*/
final class ConditionUserInRoleTest extends \Tester\TestCase {
use \Testbench\TCompiledContainer;
/** @var ConditionUserInRole */
protected $condition;
protected ConditionUserInRole $condition;
public function setUp() {
$this->condition = $this->getService(ConditionUserInRole::class);
......
......@@ -13,9 +13,8 @@ require __DIR__ . "/../../bootstrap.php";
*/
final class ConditionUserLoggedInTest extends \Tester\TestCase {
use \Testbench\TCompiledContainer;
/** @var ConditionUserLoggedIn */
protected $condition;
protected ConditionUserLoggedIn $condition;
public function setUp() {
$this->condition = $this->getService(ConditionUserLoggedIn::class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment