Skip to content

Commit

Permalink
Switch from doctrine annotations to native php8 attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
dakorpar committed Mar 16, 2021
1 parent 127d586 commit ffe5e50
Show file tree
Hide file tree
Showing 53 changed files with 370 additions and 416 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

strategy:
matrix:
php-version: ["7.4"]
php-version: ["8.0"]
operating-system: ["ubuntu-latest"]
fail-fast: false

Expand Down Expand Up @@ -80,20 +80,18 @@ jobs:
runs-on: "${{ matrix.operating-system }}"
strategy:
matrix:
php-version: ["7.4"]
php-version: ["8.0"]
operating-system: ["ubuntu-latest"]
composer-args: [ "" ]
include:
- php-version: "7.4"
- php-version: "8.0"
operating-system: "ubuntu-latest"
composer-args: "--prefer-lowest"
- php-version: "8.0"
operating-system: "ubuntu-latest"
composer-args: "--ignore-platform-reqs"
fail-fast: false

continue-on-error: "${{ matrix.php-version == '8.0' }}"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
Expand Down Expand Up @@ -149,7 +147,7 @@ jobs:

strategy:
matrix:
php-version: ["7.4"]
php-version: ["8.0"]
operating-system: ["ubuntu-latest"]
fail-fast: false

Expand Down Expand Up @@ -205,7 +203,7 @@ jobs:

strategy:
matrix:
php-version: ["7.4"]
php-version: ["8.0"]
operating-system: ["ubuntu-latest"]
fail-fast: false

Expand Down
33 changes: 15 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,29 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=7.4",
"php": ">=8.0",
"nette/di": "^3.0.3",
"nette/php-generator": "^3.0",
"nette/php-generator": "^3.5",
"nette/tokenizer": "~3.0",
"nettrine/annotations": "^0.7",
"doctrine/annotations": "^1.11",
"symfony/property-access": "^4.4|~5.0",
"nettrine/cache": "^0.3"
"symfony/property-access": "^4.4|~5.0"
},
"require-dev": {
"nette/application": "^3.0.1",
"nette/bootstrap": "~3.0",
"nette/caching": "~3.0",
"nette/application": "^3.1",
"nette/bootstrap": "~3.1",
"nette/caching": "~3.1",
"nette/component-model": "~3.0",
"nette/database": "~3.0",
"nette/database": "~3.1",
"nette/finder": "~2.5",
"nette/forms": "~3.0",
"nette/http": "~3.0",
"nette/mail": "~3.0",
"nette/neon": "~3.0",
"nette/robot-loader": "^3.0",
"nette/forms": "~3.1",
"nette/http": "~3.1",
"nette/mail": "~3.1",
"nette/neon": "~3.1",
"nette/robot-loader": "^3.4",
"nette/safe-stream": "~2.4",
"nette/security": "~3.0",
"nette/utils": "^3.1",
"latte/latte": "~2.5",
"tracy/tracy": "~2.6",
"nette/utils": "^3.2",
"latte/latte": "~2.10",
"tracy/tracy": "~2.8",
"doctrine/collections": "~1.6",
"ninjify/qa": "^0.12",
"phpstan/phpstan-nette": "^0.12",
Expand Down
1 change: 1 addition & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- Contributte Coding Standard -->
<rule ref="./vendor/ninjify/coding-standard/contributte.xml">
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix"></exclude>
<exclude name="SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse"></exclude> <!-- does not work with php 8 attributes -->
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint" />
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint" />
Expand Down
8 changes: 0 additions & 8 deletions src/Annotations/AdviceAnnotation.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Annotations/After.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Annotations/AfterReturning.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Annotations/AfterThrowing.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/Annotations/Annotation.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Annotations/Around.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Annotations/Aspect.php

This file was deleted.

15 changes: 0 additions & 15 deletions src/Annotations/BaseAnnotation.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Annotations/Before.php

This file was deleted.

12 changes: 0 additions & 12 deletions src/Annotations/Introduce.php

This file was deleted.

8 changes: 8 additions & 0 deletions src/Attributes/AdviceAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

interface AdviceAttribute extends Attribute
{

}
14 changes: 14 additions & 0 deletions src/Attributes/After.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

use Attribute;

/**
* @Target("METHOD")
*/
#[Attribute]
class After extends BaseAttribute implements AdviceAttribute
{

}
15 changes: 15 additions & 0 deletions src/Attributes/AfterReturning.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

use Attribute;

/**
* @Target("METHOD")
*/

#[Attribute]
class AfterReturning extends BaseAttribute implements AdviceAttribute
{

}
14 changes: 14 additions & 0 deletions src/Attributes/AfterThrowing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

use Attribute;

/**
* @Target("METHOD")
*/
#[Attribute]
class AfterThrowing extends BaseAttribute implements AdviceAttribute
{

}
14 changes: 14 additions & 0 deletions src/Attributes/Around.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

use Attribute;

/**
* @Target("METHOD")
*/
#[Attribute]
class Around extends BaseAttribute implements AdviceAttribute
{

}
14 changes: 14 additions & 0 deletions src/Attributes/Aspect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

use Attribute;

/**
* @Target("CLASS")
*/
#[Attribute]
class Aspect extends BaseAttribute
{

}
10 changes: 10 additions & 0 deletions src/Attributes/Attribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

interface Attribute
{

public function getValue(): string;

}
29 changes: 29 additions & 0 deletions src/Attributes/BaseAttribute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

use Attribute;

#[Attribute]
class BaseAttribute
{

private string $value;

public function __construct(string $value = '')
{
$this->value = $value;
}


public static function getClassName(): string
{
return static::class;
}

public function getValue(): string
{
return $this->value;
}

}
14 changes: 14 additions & 0 deletions src/Attributes/Before.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

use Attribute;

/**
* @Target("METHOD")
*/
#[Attribute]
class Before extends BaseAttribute implements AdviceAttribute
{

}
14 changes: 14 additions & 0 deletions src/Attributes/Introduce.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php declare(strict_types = 1);

namespace Contributte\Aop\Attributes;

use Attribute;

/**
* @Target({"METHOD", "CLASS", "PROPERTY"})
*/
#[Attribute]
class Introduce extends BaseAttribute implements AdviceAttribute
{

}
Loading

0 comments on commit ffe5e50

Please sign in to comment.