From 338cf05cf5a637b2cd390c0e60b6bedebb01b3ea Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 3 Jul 2020 12:39:15 +0300 Subject: [PATCH 1/3] fix filters --- src/AmoCRM/Filters/CompaniesFilter.php | 3 ++- src/AmoCRM/Filters/ContactsFilter.php | 3 ++- src/AmoCRM/Filters/CustomersFilter.php | 3 ++- src/AmoCRM/Filters/Interfaces/HasOrderInterface.php | 2 +- src/AmoCRM/Filters/LeadsFilter.php | 4 +++- src/AmoCRM/Filters/NotesFilter.php | 3 ++- src/AmoCRM/Filters/TasksFilter.php | 4 +++- src/AmoCRM/Filters/UnsortedFilter.php | 3 ++- 8 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/AmoCRM/Filters/CompaniesFilter.php b/src/AmoCRM/Filters/CompaniesFilter.php index 5c838b2e..d75ef739 100755 --- a/src/AmoCRM/Filters/CompaniesFilter.php +++ b/src/AmoCRM/Filters/CompaniesFilter.php @@ -2,6 +2,7 @@ namespace AmoCRM\Filters; +use AmoCRM\Filters\Interfaces\HasOrderInterface; use AmoCRM\Filters\Interfaces\HasPagesInterface; use AmoCRM\Filters\Traits\ArrayOrNumericFilterTrait; use AmoCRM\Filters\Traits\ArrayOrStringFilterTrait; @@ -9,7 +10,7 @@ use AmoCRM\Filters\Traits\PagesFilterTrait; use AmoCRM\Filters\Traits\IntOrIntRangeFilterTrait; -class CompaniesFilter extends BaseEntityFilter implements HasPagesInterface +class CompaniesFilter extends BaseEntityFilter implements HasPagesInterface, HasOrderInterface { use OrderTrait; use PagesFilterTrait; diff --git a/src/AmoCRM/Filters/ContactsFilter.php b/src/AmoCRM/Filters/ContactsFilter.php index fa158c09..f454f147 100755 --- a/src/AmoCRM/Filters/ContactsFilter.php +++ b/src/AmoCRM/Filters/ContactsFilter.php @@ -2,6 +2,7 @@ namespace AmoCRM\Filters; +use AmoCRM\Filters\Interfaces\HasOrderInterface; use AmoCRM\Filters\Interfaces\HasPagesInterface; use AmoCRM\Filters\Traits\ArrayOrNumericFilterTrait; use AmoCRM\Filters\Traits\ArrayOrStringFilterTrait; @@ -9,7 +10,7 @@ use AmoCRM\Filters\Traits\PagesFilterTrait; use AmoCRM\Filters\Traits\IntOrIntRangeFilterTrait; -class ContactsFilter extends BaseEntityFilter implements HasPagesInterface +class ContactsFilter extends BaseEntityFilter implements HasPagesInterface, HasOrderInterface { use OrderTrait; use PagesFilterTrait; diff --git a/src/AmoCRM/Filters/CustomersFilter.php b/src/AmoCRM/Filters/CustomersFilter.php index 2f15cfbf..85f2c95d 100755 --- a/src/AmoCRM/Filters/CustomersFilter.php +++ b/src/AmoCRM/Filters/CustomersFilter.php @@ -2,6 +2,7 @@ namespace AmoCRM\Filters; +use AmoCRM\Filters\Interfaces\HasOrderInterface; use AmoCRM\Filters\Interfaces\HasPagesInterface; use AmoCRM\Filters\Traits\ArrayOrNumericFilterTrait; use AmoCRM\Filters\Traits\ArrayOrStringFilterTrait; @@ -9,7 +10,7 @@ use AmoCRM\Filters\Traits\PagesFilterTrait; use AmoCRM\Filters\Traits\IntOrIntRangeFilterTrait; -class CustomersFilter extends BaseEntityFilter implements HasPagesInterface +class CustomersFilter extends BaseEntityFilter implements HasPagesInterface, HasOrderInterface { use OrderTrait; use PagesFilterTrait; diff --git a/src/AmoCRM/Filters/Interfaces/HasOrderInterface.php b/src/AmoCRM/Filters/Interfaces/HasOrderInterface.php index 59e9286c..75bd8eb6 100755 --- a/src/AmoCRM/Filters/Interfaces/HasOrderInterface.php +++ b/src/AmoCRM/Filters/Interfaces/HasOrderInterface.php @@ -19,7 +19,7 @@ interface HasOrderInterface * * @return $this */ - public function setOrder(string $field, string $direction = self::SORT_ASC): self; + public function setOrder(string $field, string $direction = self::SORT_ASC); /** * @return array diff --git a/src/AmoCRM/Filters/LeadsFilter.php b/src/AmoCRM/Filters/LeadsFilter.php index 6df0ed48..e295a1ab 100755 --- a/src/AmoCRM/Filters/LeadsFilter.php +++ b/src/AmoCRM/Filters/LeadsFilter.php @@ -2,6 +2,7 @@ namespace AmoCRM\Filters; +use AmoCRM\Filters\Interfaces\HasOrderInterface; use AmoCRM\Filters\Interfaces\HasPagesInterface; use AmoCRM\Filters\Traits\ArrayOrNumericFilterTrait; use AmoCRM\Filters\Traits\ArrayOrStringFilterTrait; @@ -9,7 +10,8 @@ use AmoCRM\Filters\Traits\PagesFilterTrait; use AmoCRM\Filters\Traits\IntOrIntRangeFilterTrait; -class LeadsFilter extends BaseEntityFilter implements HasPagesInterface +class LeadsFilter extends BaseEntityFilter implements HasPagesInterface, HasOrderInterface + { use OrderTrait; use PagesFilterTrait; diff --git a/src/AmoCRM/Filters/NotesFilter.php b/src/AmoCRM/Filters/NotesFilter.php index dde19995..7efe096d 100755 --- a/src/AmoCRM/Filters/NotesFilter.php +++ b/src/AmoCRM/Filters/NotesFilter.php @@ -2,13 +2,14 @@ namespace AmoCRM\Filters; +use AmoCRM\Filters\Interfaces\HasOrderInterface; use AmoCRM\Filters\Interfaces\HasPagesInterface; use AmoCRM\Filters\Traits\ArrayOrNumericFilterTrait; use AmoCRM\Filters\Traits\OrderTrait; use AmoCRM\Filters\Traits\PagesFilterTrait; use AmoCRM\Filters\Traits\IntOrIntRangeFilterTrait; -class NotesFilter extends BaseEntityFilter implements HasPagesInterface +class NotesFilter extends BaseEntityFilter implements HasPagesInterface, HasOrderInterface { use OrderTrait; use PagesFilterTrait; diff --git a/src/AmoCRM/Filters/TasksFilter.php b/src/AmoCRM/Filters/TasksFilter.php index 132bae28..0f6585fd 100644 --- a/src/AmoCRM/Filters/TasksFilter.php +++ b/src/AmoCRM/Filters/TasksFilter.php @@ -2,12 +2,14 @@ namespace AmoCRM\Filters; +use AmoCRM\Filters\Interfaces\HasOrderInterface; +use AmoCRM\Filters\Interfaces\HasPagesInterface; use AmoCRM\Filters\Traits\ArrayOrNumericFilterTrait; use AmoCRM\Filters\Traits\OrderTrait; use AmoCRM\Filters\Traits\PagesFilterTrait; use AmoCRM\Filters\Traits\IntOrIntRangeFilterTrait; -class TasksFilter +class TasksFilter extends BaseEntityFilter implements HasPagesInterface, HasOrderInterface { use OrderTrait; use PagesFilterTrait; diff --git a/src/AmoCRM/Filters/UnsortedFilter.php b/src/AmoCRM/Filters/UnsortedFilter.php index 488fc1eb..13257a34 100755 --- a/src/AmoCRM/Filters/UnsortedFilter.php +++ b/src/AmoCRM/Filters/UnsortedFilter.php @@ -2,12 +2,13 @@ namespace AmoCRM\Filters; +use AmoCRM\Filters\Interfaces\HasOrderInterface; use AmoCRM\Filters\Interfaces\HasPagesInterface; use AmoCRM\Filters\Traits\ArrayOrStringFilterTrait; use AmoCRM\Filters\Traits\OrderTrait; use AmoCRM\Filters\Traits\PagesFilterTrait; -class UnsortedFilter extends BaseEntityFilter implements HasPagesInterface +class UnsortedFilter extends BaseEntityFilter implements HasPagesInterface, HasOrderInterface { use PagesFilterTrait; use OrderTrait; From f500af5df1896d5f7642a2a382ebead854a1e703 Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 3 Jul 2020 12:43:38 +0300 Subject: [PATCH 2/3] fix filters --- src/AmoCRM/Filters/Interfaces/HasOrderInterface.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/AmoCRM/Filters/Interfaces/HasOrderInterface.php b/src/AmoCRM/Filters/Interfaces/HasOrderInterface.php index 75bd8eb6..606d41dc 100755 --- a/src/AmoCRM/Filters/Interfaces/HasOrderInterface.php +++ b/src/AmoCRM/Filters/Interfaces/HasOrderInterface.php @@ -2,8 +2,6 @@ namespace AmoCRM\Filters\Interfaces; -use AmoCRM\Filters\Traits\PagesFilterTrait; - /** * Интерфейс для фильтров, которые поддерживают постраничную навигацию * @package AmoCRM\Filters\Interfaces @@ -22,7 +20,7 @@ interface HasOrderInterface public function setOrder(string $field, string $direction = self::SORT_ASC); /** - * @return array + * @return null|array */ - public function getOrder(): array; + public function getOrder(): ?array; } From cb4d404717abe0b5610e6c288986b7ce8142d7fe Mon Sep 17 00:00:00 2001 From: Nikita Date: Fri, 3 Jul 2020 12:49:36 +0300 Subject: [PATCH 3/3] fix cs --- src/AmoCRM/Filters/LeadsFilter.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/AmoCRM/Filters/LeadsFilter.php b/src/AmoCRM/Filters/LeadsFilter.php index e295a1ab..dd8db039 100755 --- a/src/AmoCRM/Filters/LeadsFilter.php +++ b/src/AmoCRM/Filters/LeadsFilter.php @@ -11,7 +11,6 @@ use AmoCRM\Filters\Traits\IntOrIntRangeFilterTrait; class LeadsFilter extends BaseEntityFilter implements HasPagesInterface, HasOrderInterface - { use OrderTrait; use PagesFilterTrait;