Skip to content

Commit c11c191

Browse files
committed
Conform to PSR-12
1 parent 619c730 commit c11c191

39 files changed

Lines changed: 161 additions & 236 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ REMOVED:
88

99
FIXED:
1010

11+
## 0.7.1 - 2019-10-04
12+
13+
CHANGED:
14+
15+
- Improved PSR-12 conformance
16+
- Added more type hints
17+
1118
## 0.7.0 - 2019-08-21
1219

1320
CHANGED:

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
"phpstan/phpstan-phpunit": "^0.11.0",
2424
"phpstan/phpstan-strict-rules": "^0.11.0",
2525
"phpunit/phpunit": "^8.3.4",
26-
"squizlabs/php_codesniffer": "^3.4.0",
27-
"woohoolabs/coding-standard": "^2.0.1",
28-
"woohoolabs/releaser": "^1.1.0"
26+
"squizlabs/php_codesniffer": "^3.5.0",
27+
"woohoolabs/coding-standard": "^2.1.1",
28+
"woohoolabs/releaser": "^1.2.0"
2929
},
3030
"autoload": {
3131
"psr-4": {

composer.lock

Lines changed: 87 additions & 90 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/Domain/Course.php

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,13 @@
55

66
class Course
77
{
8-
/**
9-
* @var int
10-
*/
11-
private $id;
12-
13-
/**
14-
* @var
15-
*/
16-
private $name;
17-
18-
/**
19-
* @var string
20-
*/
21-
private $description;
22-
23-
/**
24-
* @var int
25-
*/
26-
private $credit;
27-
28-
/**
29-
* @var string
30-
*/
31-
private $language;
32-
33-
/**
34-
* @var SchoolClass[]
35-
*/
36-
private $classes;
8+
private int $id;
9+
private string $name;
10+
private string $description;
11+
private int $credit;
12+
private string $language;
13+
/** @var SchoolClass[] */
14+
private array $classes;
3715

3816
/**
3917
* @param SchoolClass[] $classes

examples/Domain/Name.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,8 @@
55

66
class Name
77
{
8-
/**
9-
* @var string
10-
*/
11-
private $firstName;
12-
13-
/**
14-
* @var string
15-
*/
16-
private $lastName;
8+
private string $firstName;
9+
private string $lastName;
1710

1811
public function __construct(string $firstName, string $lastName)
1912
{

examples/Domain/SchoolClass.php

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,12 @@
77

88
class SchoolClass
99
{
10-
/**
11-
* @var int
12-
*/
13-
private $id;
14-
15-
/**
16-
* @var int
17-
*/
18-
private $roomId;
19-
20-
/**
21-
* @var int
22-
*/
23-
private $teacherId;
24-
25-
/**
26-
* @var Student[]
27-
*/
28-
private $students;
29-
30-
/**
31-
* @var DateTimeImmutable
32-
*/
10+
private int $id;
11+
private int $roomId;
12+
private int $teacherId;
13+
/** @var Student[] */
14+
private array $students;
15+
/** @var DateTimeImmutable */
3316
private $datetime;
3417

3518
/**

examples/Domain/Student.php

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,11 @@
55

66
class Student
77
{
8-
/**
9-
* @var int
10-
*/
11-
private $id;
12-
13-
/**
14-
* @var Name
15-
*/
16-
private $name;
17-
18-
/**
19-
* @var string|null
20-
*/
21-
private $birthday;
22-
23-
/**
24-
* @var string|null
25-
*/
26-
private $gender;
27-
28-
/**
29-
* @var string
30-
*/
31-
private $introduction;
8+
private int $id;
9+
private Name $name;
10+
private ?string $birthday;
11+
private ?string $gender;
12+
private string $introduction;
3213

3314
public function __construct(int $id, Name $name, string $introduction, string $birthday = null, string $gender = null)
3415
{

examples/Infrastructure/Factory/AbstractFactory.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@
99

1010
abstract class AbstractFactory
1111
{
12-
/**
13-
* @var IdentityMap
14-
*/
15-
private $identityMap;
12+
private IdentityMap $identityMap;
1613

1714
public function __construct(IdentityMap $identityMap)
1815
{

examples/Infrastructure/Factory/ClassFactory.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,8 @@
1010

1111
class ClassFactory extends AbstractFactory
1212
{
13-
/**
14-
* @var ClassModel
15-
*/
16-
private $model;
17-
18-
/**
19-
* @var StudentFactory
20-
*/
21-
private $studentFactory;
13+
private ClassModel $model;
14+
private StudentFactory $studentFactory;
2215

2316
public function __construct(IdentityMap $identityMap, ClassModel $model, StudentFactory $studentFactory)
2417
{

examples/Infrastructure/Factory/CourseFactory.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@
99

1010
class CourseFactory extends AbstractFactory
1111
{
12-
/**
13-
* @var CourseModel
14-
*/
15-
private $model;
16-
17-
/**
18-
* @var ClassFactory
19-
*/
20-
private $classFactory;
12+
private CourseModel $model;
13+
private ClassFactory $classFactory;
2114

2215
public function __construct(IdentityMap $identityMap, CourseModel $model, ClassFactory $classFactory)
2316
{

0 commit comments

Comments
 (0)