17
17
use Magento \Framework \Reflection \DataObjectProcessor ;
18
18
use Magento \Framework \Exception \LocalizedException ;
19
19
use Magento \Store \Model \ScopeInterface ;
20
+ use Magento \Customer \Model \Data \CustomerSecure ;
20
21
21
22
/**
22
23
* Customer email notification
@@ -126,7 +127,7 @@ public function __construct(
126
127
$ this ->customerViewHelper = $ customerViewHelper ;
127
128
$ this ->dataProcessor = $ dataProcessor ;
128
129
$ this ->scopeConfig = $ scopeConfig ;
129
- $ this ->senderResolver = $ senderResolver ?: ObjectManager::getInstance ()->get (SenderResolverInterface::class);
130
+ $ this ->senderResolver = $ senderResolver ?? ObjectManager::getInstance ()->get (SenderResolverInterface::class);
130
131
}
131
132
132
133
/**
@@ -141,7 +142,7 @@ public function credentialsChanged(
141
142
CustomerInterface $ savedCustomer ,
142
143
$ origCustomerEmail ,
143
144
$ isPasswordChanged = false
144
- ) {
145
+ ): void {
145
146
if ($ origCustomerEmail != $ savedCustomer ->getEmail ()) {
146
147
if ($ isPasswordChanged ) {
147
148
$ this ->emailAndPasswordChanged ($ savedCustomer , $ origCustomerEmail );
@@ -166,7 +167,7 @@ public function credentialsChanged(
166
167
* @param string $email
167
168
* @return void
168
169
*/
169
- private function emailAndPasswordChanged (CustomerInterface $ customer , $ email )
170
+ private function emailAndPasswordChanged (CustomerInterface $ customer , $ email ): void
170
171
{
171
172
$ storeId = $ customer ->getStoreId ();
172
173
if (!$ storeId ) {
@@ -192,7 +193,7 @@ private function emailAndPasswordChanged(CustomerInterface $customer, $email)
192
193
* @param string $email
193
194
* @return void
194
195
*/
195
- private function emailChanged (CustomerInterface $ customer , $ email )
196
+ private function emailChanged (CustomerInterface $ customer , $ email ): void
196
197
{
197
198
$ storeId = $ customer ->getStoreId ();
198
199
if (!$ storeId ) {
@@ -217,7 +218,7 @@ private function emailChanged(CustomerInterface $customer, $email)
217
218
* @param CustomerInterface $customer
218
219
* @return void
219
220
*/
220
- private function passwordReset (CustomerInterface $ customer )
221
+ private function passwordReset (CustomerInterface $ customer ): void
221
222
{
222
223
$ storeId = $ customer ->getStoreId ();
223
224
if (!$ storeId ) {
@@ -254,7 +255,7 @@ private function sendEmailTemplate(
254
255
$ templateParams = [],
255
256
$ storeId = null ,
256
257
$ email = null
257
- ) {
258
+ ): void {
258
259
$ templateId = $ this ->scopeConfig ->getValue ($ template , ScopeInterface::SCOPE_STORE , $ storeId );
259
260
if ($ email === null ) {
260
261
$ email = $ customer ->getEmail ();
@@ -280,15 +281,15 @@ private function sendEmailTemplate(
280
281
* Create an object with data merged from Customer and CustomerSecure
281
282
*
282
283
* @param CustomerInterface $customer
283
- * @return \Magento\Customer\Model\Data\ CustomerSecure
284
+ * @return CustomerSecure
284
285
*/
285
- private function getFullCustomerObject ($ customer )
286
+ private function getFullCustomerObject ($ customer ): CustomerSecure
286
287
{
287
288
// No need to flatten the custom attributes or nested objects since the only usage is for email templates and
288
289
// object passed for events
289
290
$ mergedCustomerData = $ this ->customerRegistry ->retrieveSecureData ($ customer ->getId ());
290
291
$ customerData = $ this ->dataProcessor
291
- ->buildOutputDataArray ($ customer , \ Magento \ Customer \ Api \ Data \ CustomerInterface::class);
292
+ ->buildOutputDataArray ($ customer , CustomerInterface::class);
292
293
$ mergedCustomerData ->addData ($ customerData );
293
294
$ mergedCustomerData ->setData ('name ' , $ this ->customerViewHelper ->getCustomerName ($ customer ));
294
295
return $ mergedCustomerData ;
@@ -301,7 +302,7 @@ private function getFullCustomerObject($customer)
301
302
* @param int|string|null $defaultStoreId
302
303
* @return int
303
304
*/
304
- private function getWebsiteStoreId ($ customer , $ defaultStoreId = null )
305
+ private function getWebsiteStoreId ($ customer , $ defaultStoreId = null ): int
305
306
{
306
307
if ($ customer ->getWebsiteId () != 0 && empty ($ defaultStoreId )) {
307
308
$ storeIds = $ this ->storeManager ->getWebsite ($ customer ->getWebsiteId ())->getStoreIds ();
@@ -316,7 +317,7 @@ private function getWebsiteStoreId($customer, $defaultStoreId = null)
316
317
* @param CustomerInterface $customer
317
318
* @return void
318
319
*/
319
- public function passwordReminder (CustomerInterface $ customer )
320
+ public function passwordReminder (CustomerInterface $ customer ): void
320
321
{
321
322
$ storeId = $ customer ->getStoreId ();
322
323
if (!$ storeId ) {
@@ -340,7 +341,7 @@ public function passwordReminder(CustomerInterface $customer)
340
341
* @param CustomerInterface $customer
341
342
* @return void
342
343
*/
343
- public function passwordResetConfirmation (CustomerInterface $ customer )
344
+ public function passwordResetConfirmation (CustomerInterface $ customer ): void
344
345
{
345
346
$ storeId = $ customer ->getStoreId ();
346
347
if (!$ storeId ) {
@@ -375,7 +376,7 @@ public function newAccount(
375
376
$ backUrl = '' ,
376
377
$ storeId = 0 ,
377
378
$ sendemailStoreId = null
378
- ) {
379
+ ): void {
379
380
$ types = self ::TEMPLATE_TYPES ;
380
381
381
382
if (!isset ($ types [$ type ])) {
0 commit comments