From 5271fd5f598384320e6101bf139c5d69a5f7957d Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Fri, 13 Jan 2017 02:21:17 +0300 Subject: [PATCH] New PHP 7.1 type hints for factories. --- .../Service/Factory/Blogs/CommentFactory.php | 2 +- .../PointToolsBundle/Service/Factory/Blogs/FileFactory.php | 2 +- .../PointToolsBundle/Service/Factory/Blogs/PostFactory.php | 6 +++--- .../Bundle/PointToolsBundle/Service/Factory/UserFactory.php | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/CommentFactory.php b/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/CommentFactory.php index f53c89c..188b290 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/CommentFactory.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/CommentFactory.php @@ -88,7 +88,7 @@ class CommentFactory * * @throws InvalidResponseException */ - private function validateData(array $data) + private function validateData(array $data): void { if (!array_key_exists('author', $data)) { throw new InvalidResponseException('Comment author data not found in API response'); diff --git a/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/FileFactory.php b/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/FileFactory.php index ebef995..a1261e6 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/FileFactory.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/FileFactory.php @@ -76,7 +76,7 @@ class FileFactory * * @throws InvalidResponseException */ - private function validateData($data) + private function validateData($data): void { if (!is_string($data)) { // @todo Change exception diff --git a/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/PostFactory.php b/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/PostFactory.php index 4d6b4eb..d217974 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/PostFactory.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/Blogs/PostFactory.php @@ -180,7 +180,7 @@ class PostFactory * @param Post $post * @param string[] $tagsStrings */ - private function updatePostTags(Post $post, array $tagsStrings) + private function updatePostTags(Post $post, array $tagsStrings): void { $tags = $this->tagFactory->createFromStringsArray($tagsStrings); @@ -224,7 +224,7 @@ class PostFactory * @param Post $post * @param array $urls */ - private function updatePostFiles(Post $post, array $urls) + private function updatePostFiles(Post $post, array $urls): void { $files = $this->fileFactory->createFromUrlsArray($urls); @@ -243,7 +243,7 @@ class PostFactory } } - private function validateMetaPost(MetaPost $post) + private function validateMetaPost(MetaPost $post): bool { if (!$post->getPost()->getId()) { $this->logger->error('Post DTO contains no id'); diff --git a/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/UserFactory.php b/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/UserFactory.php index 60416a4..1fc351d 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/UserFactory.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Service/Factory/UserFactory.php @@ -85,7 +85,7 @@ class UserFactory * * @throws InvalidResponseException */ - private function validateArrayData(array $data) + private function validateArrayData(array $data): void { if (!array_key_exists('id', $data) || !array_key_exists('login', $data) || !array_key_exists('name', $data) || !is_numeric($data['id'])) { throw new InvalidResponseException('Invalid user data'); @@ -97,7 +97,7 @@ class UserFactory * * @throws InvalidResponseException */ - private function validateDTOData(UserDTO $data) + private function validateDTOData(UserDTO $data): void { if (!$data->getId() || !$data->getLogin()) { throw new InvalidUserDataException('User have no id or login', $data);