Skip to content

Commit 0c5c9af

Browse files
Started v2.0-dev
- Interfaces have been streamlined - Upgrade to Enum v3 - Dropped PHP 7.2 - Dropped Laravel 5
1 parent e599455 commit 0c5c9af

17 files changed

+65
-82
lines changed

.editorconfig

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.yml]
18+
indent_size = 2

.gitattributes

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
* text=auto
2+
3+
/tests export-ignore
4+
.editorconfig export-ignore
5+
.gitattributes export-ignore
6+
.gitignore export-ignore
7+
.travis.yml export-ignore
8+
.styleci.yml export-ignore
9+
phpunit.xml export-ignore

.travis.yml

+5-22
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,10 @@ cache:
44
- "$HOME/.composer/cache"
55

66
php:
7-
- '7.2'
87
- '7.3'
98
- '7.4'
109

1110
env:
12-
- LARAVEL=5.5
13-
- LARAVEL=5.5 TEST_DB_ENGINE=mysql
14-
- LARAVEL=5.5 TEST_DB_ENGINE=pgsql
15-
- LARAVEL=5.6
16-
- LARAVEL=5.7
17-
- LARAVEL=5.8
18-
- LARAVEL=5.8 TEST_DB_ENGINE=mysql
19-
- LARAVEL=5.8 TEST_DB_ENGINE=pgsql
2011
- LARAVEL=6.0
2112
- LARAVEL=6.18
2213
- LARAVEL=6.18 TEST_DB_ENGINE=mysql
@@ -26,24 +17,16 @@ env:
2617
- LARAVEL=7.28 TEST_DB_ENGINE=mysql
2718
- LARAVEL=7.28 TEST_DB_ENGINE=pgsql
2819
- LARAVEL=8.0
29-
- LARAVEL=8.0 TEST_DB_ENGINE=mysql
30-
- LARAVEL=8.0 TEST_DB_ENGINE=pgsql
20+
- LARAVEL=8.6
21+
- LARAVEL=8.6 TEST_DB_ENGINE=mysql
22+
- LARAVEL=8.6 TEST_DB_ENGINE=pgsql
3123

32-
matrix:
33-
exclude:
34-
- php: '7.2'
35-
env: 'LARAVEL=8.0'
36-
- php: '7.2'
37-
env: 'LARAVEL=8.0 TEST_DB_ENGINE=mysql'
38-
- php: '7.2'
39-
env: 'LARAVEL=8.0 TEST_DB_ENGINE=pgsql'
4024

4125
script:
4226
- vendor/bin/phpunit --testdox
4327
before_install:
44-
- MINOR=`echo $LARAVEL | sed 's/[5|6|7|8]\.\([0-9]\+\)/\1/'`
45-
- '[[ $LARAVEL =~ ^6\.[0-9]+$ ]] && MAJOR=6 || MAJOR=5'
46-
- '[[ $LARAVEL =~ ^7\.[0-9]+$ ]] && MAJOR=7 || true'
28+
- MINOR=`echo $LARAVEL | sed 's/[6|7|8]\.\([0-9]\+\)/\1/'`
29+
- '[[ $LARAVEL =~ ^7\.[0-9]+$ ]] && MAJOR=7 || MAJOR=6'
4730
- '[[ $LARAVEL =~ ^8\.[0-9]+$ ]] && MAJOR=8 || true'
4831
- echo "Testing against Laravel ${MAJOR}.${MINOR}"
4932
- composer require "illuminate/support:${MAJOR}.${MINOR}.*" --no-update -v

Changelog.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Address Module Changelog
22

3+
## Unreleased
4+
##### 2020-XX-YY
5+
6+
- BC: Address, Country and Person interfaces have been extended
7+
- BC: Enums have been upgraded to v3
8+
- Dropped Laravel 5 support
9+
- Dropped PHP 7.2 support
10+
311
## 1.3.0
412
##### 2020-09-12
513

composer.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"issues": "https://github.com/artkonekt/address"
1616
},
1717
"require": {
18-
"php": "^7.2",
18+
"php": "^7.3",
1919
"doctrine/dbal": "~2.3, !=2.10.3",
20-
"konekt/concord": "~1.5",
21-
"konekt/enum": "~2.1",
20+
"konekt/concord": "~1.6",
21+
"konekt/enum": "~3.0",
2222
"konekt/enum-eloquent": "~1.5"
2323
},
2424
"autoload": {
@@ -29,8 +29,8 @@
2929
},
3030
"require-dev": {
3131
"ext-sqlite3": "*",
32-
"orchestra/testbench": "~3.5|~4.0|~5.0|~6.0",
33-
"phpunit/phpunit" : "6.2 - 7.5|~8.0|~9.0",
32+
"orchestra/testbench": "~4.0|~5.0|~6.0",
33+
"phpunit/phpunit" : "~8.0|~9.0",
3434
"mockery/mockery": "^1.1"
3535
},
3636
"autoload-dev": {

phpunit.xml.dist

-33
This file was deleted.

src/Contracts/Address.php

+5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111

1212
namespace Konekt\Address\Contracts;
1313

14+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
15+
1416
interface Address
1517
{
18+
public function country(): BelongsTo;
19+
20+
public function province(): BelongsTo;
1621
}

src/Contracts/Country.php

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Konekt\Address\Contracts;
1313

14+
use Illuminate\Database\Eloquent\Relations\HasMany;
15+
1416
interface Country
1517
{
18+
public function provinces(): HasMany;
1619
}

src/Contracts/Person.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ interface Person
1515
{
1616
/**
1717
* Returns the full name of the person (in appropriate name order)
18-
*
19-
* @return string
2018
*/
21-
public function getFullName();
19+
public function getFullName(): string;
2220
}

src/Models/Address.php

+3-12
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Konekt\Address\Models;
1313

1414
use Illuminate\Database\Eloquent\Model;
15+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
1516
use Konekt\Address\Contracts\Address as AddressContract;
1617
use Konekt\Enum\Eloquent\CastsEnums;
1718

@@ -43,22 +44,12 @@ class Address extends Model implements AddressContract
4344
*/
4445
protected $table = 'addresses';
4546

46-
/**
47-
* Relationship to the country the address belongs to
48-
*
49-
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
50-
*/
51-
public function country()
47+
public function country(): BelongsTo
5248
{
5349
return $this->belongsTo(CountryProxy::modelClass(), 'country_id');
5450
}
5551

56-
/**
57-
* Relationship to the province the address belongs to
58-
*
59-
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
60-
*/
61-
public function province()
52+
public function province(): BelongsTo
6253
{
6354
return $this->belongsTo(ProvinceProxy::modelClass(), 'province_id');
6455
}

src/Models/AddressType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
class AddressType extends Enum implements AddressTypeContract
2828
{
29-
const __default = self::UNDEFINED;
29+
const __DEFAULT = self::UNDEFINED;
3030

3131
/** To display on Invoices */
3232
const BILLING = 'billing';

src/Models/Country.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Konekt\Address\Models;
1313

1414
use Illuminate\Database\Eloquent\Model;
15+
use Illuminate\Database\Eloquent\Relations\HasMany;
1516
use Illuminate\Support\Collection;
1617
use Konekt\Address\Contracts\Country as CountryContract;
1718

@@ -50,7 +51,7 @@ class Country extends Model implements CountryContract
5051
'is_eu_member' => 'bool'
5152
];
5253

53-
public function provinces()
54+
public function provinces(): HasMany
5455
{
5556
return $this->hasMany(ProvinceProxy::modelClass(), 'country_id', 'id');
5657
}

src/Models/NameOrder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
class NameOrder extends Enum implements NameOrderContract
1818
{
19-
const __default = self::WESTERN;
19+
const __DEFAULT = self::WESTERN;
2020

2121
const WESTERN = 'western';
2222
const EASTERN = 'eastern';

src/Models/Person.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class Person extends Model implements PersonContract
6161
/**
6262
* @inheritdoc
6363
*/
64-
public function getFullName()
64+
public function getFullName(): string
6565
{
6666
if ($this->nameorder && $this->nameorder->isEastern()) {
6767
return sprintf('%s %s', $this->lastname, $this->firstname);

src/Models/ProvinceType.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
class ProvinceType extends Enum implements ProvinceTypeContract
2929
{
30-
const __default = self::PROVINCE;
30+
const __DEFAULT = self::PROVINCE;
3131

3232
const STATE = 'state';
3333
const REGION = 'region';

src/resources/manifest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
return [
44
'name' => 'Konekt Address Module',
5-
'version' => '1.3.0'
5+
'version' => '2.0-dev'
66
];

tests/AddressTypeTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function can_be_instantiated()
2424
$type = new AddressType();
2525

2626
$this->assertNotNull($type);
27-
$this->assertEquals(AddressType::__default, $type->value());
27+
$this->assertEquals(AddressType::defaultValue(), $type->value());
2828

2929
$shipping = AddressType::SHIPPING();
3030
$this->assertTrue($shipping->equals(AddressTypeProxy::SHIPPING()));

0 commit comments

Comments
 (0)