Skip to content

Commit a054c3f

Browse files
authored
feature/MT-342 Upgrade to php 8.1 (#204)
* feat: upgrade php version to 8.0
1 parent 6122a1a commit a054c3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+3351
-3430
lines changed

.editorconfig

-12
This file was deleted.

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# OS
2+
.docker
23
.DS_Store
34
*~
45
# Composer
@@ -11,3 +12,7 @@ README.txt
1112
.phpunit.result.cache
1213
demos/
1314
extras/documentation
15+
/.idea
16+
.php-cs-fixer.cache
17+
.php-cs-fixer.php
18+
.env.dist

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [5.0.0](https://github.com/conekta/conekta-php/pull/204) - 2022-06-15
2+
3+
[Full Changelog](https://github.com/conekta/conekta-php/compare/v4.3.0...v5.0.0)
4+
5+
### Feature
6+
- Upgrade php version to 8.0
7+
18
## [4.3.0](https://github.com/conekta/conekta-php/releases/tag/v4.3.0) - 2020-07-07
29
### Feature
310
- Add models to support payment link (aka checkout).

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This is a PHP library that allows interaction with [Conekta's API](https://api.c
1313

1414
## Requeriments
1515

16-
PHPUnit ~8 requires PHP 7.2+; using the latest version of PHP is highly recommended.
16+
PHPUnit ~8 requires PHP 8.0+; using the latest version of PHP is highly recommended.
1717

1818
## Installation
1919

@@ -27,7 +27,7 @@ To get started, add the following to your PHP script:
2727

2828
You can also install this library with [Composer](https://github.com/composer/composer):
2929

30-
require: "conekta/conekta-php": "4.3.0"
30+
require: "conekta/conekta-php": "5.0.0"
3131

3232
## Usage
3333

@@ -105,7 +105,7 @@ PHPUnit 8.5.2 by Sebastian Bergmann and contributors.
105105
PHP version used
106106

107107
```
108-
PHP 7.4.24 (cli)
108+
PHP 8.0 (cli)
109109
```
110110

111111
Run test suite:
@@ -114,7 +114,7 @@ Run test suite:
114114
phpunit test/Conekta-x.0
115115
```
116116

117-
_note:_ for this PHPUnit version (8.x) only PHP 7.2+ is supported for older PHP versions see PHPunit <a href="https://phpunit.de/"> documentation</a>
117+
_note:_ for this PHPUnit version (8.x) only PHP 8.0+ is supported for older PHP versions see PHPunit <a href="https://phpunit.de/"> documentation</a>
118118

119119
## Changelog
120120

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616
],
1717
"require": {
18-
"php": ">=7.2",
18+
"php": ">=8.0",
1919
"ext-curl": "*",
2020
"ext-json": "*",
2121
"ext-mbstring": "*"

lib/Conekta.php

+43-43
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
<?php
22

3-
if (!function_exists('curl_init')) {
3+
if (! function_exists('curl_init')) {
44
throw new Exception('Conekta needs the CURL PHP extension.');
55
}
6-
if (!function_exists('json_decode')) {
6+
if (! function_exists('json_decode')) {
77
throw new Exception('Conekta needs the JSON PHP extension.');
88
}
9-
if (!function_exists('mb_detect_encoding')) {
9+
if (! function_exists('mb_detect_encoding')) {
1010
throw new Exception('Conekta needs the Multibyte String PHP extension.');
1111
}
12-
if (!function_exists('get_called_class')) {
12+
if (! function_exists('get_called_class')) {
1313
throw new Exception('Conekta needs to be run on PHP >= 5.3.0.');
1414
}
15-
require_once dirname(__FILE__).'/Conekta/Lang.php';
16-
require_once dirname(__FILE__).'/Conekta/Conekta.php';
17-
require_once dirname(__FILE__).'/Conekta/Util.php';
18-
require_once dirname(__FILE__).'/Conekta/Requestor.php';
19-
require_once dirname(__FILE__).'/Conekta/ConektaObject.php';
20-
require_once dirname(__FILE__).'/Conekta/ConektaResource.php';
21-
require_once dirname(__FILE__).'/Conekta/Charge.php';
22-
require_once dirname(__FILE__).'/Conekta/PaymentMethod.php';
23-
require_once dirname(__FILE__).'/Conekta/Customer.php';
24-
require_once dirname(__FILE__).'/Conekta/Card.php';
25-
require_once dirname(__FILE__).'/Conekta/Plan.php';
26-
require_once dirname(__FILE__).'/Conekta/Subscription.php';
27-
require_once dirname(__FILE__).'/Conekta/Token.php';
28-
require_once dirname(__FILE__).'/Conekta/Event.php';
29-
require_once dirname(__FILE__).'/Conekta/Payout.php';
30-
require_once dirname(__FILE__).'/Conekta/Payee.php';
31-
require_once dirname(__FILE__).'/Conekta/PayoutMethod.php';
32-
require_once dirname(__FILE__).'/Conekta/Method.php';
33-
require_once dirname(__FILE__).'/Conekta/Address.php';
34-
require_once dirname(__FILE__).'/Conekta/Webhook.php';
35-
require_once dirname(__FILE__).'/Conekta/WebhookLog.php';
36-
require_once dirname(__FILE__).'/Conekta/Log.php';
37-
require_once dirname(__FILE__).'/Conekta/Order.php';
38-
require_once dirname(__FILE__).'/Conekta/PaymentSource.php';
39-
require_once dirname(__FILE__).'/Conekta/TaxLine.php';
40-
require_once dirname(__FILE__).'/Conekta/DiscountLine.php';
41-
require_once dirname(__FILE__).'/Conekta/ShippingLine.php';
42-
require_once dirname(__FILE__).'/Conekta/LineItem.php';
43-
require_once dirname(__FILE__).'/Conekta/ConektaList.php';
44-
require_once dirname(__FILE__).'/Conekta/ShippingContact.php';
45-
require_once dirname(__FILE__).'/Conekta/Checkout.php';
46-
require_once dirname(__FILE__).'/Conekta/Exceptions/Handler.php';
47-
require_once dirname(__FILE__).'/Conekta/Exceptions/ApiError.php';
48-
require_once dirname(__FILE__).'/Conekta/Exceptions/AuthenticationError.php';
49-
require_once dirname(__FILE__).'/Conekta/Exceptions/MalformedRequestError.php';
50-
require_once dirname(__FILE__).'/Conekta/Exceptions/NoConnectionError.php';
51-
require_once dirname(__FILE__).'/Conekta/Exceptions/ParameterValidationError.php';
52-
require_once dirname(__FILE__).'/Conekta/Exceptions/ProcessingError.php';
53-
require_once dirname(__FILE__).'/Conekta/Exceptions/ResourceNotFoundError.php';
15+
require_once dirname(__FILE__) . '/Conekta/Lang.php';
16+
require_once dirname(__FILE__) . '/Conekta/Conekta.php';
17+
require_once dirname(__FILE__) . '/Conekta/Util.php';
18+
require_once dirname(__FILE__) . '/Conekta/Requestor.php';
19+
require_once dirname(__FILE__) . '/Conekta/ConektaObject.php';
20+
require_once dirname(__FILE__) . '/Conekta/ConektaResource.php';
21+
require_once dirname(__FILE__) . '/Conekta/Charge.php';
22+
require_once dirname(__FILE__) . '/Conekta/PaymentMethod.php';
23+
require_once dirname(__FILE__) . '/Conekta/Customer.php';
24+
require_once dirname(__FILE__) . '/Conekta/Card.php';
25+
require_once dirname(__FILE__) . '/Conekta/Plan.php';
26+
require_once dirname(__FILE__) . '/Conekta/Subscription.php';
27+
require_once dirname(__FILE__) . '/Conekta/Token.php';
28+
require_once dirname(__FILE__) . '/Conekta/Event.php';
29+
require_once dirname(__FILE__) . '/Conekta/Payout.php';
30+
require_once dirname(__FILE__) . '/Conekta/Payee.php';
31+
require_once dirname(__FILE__) . '/Conekta/PayoutMethod.php';
32+
require_once dirname(__FILE__) . '/Conekta/Method.php';
33+
require_once dirname(__FILE__) . '/Conekta/Address.php';
34+
require_once dirname(__FILE__) . '/Conekta/Webhook.php';
35+
require_once dirname(__FILE__) . '/Conekta/WebhookLog.php';
36+
require_once dirname(__FILE__) . '/Conekta/Log.php';
37+
require_once dirname(__FILE__) . '/Conekta/Order.php';
38+
require_once dirname(__FILE__) . '/Conekta/PaymentSource.php';
39+
require_once dirname(__FILE__) . '/Conekta/TaxLine.php';
40+
require_once dirname(__FILE__) . '/Conekta/DiscountLine.php';
41+
require_once dirname(__FILE__) . '/Conekta/ShippingLine.php';
42+
require_once dirname(__FILE__) . '/Conekta/LineItem.php';
43+
require_once dirname(__FILE__) . '/Conekta/ConektaList.php';
44+
require_once dirname(__FILE__) . '/Conekta/ShippingContact.php';
45+
require_once dirname(__FILE__) . '/Conekta/Checkout.php';
46+
require_once dirname(__FILE__) . '/Conekta/Exceptions/Handler.php';
47+
require_once dirname(__FILE__) . '/Conekta/Exceptions/ApiError.php';
48+
require_once dirname(__FILE__) . '/Conekta/Exceptions/AuthenticationError.php';
49+
require_once dirname(__FILE__) . '/Conekta/Exceptions/MalformedRequestError.php';
50+
require_once dirname(__FILE__) . '/Conekta/Exceptions/NoConnectionError.php';
51+
require_once dirname(__FILE__) . '/Conekta/Exceptions/ParameterValidationError.php';
52+
require_once dirname(__FILE__) . '/Conekta/Exceptions/ProcessingError.php';
53+
require_once dirname(__FILE__) . '/Conekta/Exceptions/ResourceNotFoundError.php';

lib/Conekta/Address.php

+17-20
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,26 @@
1-
<?php
1+
<?php
22

33
namespace Conekta;
44

5-
use \Conekta\ConektaResource;
6-
75
class Address extends ConektaResource
86
{
9-
var $street1 = "";
10-
var $street2 = "";
11-
var $street3 = "";
12-
var $city = "";
13-
var $state = "";
14-
var $zip = "";
15-
var $country = "";
7+
public string $street1;
8+
public string $street2;
9+
public string $street3;
10+
public string $city;
11+
public string $state;
12+
public string $zip;
13+
public string $country;
1614

17-
public function __get($property)
18-
{
19-
if (property_exists($this, $property)) {
20-
return $this->$property;
15+
public function __get($property)
16+
{
17+
if (property_exists($this, $property)) {
18+
return $this->{$property};
19+
}
2120
}
22-
}
23-
24-
public function __isset($property)
25-
{
26-
return isset($this->$property);
27-
}
2821

22+
public function __isset($property)
23+
{
24+
return isset($this->{$property});
25+
}
2926
}

lib/Conekta/Card.php

+44-48
Original file line numberDiff line numberDiff line change
@@ -2,56 +2,52 @@
22

33
namespace Conekta;
44

5-
use \Conekta\ConektaResource;
6-
use \Conekta\Lang;
7-
use \Conekta\Exceptions;
8-
use \Conekta\Conekta;
5+
use Conekta\{Conekta, ConektaResource, Exceptions, Lang};
96

107
class Card extends ConektaResource
118
{
12-
var $createdAt = "";
13-
var $last4 = "";
14-
var $bin = "";
15-
var $name = "";
16-
var $expMonth = "";
17-
var $expYear = "";
18-
var $brand = "";
19-
var $parentId = "";
20-
var $default = "";
21-
22-
public function __get($property)
23-
{
24-
if (property_exists($this, $property)) {
25-
return $this->$property;
9+
public string $createdAt;
10+
public string $last4;
11+
public string $bin;
12+
public string $name;
13+
public string $expMonth;
14+
public string $expYear;
15+
public string $brand;
16+
public string $parentId;
17+
public string $default;
18+
19+
public function __get($property)
20+
{
21+
if (property_exists($this, $property)) {
22+
return $this->{$property};
23+
}
24+
}
25+
26+
public function __isset($property)
27+
{
28+
return isset($this->{$property});
29+
}
30+
31+
public function instanceUrl()
32+
{
33+
$this->apiVersion = Conekta::$apiVersion;
34+
$id = $this->id;
35+
parent::idValidator($id);
36+
$class = get_class($this);
37+
$base = $this->classUrl($class);
38+
$extn = urlencode($id);
39+
$customerUrl = $this->customer->instanceUrl();
40+
41+
return $customerUrl . $base . "/{$extn}";
42+
}
43+
44+
public function update($params = null)
45+
{
46+
return parent::_update($params);
47+
}
48+
49+
public function delete()
50+
{
51+
return parent::_delete('customer', 'cards');
2652
}
27-
}
28-
29-
public function __isset($property)
30-
{
31-
return isset($this->$property);
32-
}
33-
34-
35-
public function instanceUrl()
36-
{
37-
$this->apiVersion = Conekta::$apiVersion;
38-
$id = $this->id;
39-
parent::idValidator($id);
40-
$class = get_class($this);
41-
$base = $this->classUrl($class);
42-
$extn = urlencode($id);
43-
$customerUrl = $this->customer->instanceUrl();
44-
45-
return $customerUrl . $base . "/{$extn}";
46-
}
47-
48-
public function update($params = null)
49-
{
50-
return parent::_update($params);
51-
}
52-
53-
public function delete()
54-
{
55-
return parent::_delete('customer', 'cards');
56-
}
5753
}

0 commit comments

Comments
 (0)