diff options
author | ArthurHoaro <arthur@hoa.ro> | 2020-10-02 17:50:59 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2020-10-13 13:50:11 +0200 |
commit | efb7d21b52eb033530e80e5e49d175e6e3b031f4 (patch) | |
tree | 4f34052788a08be1a30cb88c3339ae14e0b7c4da /application/bookmark/BookmarkInitializer.php | |
parent | 29c31b7ec6ca48ba37b7eb6da650931fd0cb7164 (diff) | |
download | Shaarli-efb7d21b52eb033530e80e5e49d175e6e3b031f4.tar.gz Shaarli-efb7d21b52eb033530e80e5e49d175e6e3b031f4.tar.zst Shaarli-efb7d21b52eb033530e80e5e49d175e6e3b031f4.zip |
Add strict types for bookmarks management
Parameters typing and using strict types overall increase the codebase
quality by enforcing the a given parameter will have the expected type.
It also removes the need to unnecessary unit tests checking methods
behavior with invalid input.
Diffstat (limited to 'application/bookmark/BookmarkInitializer.php')
-rw-r--r-- | application/bookmark/BookmarkInitializer.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/application/bookmark/BookmarkInitializer.php b/application/bookmark/BookmarkInitializer.php index 815047e3..04b996f3 100644 --- a/application/bookmark/BookmarkInitializer.php +++ b/application/bookmark/BookmarkInitializer.php | |||
@@ -1,5 +1,7 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | declare(strict_types=1); | ||
4 | |||
3 | namespace Shaarli\Bookmark; | 5 | namespace Shaarli\Bookmark; |
4 | 6 | ||
5 | /** | 7 | /** |
@@ -23,7 +25,7 @@ class BookmarkInitializer | |||
23 | * | 25 | * |
24 | * @param BookmarkServiceInterface $bookmarkService | 26 | * @param BookmarkServiceInterface $bookmarkService |
25 | */ | 27 | */ |
26 | public function __construct($bookmarkService) | 28 | public function __construct(BookmarkServiceInterface $bookmarkService) |
27 | { | 29 | { |
28 | $this->bookmarkService = $bookmarkService; | 30 | $this->bookmarkService = $bookmarkService; |
29 | } | 31 | } |
@@ -31,7 +33,7 @@ class BookmarkInitializer | |||
31 | /** | 33 | /** |
32 | * Initialize the data store with default bookmarks | 34 | * Initialize the data store with default bookmarks |
33 | */ | 35 | */ |
34 | public function initialize() | 36 | public function initialize(): void |
35 | { | 37 | { |
36 | $bookmark = new Bookmark(); | 38 | $bookmark = new Bookmark(); |
37 | $bookmark->setTitle('quicksilver (loop) on Vimeo ' . t('(private bookmark with thumbnail demo)')); | 39 | $bookmark->setTitle('quicksilver (loop) on Vimeo ' . t('(private bookmark with thumbnail demo)')); |