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/BookmarkIO.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/BookmarkIO.php')
-rw-r--r-- | application/bookmark/BookmarkIO.php | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/application/bookmark/BookmarkIO.php b/application/bookmark/BookmarkIO.php index 099653b0..f40fa476 100644 --- a/application/bookmark/BookmarkIO.php +++ b/application/bookmark/BookmarkIO.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 | use malkusch\lock\mutex\Mutex; | 7 | use malkusch\lock\mutex\Mutex; |
@@ -61,7 +63,7 @@ class BookmarkIO | |||
61 | /** | 63 | /** |
62 | * Reads database from disk to memory | 64 | * Reads database from disk to memory |
63 | * | 65 | * |
64 | * @return BookmarkArray instance | 66 | * @return Bookmark[] |
65 | * | 67 | * |
66 | * @throws NotWritableDataStoreException Data couldn't be loaded | 68 | * @throws NotWritableDataStoreException Data couldn't be loaded |
67 | * @throws EmptyDataStoreException Datastore file exists but does not contain any bookmark | 69 | * @throws EmptyDataStoreException Datastore file exists but does not contain any bookmark |
@@ -101,7 +103,7 @@ class BookmarkIO | |||
101 | /** | 103 | /** |
102 | * Saves the database from memory to disk | 104 | * Saves the database from memory to disk |
103 | * | 105 | * |
104 | * @param BookmarkArray $links instance. | 106 | * @param Bookmark[] $links |
105 | * | 107 | * |
106 | * @throws NotWritableDataStoreException the datastore is not writable | 108 | * @throws NotWritableDataStoreException the datastore is not writable |
107 | */ | 109 | */ |