Skip to content

Commit

Permalink
Don't allow NULL values as return value for getSiteId()
Browse files Browse the repository at this point in the history
  • Loading branch information
aimeos committed Jan 22, 2021
1 parent 95f9ec9 commit ad99576
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
6 changes: 3 additions & 3 deletions lib/mshoplib/src/MShop/Catalog/Item/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ public function setId( string $id = null ) : \Aimeos\MShop\Common\Item\Iface
/**
* Returns the site ID of the item.
*
* @return string|null Site ID of the item
* @return string Site ID of the item
*/
public function getSiteId() : ?string
public function getSiteId() : string
{
return ( $this->node->__isset( 'siteid' ) ? (string) $this->node->__get( 'siteid' ) : null );
return ( $this->node->__isset( 'siteid' ) ? (string) $this->node->__get( 'siteid' ) : '' );
}


Expand Down
5 changes: 2 additions & 3 deletions lib/mshoplib/src/MShop/Common/Item/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,9 @@ public function setId( ?string $id ) : \Aimeos\MShop\Common\Item\Iface
/**
* Returns the site ID of the item.
*
* @return string|null Site ID or null if no site id is available
* @todo 2021.01 Don't allow NULL for returned value
* @return string Site ID or null if no site id is available
*/
public function getSiteId() : ?string
public function getSiteId() : string
{
return $this->get( $this->prefix . 'siteid', $this->get( 'siteid', '' ) );
}
Expand Down
4 changes: 2 additions & 2 deletions lib/mshoplib/src/MShop/Common/Item/Iface.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ public function setId( ?string $id ) : \Aimeos\MShop\Common\Item\Iface;
/**
* Returns the ID of the site the item is stored
*
* @return string|null Site ID (or null if not available)
* @return string Site ID (or null if not available)
*/
public function getSiteId() : ?string;
public function getSiteId() : string;

/**
* Returns the create date of the item.
Expand Down
6 changes: 3 additions & 3 deletions lib/mshoplib/src/MShop/Locale/Item/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ public function getSitePath() : array
/**
* Returns the Site ID of the item.
*
* @return string|null Site ID (or null for global site)
* @return string Site ID (or null for global site)
*/
public function getSiteId() : ?string
public function getSiteId() : string
{
return $this->get( 'locale.siteid' );
return $this->get( 'locale.siteid', '' );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public function __construct( array $values = [] )
/**
* Returns the ID of the site the item is stored
*
* @return string|null Site ID (or null if not available)
* @return string Site ID (or null if not available)
*/
public function getSiteId() : ?string
public function getSiteId() : string
{
return $this->get( 'order.base.product.attribute.siteid' );
return $this->get( 'order.base.product.attribute.siteid', '' );
}


Expand Down
6 changes: 3 additions & 3 deletions lib/mshoplib/src/MShop/Order/Item/Base/Product/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public function getSupplierItem() : ?\Aimeos\MShop\Supplier\Item\Iface
/**
* Returns the ID of the site the item is stored
*
* @return string|null Site ID (or null if not available)
* @return string Site ID (or null if not available)
*/
public function getSiteId() : ?string
public function getSiteId() : string
{
return $this->get( 'order.base.product.siteid' );
return $this->get( 'order.base.product.siteid', '' );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function __construct( array $values = [] )
/**
* Returns the ID of the site the item is stored
*
* @return string|null Site ID (or null if not available)
* @return string Site ID (or null if not available)
*/
public function getSiteId() : ?string
public function getSiteId() : string
{
return $this->get( 'order.base.service.attribute.siteid' );
return $this->get( 'order.base.service.attribute.siteid', '' );
}


Expand Down
6 changes: 3 additions & 3 deletions lib/mshoplib/src/MShop/Order/Item/Base/Service/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public function getServiceItem() : ?\Aimeos\MShop\Service\Item\Iface
/**
* Returns the ID of the site the item is stored
*
* @return string|null Site ID (or null if not available)
* @return string Site ID (or null if not available)
*/
public function getSiteId() : ?string
public function getSiteId() : string
{
return $this->get( 'order.base.service.siteid' );
return $this->get( 'order.base.service.siteid', '' );
}


Expand Down
6 changes: 3 additions & 3 deletions lib/mshoplib/src/MShop/Order/Item/Base/Standard.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ public function setId( ?string $id ) : \Aimeos\MShop\Common\Item\Iface
/**
* Returns the ID of the site the item is stored.
*
* @return string|null Site ID (or null if not available)
* @return string Site ID (or null if not available)
*/
public function getSiteId() : ?string
public function getSiteId() : string
{
return $this->get( 'order.base.siteid' );
return $this->get( 'order.base.siteid', '' );
}


Expand Down

0 comments on commit ad99576

Please sign in to comment.