99
1010use Magento \Customer \Model \Customer ;
1111use Magento \Framework \Validator \AbstractValidator ;
12+ use Magento \Store \Api \Data \StoreInterface as StoreInterface ;
1213use Magento \Store \Model \StoreManagerInterface ;
1314
1415/**
@@ -41,7 +42,7 @@ public function __construct(StoreManagerInterface $storeManager)
4142 * @param Customer $customer
4243 * @return bool
4344 */
44- public function isValid ($ customer )
45+ public function isValid ($ customer ): bool
4546 {
4647 if (!$ this ->isValidDob ($ customer ->getDob (), $ customer ->getStoreId ())) {
4748 parent ::_addMessages ([['dob ' => 'The Date of Birth should not be greater than today. ' ]]);
@@ -54,13 +55,11 @@ public function isValid($customer)
5455 * Check if specified dob is not in the future
5556 *
5657 * @param string|null $dobValue
57- * @param int $storeId
58+ * @param null|string|bool| int|StoreInterface $storeId
5859 * @return bool
5960 */
60- private function isValidDob (?string $ dobValue , int $ storeId ): bool
61+ private function isValidDob (?string $ dobValue , null | string | bool | int | StoreInterface $ storeId ): bool
6162 {
62- if ($ dobValue != null ) {
63-
6463 // Get the timezone of the store
6564 $ store = $ this ->storeManager ->getStore ($ storeId );
6665 $ timezone = $ store ->getConfig ('general/locale/timezone ' );
@@ -77,7 +76,6 @@ private function isValidDob(?string $dobValue, int $storeId): bool
7776 if ($ dobTimestamp > $ currentTimestamp ) {
7877 return false ;
7978 }
80- }
8179
8280 return true ;
8381 }
0 commit comments