Skip to content

Commit 1904b58

Browse files
author
Martin Brecht-Precht
committed
Language level migration.
1 parent a2750ee commit 1904b58

23 files changed

+170
-167
lines changed

composer.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
2-
"name": "markdom/model-interface",
3-
"type": "library",
4-
"description": "Markdom domain model interfaces written in PHP",
5-
"keywords": [
6-
"Markdom",
7-
"Model",
8-
"Interface"
9-
],
10-
"homepage": "http://markenwerk.net/",
11-
"license": "MIT",
12-
"authors": [
13-
{
14-
"name": "Martin Brecht-Precht",
15-
"email": "mb@markenwerk.net",
16-
"homepage": "http://markenwerk.net"
17-
}
18-
],
19-
"autoload": {
20-
"psr-4": {
21-
"Markdom\\ModelInterface\\": "src"
22-
}
23-
},
24-
"require": {
25-
"php": ">=5.3",
26-
"markdom/handler-interface": "^1.0.3"
27-
}
2+
"name": "markdom/model-interface",
3+
"type": "library",
4+
"description": "Markdom domain model interfaces written in PHP",
5+
"keywords": [
6+
"Markdom",
7+
"Model",
8+
"Interface"
9+
],
10+
"homepage": "http://markenwerk.net/",
11+
"license": "MIT",
12+
"authors": [
13+
{
14+
"name": "Martin Brecht-Precht",
15+
"email": "mb@markenwerk.net",
16+
"homepage": "http://markenwerk.net"
17+
}
18+
],
19+
"autoload": {
20+
"psr-4": {
21+
"Markdom\\ModelInterface\\": "src"
22+
}
23+
},
24+
"require": {
25+
"php": "^7.1",
26+
"markdom/handler-interface": "^1.1"
27+
}
2828
}

src/Block/BlockInterface.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,25 @@
1616
interface BlockInterface extends NodeInterface
1717
{
1818

19-
const TYPE_CODE = BlockType::TYPE_CODE;
20-
const TYPE_COMMENT = BlockType::TYPE_COMMENT;
21-
const TYPE_DIVISION = BlockType::TYPE_DIVISION;
22-
const TYPE_HEADING = BlockType::TYPE_HEADING;
23-
const TYPE_UNORDERED_LIST = BlockType::TYPE_UNORDERED_LIST;
24-
const TYPE_ORDERED_LIST = BlockType::TYPE_ORDERED_LIST;
25-
const TYPE_LIST_ITEM = BlockType::TYPE_LIST_ITEM;
26-
const TYPE_PARAGRAPH = BlockType::TYPE_PARAGRAPH;
27-
const TYPE_QUOTE = BlockType::TYPE_QUOTE;
19+
public const TYPE_CODE = BlockType::TYPE_CODE;
20+
public const TYPE_COMMENT = BlockType::TYPE_COMMENT;
21+
public const TYPE_DIVISION = BlockType::TYPE_DIVISION;
22+
public const TYPE_HEADING = BlockType::TYPE_HEADING;
23+
public const TYPE_UNORDERED_LIST = BlockType::TYPE_UNORDERED_LIST;
24+
public const TYPE_ORDERED_LIST = BlockType::TYPE_ORDERED_LIST;
25+
public const TYPE_LIST_ITEM = BlockType::TYPE_LIST_ITEM;
26+
public const TYPE_PARAGRAPH = BlockType::TYPE_PARAGRAPH;
27+
public const TYPE_QUOTE = BlockType::TYPE_QUOTE;
2828

2929
/**
3030
* @return string
3131
*/
32-
public function getBlockType();
32+
public function getBlockType(): string;
3333

3434
/**
3535
* @return BlockInterface
3636
*/
37-
public function getBlock();
37+
public function getBlock(): BlockInterface;
3838

3939
/**
4040
* @param BlockParentInterface $blockParent
@@ -50,12 +50,12 @@ public function onDetach();
5050
/**
5151
* @return BlockParentInterface
5252
*/
53-
public function getParent();
53+
public function getParent(): BlockParentInterface;
5454

5555
/**
5656
* @param HandlerInterface $markdomHandler
5757
* @return void
5858
*/
59-
public function onHandle(HandlerInterface $markdomHandler);
59+
public function onHandle(HandlerInterface $markdomHandler): void;
6060

6161
}

src/Block/BlockParentInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ interface BlockParentInterface extends NodeInterface
1717
/**
1818
* @return BlockSequenceInterface
1919
*/
20-
public function getBlocks();
20+
public function getBlocks(): BlockSequenceInterface;
2121

2222
/**
2323
* @param BlockInterface $block

src/Block/BlockSequenceInterface.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,58 +22,58 @@ public function __construct(BlockParentInterface $parent);
2222
/**
2323
* @return BlockParentInterface
2424
*/
25-
public function getParent();
25+
public function getParent(): BlockParentInterface;
2626

2727
/**
2828
* @return int
2929
*/
30-
public function size();
30+
public function size(): int;
3131

3232
/**
3333
* @param BlockInterface $block
3434
* @return bool
3535
*/
36-
public function contains(BlockInterface $block);
36+
public function contains(BlockInterface $block): bool;
3737

3838
/**
3939
* @param BlockInterface[] $blocks
4040
* @return bool
4141
*/
42-
public function containsAll(array $blocks);
42+
public function containsAll(array $blocks): bool;
4343

4444
/**
4545
* @return BlockInterface
4646
*/
47-
public function first();
47+
public function first(): BlockInterface;
4848

4949
/**
5050
* @return BlockInterface
5151
*/
52-
public function last();
52+
public function last(): BlockInterface;
5353

5454
/**
5555
* @param int $index
5656
* @return BlockInterface
5757
*/
58-
public function get($index);
58+
public function get(int $index): BlockInterface;
5959

6060
/**
6161
* @param BlockInterface $block
6262
* @return int
6363
*/
64-
public function indexOf(BlockInterface $block);
64+
public function indexOf(BlockInterface $block): int;
6565

6666
/**
6767
* @param BlockInterface $block
6868
* @return bool
6969
*/
70-
public function isFirst(BlockInterface $block);
70+
public function isFirst(BlockInterface $block): bool;
7171

7272
/**
7373
* @param BlockInterface $block
7474
* @return bool
7575
*/
76-
public function isLast(BlockInterface $block);
76+
public function isLast(BlockInterface $block): bool;
7777

7878
/**
7979
* @param BlockInterface $block
@@ -104,14 +104,14 @@ public function prependAll(array $blocks);
104104
* @param int $index
105105
* @return $this
106106
*/
107-
public function insert(BlockInterface $block, $index);
107+
public function insert(BlockInterface $block, int $index);
108108

109109
/**
110110
* @param BlockInterface[] $blocks
111111
* @param int $index
112112
* @return $this
113113
*/
114-
public function insertAll(array $blocks, $index);
114+
public function insertAll(array $blocks, int $index);
115115

116116
/**
117117
* @param BlockInterface $block
@@ -153,17 +153,17 @@ public function replaceItem(BlockInterface $block, BlockInterface $replacedBlock
153153
* @param int $index
154154
* @return $this
155155
*/
156-
public function replace(BlockInterface $block, $index);
156+
public function replace(BlockInterface $block, int $index);
157157

158158
/**
159159
* @return BlockInterface
160160
*/
161-
public function removeFirst();
161+
public function removeFirst(): BlockInterface;
162162

163163
/**
164164
* @return BlockInterface
165165
*/
166-
public function removeLast();
166+
public function removeLast(): BlockInterface;
167167

168168
/**
169169
* @param BlockInterface[] $blocks
@@ -175,13 +175,13 @@ public function removeAll(array $blocks);
175175
* @param BlockInterface $block
176176
* @return BlockInterface
177177
*/
178-
public function removeItem(BlockInterface $block);
178+
public function removeItem(BlockInterface $block): BlockInterface;
179179

180180
/**
181181
* @param int $index
182182
* @return BlockInterface
183183
*/
184-
public function remove($index);
184+
public function remove(int $index): BlockInterface;
185185

186186
/**
187187
* @return $this

src/Block/CodeBlockInterface.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,28 @@ interface CodeBlockInterface extends BlockInterface
1616
* @param string $code
1717
* @param string $hint
1818
*/
19-
public function __construct($code, $hint = null);
19+
public function __construct(string $code, ?string $hint = null);
2020

2121
/**
2222
* @return string
2323
*/
24-
public function getCode();
24+
public function getCode(): string;
2525

2626
/**
2727
* @param string $code
2828
* @return $this
2929
*/
30-
public function setCode($code);
30+
public function setCode(string $code);
3131

3232
/**
3333
* @return string
3434
*/
35-
public function getHint();
35+
public function getHint(): ?string;
3636

3737
/**
3838
* @param string $hint
3939
* @return $this
4040
*/
41-
public function setHint($hint);
41+
public function setHint(string $hint);
4242

4343
}

src/Block/CommentBlockInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ interface CommentBlockInterface extends BlockInterface
1313
/**
1414
* CommentBlockInterface constructor.
1515
*
16-
* @param $comment
16+
* @param string $comment
1717
*/
18-
public function __construct($comment);
18+
public function __construct(string $comment);
1919

2020
/**
2121
* @return string
2222
*/
23-
public function getComment();
23+
public function getComment(): string;
2424

2525
/**
2626
* @param string $comment
2727
* @return $this
2828
*/
29-
public function setComment($comment);
29+
public function setComment(string $comment);
3030

3131
}

src/Block/DocumentInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ interface DocumentInterface extends BlockParentInterface
1616
* @param HandlerInterface $markdomHandler
1717
* @return void
1818
*/
19-
public function handle(HandlerInterface $markdomHandler);
19+
public function handle(HandlerInterface $markdomHandler): void;
2020

2121
}

src/Block/HeadingBlockInterface.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@
1010
interface HeadingBlockInterface extends ContentParentBlockInterface
1111
{
1212

13-
const LEVEL_1 = 1;
14-
const LEVEL_2 = 2;
15-
const LEVEL_3 = 3;
16-
const LEVEL_4 = 4;
17-
const LEVEL_5 = 5;
18-
const LEVEL_6 = 6;
13+
public const LEVEL_1 = 1;
14+
public const LEVEL_2 = 2;
15+
public const LEVEL_3 = 3;
16+
public const LEVEL_4 = 4;
17+
public const LEVEL_5 = 5;
18+
public const LEVEL_6 = 6;
1919

2020
/**
2121
* HeadingBlock constructor.
2222
*
2323
* @param int $level
2424
*/
25-
public function __construct($level);
25+
public function __construct(int $level);
2626

2727
/**
2828
* @return int
2929
*/
30-
public function getLevel();
30+
public function getLevel(): int;
3131

3232
/**
3333
* @param int $level
3434
* @return $this
3535
*/
36-
public function setLevel($level);
36+
public function setLevel(int $level);
3737

3838
}

src/Block/ListBlockInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ interface ListBlockInterface extends BlockInterface
1313
/**
1414
* @return ListItemSequenceInterface
1515
*/
16-
public function getListItems();
16+
public function getListItems(): ListItemSequenceInterface;
1717

1818
}

src/Block/ListItemInterface.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface ListItemInterface extends BlockParentInterface
1515
/**
1616
* @return ListBlockInterface
1717
*/
18-
public function getParent();
18+
public function getParent(): ListBlockInterface;
1919

2020
/**
2121
* @param ListBlockInterface $listBlock
@@ -30,7 +30,8 @@ public function onDetach();
3030

3131
/**
3232
* @param HandlerInterface $markdomHandler
33+
* @return void
3334
*/
34-
public function onHandle(HandlerInterface $markdomHandler);
35+
public function onHandle(HandlerInterface $markdomHandler): void;
3536

3637
}

0 commit comments

Comments
 (0)