Skip to content

Commit 404f888

Browse files
authored
Merge pull request #11 from skoro/fix-php74-errors
Fix php74 errors
2 parents 5dbaba5 + 9de5cd2 commit 404f888

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

src/Image.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Tkui;
44

5-
use Stringable;
6-
75
/**
86
* Contract for graphic images.
7+
*
8+
* TODO: extends Stringable
99
*/
10-
interface Image extends Stringable
10+
interface Image
1111
{
1212
public function width(): int;
1313

src/Widgets/TreeView/Column.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function header(): Header
6464
return $this->header;
6565
}
6666

67-
public static function create(string $id, string $header): static
67+
public static function create(string $id, string $header): self
6868
{
6969
return new static($id, new Header($header));
7070
}

src/Widgets/TreeView/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function options(): Options
7676
return $this->options;
7777
}
7878

79-
public static function values(array $values): static
79+
public static function values(array $values): self
8080
{
8181
return new static($values);
8282
}

src/Widgets/TreeView/TreeView.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,19 @@ protected function initWidgetOptions(): Options
6363
]);
6464
}
6565

66-
public function onSelect(callable $callback): static
66+
public function onSelect(callable $callback): self
6767
{
6868
$this->bind('<<TreeviewSelect>>', fn () => $callback($this->selected(), $this));
6969
return $this;
7070
}
7171

72-
public function onOpen(callable $callback): static
72+
public function onOpen(callable $callback): self
7373
{
7474
$this->bind('<<TreeviewOpen>>', fn () => $callback($this));
7575
return $this;
7676
}
7777

78-
public function onClose(callable $callback): static
78+
public function onClose(callable $callback): self
7979
{
8080
$this->bind('<<TreeviewClose>>', fn () => $callback($this));
8181
return $this;
@@ -101,21 +101,21 @@ private function setColumnHeader(Column $column): void
101101
$this->call('heading', $column->id, '-text', $column->header()->text);
102102
}
103103

104-
public function add(Item $item, string $parentId = ''): static
104+
public function add(Item $item, string $parentId = ''): self
105105
{
106106
$args = $item->options()->asStringArray();
107107
$this->call('insert', $parentId ?: '{}', 'end', ...$args);
108108
return $this;
109109
}
110110

111-
public function delete(Item ...$items): static
111+
public function delete(Item ...$items): self
112112
{
113113
$ids = array_map(fn (Item $item) => $item->id, $items);
114114
$this->call('delete', ...$ids);
115115
return $this;
116116
}
117117

118-
public function focusItem(Item $item): static
118+
public function focusItem(Item $item): self
119119
{
120120
$this->call('focus', $item->id);
121121
return $this;
@@ -171,7 +171,7 @@ public function getPrevItemId(string $itemId): string
171171
/**
172172
* Sets the viewport to the specified item.
173173
*/
174-
public function seeItemId(string $itemId): static
174+
public function seeItemId(string $itemId): self
175175
{
176176
$this->call('see', $itemId);
177177
return $this;

tests/Widgets/TextTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Tkui\Widgets\Text\Text;
99
use Tkui\Widgets\Text\TextIndex;
1010
use PHPUnit\Framework\MockObject\MockObject;
11+
use Tkui\TclTk\TkImage;
1112

1213
class TextTest extends TestCase
1314
{
@@ -174,7 +175,9 @@ public function insert_embedded_image_into_specified_position()
174175
]);
175176

176177
/** @var Image|MockObject */
177-
$image = $this->createMock(Image::class);
178+
// FIXME: Since Image doesn't have Stringable TkImage is used here, after switching
179+
// to PHP8 it must be changed to Image interface instead of TkImage.
180+
$image = $this->createMock(TkImage::class);
178181
$image->expects($this->once())
179182
->method('__toString')
180183
->willReturn('i0')

0 commit comments

Comments
 (0)