Skip to content

Commit

Permalink
Merge pull request #14 from Jeckel-Lab/feature/php8-version
Browse files Browse the repository at this point in the history
Upgrade to php8.0
  • Loading branch information
jeckel committed Jul 6, 2021
2 parents dbb3eee + 16de59b commit ea1aff2
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 37 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: validate

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
global-qa-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: 8.0
- name: Get composer cache directory
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-8.0-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-8.0
- name: Install dependencies
run: composer install --no-interaction --prefer-dist --dev
- name: GrumPHP
run: ./vendor/bin/grumphp run

15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ This contract includes some strong typings, object relation and psalm validation

Require **`php >= 7.2.*`** and **`php >= 8.0`**

| Release name | Branch name | Php Version |
|--------------|-------------|-------------------------|
| 1.x | release/1.X | php >= 7.2 & php >= 8.0 |
| 2.x | master | php >= 8.0 |

## Main contracts

### Core
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": "^7.2 || ^8.0"
"php": "^8.0"
},
"autoload": {
"psr-4": {
Expand All @@ -22,7 +22,8 @@
"vimeo/psalm": "^4.3",
"squizlabs/php_codesniffer": "^3.5",
"phpmd/phpmd": "^2.8",
"phpro/grumphp": "^0.19 || ^1.2.0"
"phpro/grumphp": "^0.19 || ^1.2.0",
"phpstan/phpstan": "^0.12.91"
},
"suggest": {
"vimeo/psalm": "Using psalm with this 'contract' will enable immutability and strong typing verification"
Expand Down
3 changes: 3 additions & 0 deletions grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ grumphp:
threads: 1
triggered_by: ['php']
show_info: true
phpstan:
configuration: phpstan.neon
use_grumphp_paths: true
4 changes: 4 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parameters:
level: 8
paths:
- src
15 changes: 9 additions & 6 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
My custom rule set that checks my code...
Jeckel-Lab/Contract PHPMD RuleSet
</description>

<rule ref="rulesets/cleancode.xml">
<exclude name="IfStatementAssignment" />
<exclude name="StaticAccess" />
</rule>

<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
</rule>
<rule ref="rulesets/unusedcode.xml" />
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="exceptions">
<value>id</value>
</property>
</properties>
</rule>
</ruleset>
2 changes: 1 addition & 1 deletion src/Domain/Entity/DomainEventAwareTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
trait DomainEventAwareTrait
{
/** @var Event[] */
private $events = [];
private array $events = [];

/**
* @return Event[]
Expand Down
4 changes: 2 additions & 2 deletions src/Domain/Equality.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
interface Equality
{
/**
* @param static $object
* @param mixed $object
* @return bool
* @psalm-mutation-free
*/
public function equals($object): bool;
public function equals(mixed $object): bool;
}
8 changes: 2 additions & 6 deletions src/Domain/Identity/Identity.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@

use JeckelLab\Contract\Domain\Equality;
use JeckelLab\Contract\Domain\Identity\Exception\InvalidIdException;
use Stringable;

/**
* Interface Identity
* @package JeckelLab\Contract\Domain\Identity
* @psalm-immutable
* @template T
*/
interface Identity extends Equality
interface Identity extends Equality, Stringable
{
/**
* IdAbstract constructor.
* @param T $id
* @throws InvalidIdException
*/
public function __construct($id);

/**
* @return string
*/
public function __toString(): string;
}
8 changes: 3 additions & 5 deletions src/Domain/ValueObject/ValueObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

namespace JeckelLab\Contract\Domain\ValueObject;

use Stringable;

/**
* Interface ValueObject
* @psalm-immutable
*/
interface ValueObject
interface ValueObject extends Stringable
{
/**
* @return string
*/
public function __toString(): string;
}

0 comments on commit ea1aff2

Please sign in to comment.