Skip to content

Commit

Permalink
[Improvement] Revalidate phpdoc types (pimcore#13755)
Browse files Browse the repository at this point in the history
* changed doctypes

* changed doctypes

* changed doctypes

* changed doctypes

* changed doctypes

* Update bundles/EcommerceFrameworkBundle/CartManager/AbstractCart.php

Co-authored-by: Sebastian Blank <[email protected]>

* Update bundles/EcommerceFrameworkBundle/EnvironmentInterface.php

Co-authored-by: Sebastian Blank <[email protected]>

* fixed phpstan

* fixed phpstan

* removed phpstan error

* changed doctypes according to new type

* changed doctypes according to new type

* changed doctypes according to new type

* revert changes

* changed doctypes according to new type

* changed doctypes according to new type

* changed doctypes according to new type

* changed doctypes according to new type

* fixed phpstan issues

* Update CustomLayout.php

* Update CustomLayout.php

* Update models/DataObject/ClassDefinition/CustomLayout.php

Co-authored-by: Sebastian Blank <[email protected]>

* Update doc/Development_Documentation/23_Installation_and_Upgrade/09_Upgrade_Notes/README.md

Co-authored-by: mcop1 <[email protected]>

Co-authored-by: Sebastian Blank <[email protected]>
Co-authored-by: mcop1 <[email protected]>
  • Loading branch information
3 people authored Dec 22, 2022
1 parent 9deedfd commit 25ad315
Show file tree
Hide file tree
Showing 84 changed files with 530 additions and 402 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Pimcore\Model\Schedule\Task;
use Pimcore\Model\Version;
use Pimcore\Tool;
use Pimcore\Model\Element\ElementInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand Down Expand Up @@ -235,14 +236,15 @@ private function buildChildrenCondition(DataObject\AbstractObject $object, ?stri
}

/**
* @param DataObject\AbstractObject $element
* @param ElementInterface $element
*
* @return array
*
* @throws \Exception
*/
protected function getTreeNodeConfig($element): array
{
/** @var DataObject $child */
$child = $element;

$tmpObject = [
Expand Down
8 changes: 5 additions & 3 deletions bundles/EcommerceFrameworkBundle/CartManager/AbstractCart.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
abstract class AbstractCart extends AbstractModel implements CartInterface
{
/**
* @var int
* @var int|null
*/
protected $userId;

Expand Down Expand Up @@ -331,6 +331,8 @@ public function clear()
* @param string $countSubItems - use one of COUNT_MAIN_ITEMS_ONLY, COUNT_MAIN_OR_SUB_ITEMS, COUNT_MAIN_AND_SUB_ITEMS
*
* @return int
*
* @throws InvalidConfigException
*/
public function getItemAmount(string $countSubItems = self::COUNT_MAIN_ITEMS_ONLY)
{
Expand Down Expand Up @@ -624,7 +626,7 @@ public function setCreationDateTimestamp($creationDateTimestamp)
}

/**
* @return int
* @return int|null
*/
public function getCreationDateTimestamp()
{
Expand Down Expand Up @@ -778,7 +780,7 @@ public function modified()
/**
* @param int $count
*
* @return array<int, CartItemInterface>
* @return CartItemInterface[]
*/
public function getRecentlyAddedItems($count)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@

abstract class AbstractCartCheckoutData extends \Pimcore\Model\AbstractModel
{
/**
* @var string
*/
protected $key;

/**
* @var array|string|null
*/
protected $data;

/**
Expand All @@ -31,11 +37,17 @@ public function setCart(CartInterface $cart)
$this->cart = $cart;
}

/**
* @return CartInterface|null
*/
public function getCart()
{
return $this->cart;
}

/**
* @return int|string|null
*/
public function getCartId()
{
return $this->getCart()->getId();
Expand All @@ -56,21 +68,33 @@ public static function removeAllFromCart($cartId)
throw new \Exception('Not implemented.');
}

/**
* @param string $key
*/
public function setKey($key)
{
$this->key = $key;
}

/**
* @return string
*/
public function getKey()
{
return $this->key;
}

/**
* @param array|string|null $data
*/
public function setData($data)
{
$this->data = $data;
}

/**
* @return array|string|null
*/
public function getData()
{
return $this->data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ public static function getByKeyCartId($key, $cartId)
public static function removeAllFromCart($cartId)
{
$checkoutDataItem = new self();
$checkoutDataItem->getCart()->checkoutData = [];
$cart = $checkoutDataItem->getCart();
if ($cart instanceof SessionCart) {
$cart->checkoutData = [];
}
}

public function setCart(CartInterface $cart)
Expand All @@ -41,6 +44,9 @@ public function setCart(CartInterface $cart)
$this->cartId = $cart->getId();
}

/**
* @return CartInterface|null
*/
public function getCart()
{
if (empty($this->cart)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager\V7\CheckoutManager;
use Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager\V7\CheckoutManagerInterface;
use Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager\V7\HandlePendingPayments\CancelPaymentOrRecreateOrderStrategy;
use Pimcore\Bundle\EcommerceFrameworkBundle\CheckoutManager\V7\HandlePendingPayments\HandlePendingPaymentsStrategyInterface;
use Pimcore\Bundle\EcommerceFrameworkBundle\EnvironmentInterface;
use Pimcore\Bundle\EcommerceFrameworkBundle\OrderManager\OrderManagerLocatorInterface;
use Pimcore\Bundle\EcommerceFrameworkBundle\PaymentManager\V7\Payment\PaymentInterface;
Expand Down Expand Up @@ -53,7 +54,7 @@ class CheckoutManagerFactory implements CheckoutManagerFactoryInterface
protected $checkoutStepDefinitions = [];

/**
* @var PaymentInterface
* @var PaymentInterface|null
*/
protected $paymentProvider;

Expand All @@ -72,10 +73,13 @@ class CheckoutManagerFactory implements CheckoutManagerFactoryInterface
*/
protected $className = CheckoutManager::class;

/**
* @var HandlePendingPaymentsStrategyInterface|null
*/
protected $handlePendingPaymentStrategy = null;

/**
* @var EventDispatcherInterface
* @var EventDispatcherInterface|null
*/
protected $eventDispatcher = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use Pimcore\Bundle\EcommerceFrameworkBundle\CoreExtensions\ObjectData;
use Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\AbstractObject;
use Pimcore\Model\DataObject\ClassDefinition\Data;
use Pimcore\Model\DataObject\ClassDefinition\Data\QueryResourcePersistenceAwareInterface;
use Pimcore\Model\DataObject\ClassDefinition\Data\ResourcePersistenceAwareInterface;
Expand Down Expand Up @@ -92,15 +93,15 @@ public function getFilterGroups()
}

/**
* @param bool $multiPreSelect
* @param string $multiPreSelect
*/
public function setMultiPreSelect($multiPreSelect)
{
$this->multiPreSelect = $multiPreSelect;
}

/**
* @return bool
* @return string
*/
public function getMultiPreSelect()
{
Expand All @@ -124,13 +125,13 @@ public function getPredefinedPreSelectOptions()
}

/**
* @see ResourcePersistenceAwareInterface::getDataForResource
*
* @param ObjectData\IndexFieldSelection|null $data
* @param null|\Pimcore\Model\DataObject\AbstractObject $object
* @param mixed $data
* @param null|AbstractObject $object
* @param array $params
*
* @return array
*
* @see ResourcePersistenceAwareInterface::getDataForResource
*/
public function getDataForResource($data, $object = null, $params = [])
{
Expand All @@ -150,13 +151,13 @@ public function getDataForResource($data, $object = null, $params = [])
}

/**
* @see ResourcePersistenceAwareInterface::getDataFromResource
*
* @param array $data
* @param null|\Pimcore\Model\DataObject\AbstractObject $object
* @param mixed $params
* @param mixed $data
* @param null|AbstractObject $object
* @param array $params
*
* @return ObjectData\IndexFieldSelection|null
*
* @see ResourcePersistenceAwareInterface::getDataFromResource
*/
public function getDataFromResource($data, $object = null, $params = [])
{
Expand All @@ -168,27 +169,27 @@ public function getDataFromResource($data, $object = null, $params = [])
}

/**
* @see QueryResourcePersistenceAwareInterface::getDataForQueryResource
*
* @param ObjectData\IndexFieldSelection|null $data
* @param null|\Pimcore\Model\DataObject\AbstractObject $object
* @param mixed $params
* @param mixed $data
* @param null|AbstractObject $object
* @param array $params
*
* @return array
*
* @see QueryResourcePersistenceAwareInterface::getDataForQueryResource
*/
public function getDataForQueryResource($data, $object = null, $params = [])
{
return $this->getDataForResource($data, $object, $params);
}

/**
* @see Data::getDataForEditmode
*
* @param ObjectData\IndexFieldSelection|null $data
* @param null|\Pimcore\Model\DataObject\AbstractObject $object
* @param mixed $params
* @param mixed $data
* @param null|AbstractObject $object
* @param array $params
*
* @return array|null
*
* @see Data::getDataForEditmode
*/
public function getDataForEditmode($data, $object = null, $params = [])
{
Expand All @@ -204,13 +205,13 @@ public function getDataForEditmode($data, $object = null, $params = [])
}

/**
* @see Data::getDataFromEditmode
*
* @param array $data
* @param null|\Pimcore\Model\DataObject\AbstractObject $object
* @param null|AbstractObject $object
* @param array $params
*
* @return ObjectData\IndexFieldSelection|null
*
* @see Data::getDataFromEditmode
*/
public function getDataFromEditmode($data, $object = null, $params = [])
{
Expand Down
2 changes: 1 addition & 1 deletion bundles/EcommerceFrameworkBundle/EnvironmentInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getCurrentUserId();
*
* @param int $userId
*
* @return void
* @return $this
*/
public function setCurrentUserId($userId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function getSearchAttributes(): array;
/**
* return all supported filter types for product index
*
* @return array
* @return array|null
*/
public function getFilterTypeConfig();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ protected function configureOptionsResolver(string $resolverName, OptionsResolve
}

/**
* @param string $property
* @param string|null $property
*
* @return array|string
* @return array|string|null
*/
public function getClientConfig($property = null)
{
Expand Down
Loading

0 comments on commit 25ad315

Please sign in to comment.