Skip to content

Commit

Permalink
Add type hints
Browse files Browse the repository at this point in the history
* Add correct type hints `float` instead of `int` since the Interface expect `floats`.
* Declare for strict types
  • Loading branch information
Konafets authored and pamil committed Dec 12, 2018
1 parent 20c4847 commit ff50446
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions docs/components_and_bundles/components/Shipping/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ In all examples is used an exemplary class implementing **ShippableInterface**,
<?php
declare(strict_types=1);
use Sylius\Component\Shipping\Model\ShippableInterface;
use Sylius\Component\Shipping\Model\ShippingCategoryInterface;
Expand All @@ -20,66 +22,66 @@ In all examples is used an exemplary class implementing **ShippableInterface**,
private $category;
/**
* @var int
* @var float
*/
private $weight;
/**
* @var int
* @var float
*/
private $volume;
/**
* @var int
* @var float
*/
private $width;
/**
* @var int
* @var float
*/
private $height;
/**
* @var int
* @var float
*/
private $depth;
/**
* {@inheritdoc}
*/
public function getShippingWeight()
public function getShippingWeight(): float
{
return $this->weight;
}
/**
* @param int $weight
* {@inheritdoc}
*/
public function setShippingWeight($weight)
public function setShippingWeight(float $weight): void
{
$this->weight = $weight;
}
/**
* {@inheritdoc}
*/
public function getShippingVolume()
public function getShippingVolume(): float
{
return $this->volume;
}
/**
* @param int $volume
*/
public function setShippingVolume($volume)
public function setShippingVolume(float $volume)
{
$this->volume = $volume;
}
/**
* {@inheritdoc}
*/
public function getShippingWidth()
public function getShippingWidth(): float
{
return $this->width;
}
Expand All @@ -88,53 +90,53 @@ In all examples is used an exemplary class implementing **ShippableInterface**,
/**
* {@inheritdoc}
*/
public function setShippingWidth($width)
public function setShippingWidth(float $width)
{
$this->width = $width;
}
/**
* {@inheritdoc}
*/
public function getShippingHeight()
public function getShippingHeight(): float
{
return $this->height;
}
/**
* {@inheritdoc}
*/
public function setShippingHeight($height)
public function setShippingHeight(float $height)
{
$this->height = $height;
}
/**
* {@inheritdoc}
*/
public function getShippingDepth()
public function getShippingDepth(): float
{
return $this->depth;
}
/**
* {@inheritdoc}
*/
public function setShippingDepth($depth)
public function setShippingDepth(float $depth)
{
$this->depth = $depth;
}
/**
* {@inheritdoc}
*/
public function getShippingCategory()
public function getShippingCategory(): ShippingCategoryInterface
{
return $this->category;
}
/**
* @param ShippingCategoryInterface $category
* {@inheritdoc}
*/
public function setShippingCategory(ShippingCategoryInterface $category)
{
Expand Down

0 comments on commit ff50446

Please sign in to comment.