Skip to content

Commit

Permalink
Conform to PSR-12
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Oct 4, 2019
1 parent 619c730 commit c11c191
Show file tree
Hide file tree
Showing 39 changed files with 161 additions and 236 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ REMOVED:

FIXED:

## 0.7.1 - 2019-10-04

CHANGED:

- Improved PSR-12 conformance
- Added more type hints

## 0.7.0 - 2019-08-21

CHANGED:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"phpstan/phpstan-phpunit": "^0.11.0",
"phpstan/phpstan-strict-rules": "^0.11.0",
"phpunit/phpunit": "^8.3.4",
"squizlabs/php_codesniffer": "^3.4.0",
"woohoolabs/coding-standard": "^2.0.1",
"woohoolabs/releaser": "^1.1.0"
"squizlabs/php_codesniffer": "^3.5.0",
"woohoolabs/coding-standard": "^2.1.1",
"woohoolabs/releaser": "^1.2.0"
},
"autoload": {
"psr-4": {
Expand Down
177 changes: 87 additions & 90 deletions composer.lock

Large diffs are not rendered by default.

36 changes: 7 additions & 29 deletions examples/Domain/Course.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,13 @@

class Course
{
/**
* @var int
*/
private $id;

/**
* @var
*/
private $name;

/**
* @var string
*/
private $description;

/**
* @var int
*/
private $credit;

/**
* @var string
*/
private $language;

/**
* @var SchoolClass[]
*/
private $classes;
private int $id;
private string $name;
private string $description;
private int $credit;
private string $language;
/** @var SchoolClass[] */
private array $classes;

/**
* @param SchoolClass[] $classes
Expand Down
11 changes: 2 additions & 9 deletions examples/Domain/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,8 @@

class Name
{
/**
* @var string
*/
private $firstName;

/**
* @var string
*/
private $lastName;
private string $firstName;
private string $lastName;

public function __construct(string $firstName, string $lastName)
{
Expand Down
29 changes: 6 additions & 23 deletions examples/Domain/SchoolClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,12 @@

class SchoolClass
{
/**
* @var int
*/
private $id;

/**
* @var int
*/
private $roomId;

/**
* @var int
*/
private $teacherId;

/**
* @var Student[]
*/
private $students;

/**
* @var DateTimeImmutable
*/
private int $id;
private int $roomId;
private int $teacherId;
/** @var Student[] */
private array $students;
/** @var DateTimeImmutable */
private $datetime;

/**
Expand Down
29 changes: 5 additions & 24 deletions examples/Domain/Student.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,11 @@

class Student
{
/**
* @var int
*/
private $id;

/**
* @var Name
*/
private $name;

/**
* @var string|null
*/
private $birthday;

/**
* @var string|null
*/
private $gender;

/**
* @var string
*/
private $introduction;
private int $id;
private Name $name;
private ?string $birthday;
private ?string $gender;
private string $introduction;

public function __construct(int $id, Name $name, string $introduction, string $birthday = null, string $gender = null)
{
Expand Down
5 changes: 1 addition & 4 deletions examples/Infrastructure/Factory/AbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@

abstract class AbstractFactory
{
/**
* @var IdentityMap
*/
private $identityMap;
private IdentityMap $identityMap;

public function __construct(IdentityMap $identityMap)
{
Expand Down
11 changes: 2 additions & 9 deletions examples/Infrastructure/Factory/ClassFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,8 @@

class ClassFactory extends AbstractFactory
{
/**
* @var ClassModel
*/
private $model;

/**
* @var StudentFactory
*/
private $studentFactory;
private ClassModel $model;
private StudentFactory $studentFactory;

public function __construct(IdentityMap $identityMap, ClassModel $model, StudentFactory $studentFactory)
{
Expand Down
11 changes: 2 additions & 9 deletions examples/Infrastructure/Factory/CourseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@

class CourseFactory extends AbstractFactory
{
/**
* @var CourseModel
*/
private $model;

/**
* @var ClassFactory
*/
private $classFactory;
private CourseModel $model;
private ClassFactory $classFactory;

public function __construct(IdentityMap $identityMap, CourseModel $model, ClassFactory $classFactory)
{
Expand Down
5 changes: 1 addition & 4 deletions examples/Infrastructure/Factory/StudentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@

class StudentFactory extends AbstractFactory
{
/**
* @var StudentModel
*/
private $model;
private StudentModel $model;

public function __construct(IdentityMap $identityMap, StudentModel $model)
{
Expand Down
11 changes: 2 additions & 9 deletions examples/Infrastructure/Model/ClassModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@ class ClassModel extends AbstractModel
public $students;
public $datetime;

/**
* @var ClassStudentModel
*/
private $classStudentModel;

/**
* @var StudentModel
*/
private $studentModel;
private ClassStudentModel $classStudentModel;
private StudentModel $studentModel;

public function __construct(ClassStudentModel $classStudentModel, StudentModel $studentModel)
{
Expand Down
6 changes: 1 addition & 5 deletions examples/Infrastructure/Model/CourseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ class CourseModel extends AbstractModel
public $credit;
public $language;
public $classes;

/**
* @var ClassModel
*/
public $classModel;
public ClassModel $classModel;

public function __construct(ClassModel $classModel)
{
Expand Down
5 changes: 1 addition & 4 deletions examples/Infrastructure/Repository/AbstractRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

abstract class AbstractRepository
{
/**
* @var Worm
*/
protected $worm;
protected Worm $worm;

public function __construct(Worm $worm)
{
Expand Down
10 changes: 2 additions & 8 deletions examples/Infrastructure/Repository/CourseRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@

class CourseRepository extends AbstractRepository
{
/**
* @var CourseModel
*/
private $model;
private CourseModel $model;

/**
* @var CourseFactory
*/
private $courseFactory;
private CourseFactory $courseFactory;

public function __construct(Worm $worm, CourseModel $model, CourseFactory $factory)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Execution/IdentityMap.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Execution;

use WoohooLabs\Worm\Model\ModelInterface;

use function array_key_exists;
use function count;

Expand Down
2 changes: 2 additions & 0 deletions src/Execution/Persister.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Execution;
Expand All @@ -8,6 +9,7 @@
use WoohooLabs\Larva\Query\Insert\InsertQueryBuilder;
use WoohooLabs\Larva\Query\Update\UpdateQueryBuilder;
use WoohooLabs\Worm\Model\ModelInterface;

use function array_diff_key;
use function array_keys;
use function array_values;
Expand Down
2 changes: 2 additions & 0 deletions src/Execution/QueryExecutor.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Execution;
Expand All @@ -12,6 +13,7 @@
use WoohooLabs\Larva\Query\Update\UpdateQueryBuilderInterface;
use WoohooLabs\Worm\Model\ModelInterface;
use WoohooLabs\Worm\Model\Relationship\RelationshipInterface;

use function array_intersect;
use function is_array;

Expand Down
2 changes: 2 additions & 0 deletions src/Model/AbstractModel.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model;
Expand All @@ -15,6 +16,7 @@
use WoohooLabs\Worm\Model\Relationship\HasOneRelationship;
use WoohooLabs\Worm\Model\Relationship\RelationshipBuilderInterface;
use WoohooLabs\Worm\Model\Relationship\RelationshipInterface;

use function array_key_exists;
use function array_keys;
use function count;
Expand Down
1 change: 1 addition & 0 deletions src/Model/ModelInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model;
Expand Down
2 changes: 2 additions & 0 deletions src/Model/Relationship/AbstractRelationship.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model\Relationship;
Expand All @@ -9,6 +10,7 @@
use WoohooLabs\Worm\Execution\IdentityMap;
use WoohooLabs\Worm\Execution\Persister;
use WoohooLabs\Worm\Model\ModelInterface;

use function array_key_exists;

abstract class AbstractRelationship implements RelationshipInterface, RelationshipBuilderInterface
Expand Down
1 change: 1 addition & 0 deletions src/Model/Relationship/BelongsToManyRelationship.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model\Relationship;
Expand Down
1 change: 1 addition & 0 deletions src/Model/Relationship/BelongsToOneRelationship.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model\Relationship;
Expand Down
1 change: 1 addition & 0 deletions src/Model/Relationship/HasManyRelationship.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model\Relationship;
Expand Down
1 change: 1 addition & 0 deletions src/Model/Relationship/HasManyThroughRelationship.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model\Relationship;
Expand Down
1 change: 1 addition & 0 deletions src/Model/Relationship/HasOneRelationship.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model\Relationship;
Expand Down
1 change: 1 addition & 0 deletions src/Model/Relationship/RelationshipBuilderInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model\Relationship;
Expand Down
1 change: 1 addition & 0 deletions src/Model/Relationship/RelationshipInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

namespace WoohooLabs\Worm\Model\Relationship;
Expand Down
Loading

0 comments on commit c11c191

Please sign in to comment.