Skip to content

Commit

Permalink
Deprecate old methods
Browse files Browse the repository at this point in the history
  • Loading branch information
arti0090 committed Jun 16, 2021
1 parent 7bb4533 commit 1d9d77d
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 5 deletions.
12 changes: 10 additions & 2 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,19 @@
}
```

1. The getter methods of `Sylius\RefundPlugin\Entity\CustomerBillingData` has been changed:
1. The `id` method from `Sylius\RefundPlugin\Entity\CustomerBillingData` has its return type removed:

```diff
- public function id(): ?int;
+ public function id();
```


1. The getter methods of `Sylius\RefundPlugin\Entity\CustomerBillingData` are now deprecated and will be replaced with:

```diff
- public function id(): ?int
+ public function getId(): ?int
+ public function getId()
- public function firstName(): string
+ public function getFirstName(): string
- public function lastName(): string
Expand Down
70 changes: 68 additions & 2 deletions src/Entity/CustomerBillingData.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,28 @@ class CustomerBillingData implements CustomerBillingDataInterface
/** @var string|null */
protected $provinceCode;

public function getId(): ?int
/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getId() instead */
public function id()
{
return $this->id;
}

public function setId(?int $id): void
public function getId()
{
return $this->id;
}

public function setId($id): void
{
$this->id = $id;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getFirstName() instead */
public function firstName(): string
{
return $this->firstName;
}

public function getFirstName(): string
{
return $this->firstName;
Expand All @@ -66,6 +78,12 @@ public function setFirstName(string $firstName): void
$this->firstName = $firstName;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getLastName() instead */
public function lastName(): string
{
return $this->lastName;
}

public function getLastName(): string
{
return $this->lastName;
Expand All @@ -76,11 +94,23 @@ public function setLastName(string $lastName): void
$this->lastName = $lastName;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getFullName() instead */
public function fullName(): string
{
return trim(sprintf('%s %s', $this->firstName, $this->lastName));
}

public function getFullName(): string
{
return trim(sprintf('%s %s', $this->firstName, $this->lastName));
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getStreet() instead */
public function street(): string
{
return $this->street;
}

public function getStreet(): string
{
return $this->street;
Expand All @@ -91,6 +121,12 @@ public function setStreet(string $street): void
$this->street = $street;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getPostcode() instead */
public function postcode(): string
{
return $this->postcode;
}

public function getPostcode(): string
{
return $this->postcode;
Expand All @@ -101,6 +137,12 @@ public function setPostcode(string $postcode): void
$this->postcode = $postcode;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getCountryCode() instead */
public function countryCode(): string
{
return $this->countryCode;
}

public function getCountryCode(): string
{
return $this->countryCode;
Expand All @@ -111,6 +153,12 @@ public function setCountryCode(string $countryCode): void
$this->countryCode = $countryCode;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getCity() instead */
public function city(): string
{
return $this->city;
}

public function getCity(): string
{
return $this->city;
Expand All @@ -121,6 +169,12 @@ public function setCity(string $city): void
$this->city = $city;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getCompany() instead */
public function company(): ?string
{
return $this->company;
}

public function getCompany(): ?string
{
return $this->company;
Expand All @@ -131,6 +185,12 @@ public function setCompany(?string $company): void
$this->company = $company;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getProvinceName() instead */
public function provinceName(): ?string
{
return $this->provinceName;
}

public function getProvinceName(): ?string
{
return $this->provinceName;
Expand All @@ -141,6 +201,12 @@ public function setProvinceName(?string $provinceName): void
$this->provinceName = $provinceName;
}

/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingData::getProvinceCode() instead */
public function provinceCode(): ?string
{
return $this->provinceCode;
}

public function getProvinceCode(): ?string
{
return $this->provinceCode;
Expand Down
5 changes: 4 additions & 1 deletion src/Entity/CustomerBillingDataInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

interface CustomerBillingDataInterface extends ResourceInterface
{
public function setId(?int $id): void;
/** @deprecated this function is deprecated and will be removed in v1.0.0. Use CustomerBillingDataInterface::getId() instead */
public function id();

public function setId($id): void;

public function getFirstName(): string;

Expand Down

0 comments on commit 1d9d77d

Please sign in to comment.