Skip to content

Commit

Permalink
phpstan fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboss86 committed Nov 28, 2019
1 parent 87b6c26 commit 9d11456
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 56 deletions.
31 changes: 0 additions & 31 deletions src/Api/EcommerceInterface.php
Expand Up @@ -8,177 +8,146 @@ interface EcommerceInterface
{
/**
* @param array $data
* @return array|false
*/
public function addStore(array $data);

/**
* @return array|false
*/
public function getStores();

/**
* @param string $storeId
* @return array|false
*/
public function getStore(string $storeId);

/**
* @param string $storeId
* @param array $data
* @return array|false
*/
public function updateStore(string $storeId, array $data);

/**
* @param string $storeId
* @return array|false
*/
public function removeStore(string $storeId);

/**
* @param string $storeId
* @param array $data
* @return array|false
*/
public function addCustomer(string $storeId, array $data);

/**
* @param string $storeId
* @return array|false
*/
public function getCustomers(string $storeId);

/**
* @param string $storeId
* @param string $customerId
* @return array|false
*/
public function getCustomer(string $storeId, string $customerId);

/**
* @param string $storeId
* @param string $customerId
* @param array $data
* @return array|false
*/
public function updateCustomer(string $storeId, string $customerId, array $data);

/**
* @param string $storeId
* @param string $customerId
* @return array|false
*/
public function removeCustomer(string $storeId, string $customerId);

/**
* @param string $storeId
* @param array $data
* @return array|false
*/
public function addProduct(string $storeId, array $data);

/**
* @param string $storeId
* @return array|false
*/
public function getProducts(string $storeId);

/**
* @param string $storeId
* @param string $productId
* @return array|false
*/
public function getProduct(string $storeId, string $productId);

/**
* @param string $storeId
* @param string $productId
* @param array $data
* @return array|false
*/
public function updateProduct(string $storeId, string $productId, array $data);

/**
* @param string $storeId
* @param string $productId
* @return array|false
*/
public function removeProduct(string $storeId, string $productId);

/**
* @param string $storeId
* @param array $data
* @return array|false
*/
public function addOrder(string $storeId, array $data);

/**
* @return array|false
*/
public function getOrders();

/**
* @param string $storeId
* @return array|false
*/
public function getOrdersByStore(string $storeId);

/**
* @param string $storeId
* @param string $orderId
* @return array|false
*/
public function getOrder(string $storeId, string $orderId);

/**
* @param string $storeId
* @param string $orderId
* @param array $data
* @return array|false
*/
public function updateOrder(string $storeId, string $orderId, array $data);

/**
* @param string $storeId
* @param string $orderId
* @return array|false
*/
public function removeOrder(string $storeId, string $orderId);

/**
* @param string $storeId
* @param array $data
*
* @return array|false
*/
public function addCart(string $storeId, array $data);

/**
* @param string $storeId
* @return array|false
*/
public function getCarts(string $storeId);

/**
* @param string $storeId
* @param string $cartId
* @return array|false
*/
public function getCart(string $storeId, string $cartId);

/**
* @param string $storeId
* @param string $cartId
* @param array $data
* @return array|false
*/
public function updateCart(string $storeId, string $cartId, array $data);

/**
* @param string $storeId
* @param string $cartId
* @return array|false
*/
public function removeCart(string $storeId, string $cartId);
}
4 changes: 0 additions & 4 deletions src/Api/ListsInterface.php
Expand Up @@ -9,29 +9,25 @@ interface ListsInterface
/**
* @param string $listId
* @param array $data
* @return array|false
*/
public function addMember(string $listId, array $data);

/**
* @param string $listId
* @param string $hash
* @return array|false
*/
public function getMember(string $listId, string $hash);

/**
* @param string $listId
* @param string $hash
* @param array $data
* @return array|false
*/
public function updateMember(string $listId, string $hash, array $data);

/**
* @param string $listId
* @param string $hash
* @return array|false
*/
public function removeMember(string $listId, string $hash);
}
4 changes: 3 additions & 1 deletion src/Command/SyncAllCommand.php
Expand Up @@ -28,7 +28,7 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$withPurge = $input->getOption('purge');
$createOnly = $input->getOption('create-only');
Expand Down Expand Up @@ -68,5 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): void
'--isSyncing' => false,
]), $output);
}

return 0;
}
}
4 changes: 3 additions & 1 deletion src/Command/SyncCartsCommand.php
Expand Up @@ -45,13 +45,15 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);

$this->io->title('Synchronizing the carts to Mailchimp');

$this->registerCarts($input);

return 0;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Command/SyncCustomersCommand.php
Expand Up @@ -52,13 +52,15 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);

$this->io->title('Synchronizing the customers to Mailchimp');

$this->registerCustomers($input);

return 0;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Command/SyncOrdersCommand.php
Expand Up @@ -46,13 +46,15 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);

$this->io->title('Synchronizing the orders to Mailchimp');

$this->registerOrders($input);

return 0;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Command/SyncProductsCommand.php
Expand Up @@ -46,13 +46,15 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);

$this->io->title('Synchronizing the products to Mailchimp');

$this->registerProducts($input);

return 0;
}

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Command/SyncStoresCommand.php
Expand Up @@ -46,13 +46,15 @@ protected function configure(): void
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = new SymfonyStyle($input, $output);

$this->io->title('Synchronizing the stores to Mailchimp');

$this->registerStores($input);

return 0;
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/Handler/CartRegisterHandlerInterface.php
Expand Up @@ -11,13 +11,11 @@ interface CartRegisterHandlerInterface
/**
* @param OrderInterface $order
* @param bool $createOnly
* @return array|false
*/
public function register(OrderInterface $order, bool $createOnly = false);

/**
* @param OrderInterface $order
* @return array|false
*/
public function unregister(OrderInterface $order);
}
Expand Up @@ -11,14 +11,12 @@ interface CustomerNewsletterSubscriptionHandlerInterface
/**
* @param CustomerInterface $customer
* @param string $listId
* @return array|false
*/
public function subscribe(CustomerInterface $customer, string $listId);

/**
* @param CustomerInterface $customer
* @param string $listId
* @return array|false
*/
public function unsubscribe(CustomerInterface $customer, string $listId);
}
2 changes: 0 additions & 2 deletions src/Handler/CustomerRegisterHandlerInterface.php
Expand Up @@ -14,7 +14,6 @@ interface CustomerRegisterHandlerInterface
* @param ChannelInterface $channel
* @param bool $optInStatus
* @param bool $createOnly
* @return array|false
*/
public function register(
CustomerInterface $customer,
Expand All @@ -26,7 +25,6 @@ public function register(
/**
* @param CustomerInterface $customer
* @param ChannelInterface $channel
* @return array|false
*/
public function unregister(CustomerInterface $customer, ChannelInterface $channel);
}
2 changes: 0 additions & 2 deletions src/Handler/OrderRegisterHandlerInterface.php
Expand Up @@ -11,13 +11,11 @@ interface OrderRegisterHandlerInterface
/**
* @param OrderInterface $order
* @param bool $createOnly
* @return array|false
*/
public function register(OrderInterface $order, bool $createOnly = false);

/**
* @param OrderInterface $order
* @return array|false
*/
public function unregister(OrderInterface $order);
}
7 changes: 6 additions & 1 deletion src/Handler/ProductRegisterHandler.php
Expand Up @@ -139,7 +139,12 @@ private function getVariantPrice(ProductVariant $variant, ChannelInterface $chan
/** @var ChannelPricingInterface $channelPricing */
$channelPricing = $variant->getChannelPricingForChannel($channel);

return $channelPricing !== null ? $channelPricing->getPrice() : null;
$variantPrice = null;
if ($channelPricing instanceof ChannelPricingInterface) {
$variantPrice = $channelPricing->getPrice();
}

return $variantPrice;
}

/**
Expand Down
2 changes: 0 additions & 2 deletions src/Handler/ProductRegisterHandlerInterface.php
Expand Up @@ -13,14 +13,12 @@ interface ProductRegisterHandlerInterface
* @param ProductInterface $product
* @param ChannelInterface $channel
* @param bool $createOnly
* @return array|false
*/
public function register(ProductInterface $product, ChannelInterface $channel, bool $createOnly = false);

/**
* @param ProductInterface $product
* @param ChannelInterface $channel
* @return array|false
*/
public function unregister(ProductInterface $product, ChannelInterface $channel);
}

0 comments on commit 9d11456

Please sign in to comment.