Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Kdyby/Aop
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0
Choose a base ref
...
head repository: Kdyby/Aop
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 5 commits
  • 12 files changed
  • 2 contributors

Commits on May 4, 2019

  1. Update README.md

    dakorpar authored May 4, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    bca7dc6 View commit details

Commits on May 13, 2019

  1. Use nette reflection, package is not deprecated it's just read only a…

    …nd compatible with nette 3 (#40)
    
    * Use nette reflection again
    dakorpar authored May 13, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3cc49c7 View commit details

Commits on Jan 9, 2020

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    350ee70 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2f5477e View commit details

Commits on Mar 17, 2021

  1. abandoned

    fprochazka authored Mar 17, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f14138d View commit details
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ php:
- 7.1
- 7.2
- 7.3
- 7.4
matrix:
include:
- php: 7.1
@@ -18,13 +19,17 @@ matrix:
env: COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
- php: 7.3
env: COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
- php: 7.4
env: COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
allow_failures:
- php: 7.1
env: COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
- php: 7.2
env: COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
- php: 7.3
env: COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
- php: 7.4
env: COVERAGE="--coverage ./coverage.xml --coverage-src ./src" TESTER_RUNTIME="phpdbg"
before_install:
- travis_retry composer self-update

37 changes: 1 addition & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,4 @@
Kdyby/Aop
======

[![Build Status](https://travis-ci.org/Kdyby/Aop.svg?branch=master)](https://travis-ci.org/Kdyby/Aop)
[![Downloads this Month](https://img.shields.io/packagist/dm/kdyby/aop.svg)](https://packagist.org/packages/kdyby/aop)
[![Latest stable](https://img.shields.io/packagist/v/kdyby/aop.svg)](https://packagist.org/packages/kdyby/aop)
[![Coverage Status](https://coveralls.io/repos/github/Kdyby/Aop/badge.svg?branch=master)](https://coveralls.io/github/Kdyby/Aop?branch=master)
[![Join the chat at https://gitter.im/Kdyby/Help](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Kdyby/Help)


Requirements
------------

Kdyby/Aop requires PHP 7.1 or higher.

- [Nette Framework](https://github.com/nette/nette)
- [Kdyby/Annotations](https://github.com/Kdyby/Annotations)
- [Symfony/PropertyAccess](https://github.com/symfony/PropertyAccess)


Installation
------------

The best way to install Kdyby/Aop is using [Composer](http://getcomposer.org/):

```sh
$ composer require kdyby/aop
```


Documentation
------------

Learn more in the [documentation](https://github.com/Kdyby/Aop/blob/master/docs/en/index.md).


-----

Homepage [http://www.kdyby.org](http://www.kdyby.org) and repository [http://github.com/Kdyby/Aop](http://github.com/Kdyby/Aop).
**This package is abandoned and no longer maintained. The author suggests using the [contributte/aop](https://packagist.org/packages/contributte/aop) package instead.**
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -23,7 +23,8 @@
"nette/di": "~3.0",
"nette/php-generator": "^3.0",
"nette/tokenizer": "~3.0",
"kdyby/annotations": "dev-master",
"nette/reflection": "^2.4",
"kdyby/annotations": "^3.0",
"symfony/property-access": "~4.2"
},
"require-dev": {
@@ -58,7 +59,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
"dev-master": "3.0-dev"
}
}
}
2 changes: 1 addition & 1 deletion src/Kdyby/Aop/DI/AopExtension.php
Original file line number Diff line number Diff line change
@@ -116,7 +116,7 @@ private function patchService($serviceId, Code\ClassType $advisedClass, Code\Php
{
static $publicSetup;
if ($publicSetup === NULL) {
$refl = new \ReflectionProperty('Nette\DI\ServiceDefinition', 'setup');
$refl = new Nette\Reflection\Property('Nette\DI\ServiceDefinition', 'setup');
$publicSetup = $refl->isPublic();
}

2 changes: 1 addition & 1 deletion src/Kdyby/Aop/DI/AspectsExtension.php
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ public function loadConfiguration()
}

if (!($config = $extension->getAspectsConfiguration()) || !$config instanceof AspectsConfig) {
$refl = new \ReflectionMethod($extension, 'getAspectsConfiguration');
$refl = Nette\Reflection\Method::from($extension, 'getAspectsConfiguration');
$given = is_object($config) ? 'instance of ' . get_class($config) : gettype($config);
throw new Kdyby\Aop\UnexpectedValueException("Method $refl is expected to return instance of Kdyby\\Aop\\DI\\AspectsConfig, but $given given.");
}
8 changes: 4 additions & 4 deletions src/Kdyby/Aop/JoinPoint/MethodInvocation.php
Original file line number Diff line number Diff line change
@@ -68,15 +68,15 @@ public function getArguments()
}


public function getTargetObjectReflection(): \ReflectionClass
public function getTargetObjectReflection(): Nette\Reflection\ClassType
{
return new \ReflectionClass($this->targetObject);
return Nette\Reflection\ClassType::from($this->targetObject);
}


public function getTargetReflection(): \ReflectionMethod
public function getTargetReflection(): Nette\Reflection\Method
{
return new \ReflectionMethod($this->targetObject, $this->targetMethod);
return Nette\Reflection\Method::from($this->targetObject, $this->targetMethod);
}

}
10 changes: 5 additions & 5 deletions src/Kdyby/Aop/PhpGenerator/PointcutMethod.php
Original file line number Diff line number Diff line change
@@ -51,12 +51,12 @@ class PointcutMethod
*/
private $method;

public function __construct(\ReflectionMethod $from)
public function __construct(Nette\Reflection\Method $from)
{
$this->method = (new Code\Factory())->fromMethodReflection($from);
}

public static function from(\ReflectionMethod $from): PointcutMethod
public static function from(Nette\Reflection\Method $from): PointcutMethod
{
$method = new self($from);
$params = [];
@@ -65,7 +65,7 @@ public static function from(\ReflectionMethod $from): PointcutMethod
$params[$param->getName()] = $factory->fromParameterReflection($param);
}
$method->setParameters($params);
if ($from instanceof \ReflectionMethod) {
if ($from instanceof Nette\Reflection\Method) {
$isInterface = $from->getDeclaringClass()->isInterface();
$method->setStatic($from->isStatic());
$method->setVisibility($from->isPrivate() ? 'private' : ($from->isProtected() ? 'protected' : ($isInterface ? NULL : 'public')));
@@ -77,7 +77,7 @@ public static function from(\ReflectionMethod $from): PointcutMethod
$method->setVariadic($from->isVariadic());
$method->setComment(Code\Helpers::unformatDocComment($from->getDocComment()));
if ($from->hasReturnType()) {
$method->setReturnType((string) $from->getReturnType());
$method->setReturnType(($from->getReturnType()->getName()));
$method->setReturnNullable($from->getReturnType()->allowsNull());
}
return $method;
@@ -249,7 +249,7 @@ public function beforePrint()
/**
* @throws \ReflectionException
*/
public static function expandTypeHints(\ReflectionMethod $from, PointcutMethod $method): PointcutMethod
public static function expandTypeHints(Nette\Reflection\Method $from, PointcutMethod $method): PointcutMethod
{
$parameters = $method->getParameters();
/** @var Code\Parameter[] $parameters */
2 changes: 1 addition & 1 deletion src/Kdyby/Aop/Pointcut/Matcher/WithinMatcher.php
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ public function __construct($type)
$this->pattern = str_replace('\\*', '.*', preg_quote($type));

} else {
$this->type = (new \ReflectionClass($type))->getName();
$this->type = Nette\Reflection\ClassType::from($type)->getName();
}
}

6 changes: 3 additions & 3 deletions src/Kdyby/Aop/Pointcut/Method.php
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ class Method
const VISIBILITY_PRIVATE = 'private';

/**
* @var \ReflectionMethod
* @var Nette\Reflection\Method
*/
private $method;

@@ -44,7 +44,7 @@ class Method



public function __construct(\ReflectionMethod $method, ServiceDefinition $serviceDefinition)
public function __construct(Nette\Reflection\Method $method, ServiceDefinition $serviceDefinition)
{
$this->method = $method;
$this->serviceDefinition = $serviceDefinition;
@@ -141,7 +141,7 @@ public function getParameterNames(): array
return array_keys($this->method->getParameters());
}

public function unwrap(): \ReflectionMethod
public function unwrap(): Nette\Reflection\Method
{
return $this->method;
}
8 changes: 4 additions & 4 deletions src/Kdyby/Aop/Pointcut/ServiceDefinition.php
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
*
* @property string $serviceId
* @property array|Method[] $openMethods
* @property \ReflectionClass $typeReflection
* @property Nette\Reflection\ClassType $typeReflection
*/
class ServiceDefinition
{
@@ -35,7 +35,7 @@ class ServiceDefinition
private $serviceDefinition;

/**
* @var \ReflectionClass
* @var Nette\Reflection\ClassType
*/
private $originalType;

@@ -64,7 +64,7 @@ public function __construct(Nette\DI\Definitions\Definition $def, $serviceId)
throw new Kdyby\Aop\InvalidArgumentException("Given service definition has unresolved class, please specify service type explicitly.");
}

$this->originalType = new \ReflectionClass($def->getType());
$this->originalType = Nette\Reflection\ClassType::from($def->getType());
$this->serviceId = $serviceId;
}

@@ -79,7 +79,7 @@ public function getServiceId()
}


public function getTypeReflection(): \ReflectionClass
public function getTypeReflection(): Nette\Reflection\ClassType
{
return $this->originalType;
}
2 changes: 1 addition & 1 deletion tests/KdybyTests/Aop/Extension.phpt
Original file line number Diff line number Diff line change
@@ -422,7 +422,7 @@ class ExtensionTest extends Tester\TestCase
private static function getAspects($service)
{
try {
$propRefl = (new \ReflectionClass($service))
$propRefl = (Nette\Reflection\ClassType::from($service))
->getProperty('_kdyby_aopAdvices'); // internal property

$propRefl->setAccessible(TRUE);
2 changes: 1 addition & 1 deletion tests/KdybyTests/Aop/ServiceDefinition.phpt
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ class ServiceDefinitionTest extends Tester\TestCase
public function testInheritedConstructor()
{
$definition = $this->createDefinition(InheritedClass::class);
Assert::equal($definition->getOpenMethods(), ['__construct' => new Pointcut\Method(new \ReflectionMethod(InheritedClass::class, '__construct'), $definition)]);
Assert::equal($definition->getOpenMethods(), ['__construct' => new Pointcut\Method(Nette\Reflection\Method::from(InheritedClass::class, '__construct'), $definition)]);
}