From c63475992032a0462fe44bf9c7a5b17dc8f585a8 Mon Sep 17 00:00:00 2001 From: Dalibor Date: Sat, 31 Mar 2018 13:50:51 +0200 Subject: [PATCH] replace Nette\Object with Nette\SmartObject --- src/Kdyby/Aop/DI/AdviceDefinition.php | 4 +- src/Kdyby/Aop/DI/AspectsConfig.php | 4 +- src/Kdyby/Aop/JoinPoint/MethodInvocation.php | 4 +- .../Aop/PhpGenerator/AdvisedClassType.php | 4 +- src/Kdyby/Aop/Pointcut/AspectAnalyzer.php | 3 +- .../Matcher/ClassAnnotateWithMatcher.php | 4 +- src/Kdyby/Aop/Pointcut/Matcher/Criteria.php | 5 ++- .../Aop/Pointcut/Matcher/EvaluateMatcher.php | 4 +- .../Aop/Pointcut/Matcher/FilterMatcher.php | 4 +- src/Kdyby/Aop/Pointcut/Matcher/Inverse.php | 4 +- .../Matcher/MethodAnnotateWithMatcher.php | 4 +- .../Aop/Pointcut/Matcher/MethodMatcher.php | 4 +- .../Aop/Pointcut/Matcher/SettingMatcher.php | 4 +- .../Aop/Pointcut/Matcher/WithinMatcher.php | 4 +- src/Kdyby/Aop/Pointcut/MatcherFactory.php | 4 +- src/Kdyby/Aop/Pointcut/Method.php | 5 ++- src/Kdyby/Aop/Pointcut/Parser.php | 4 +- src/Kdyby/Aop/Pointcut/Rules.php | 4 +- src/Kdyby/Aop/Pointcut/ServiceDefinition.php | 4 +- .../KdybyTests/Aop/files/aspect-examples.php | 43 ++++++++++++++----- 20 files changed, 90 insertions(+), 30 deletions(-) diff --git a/src/Kdyby/Aop/DI/AdviceDefinition.php b/src/Kdyby/Aop/DI/AdviceDefinition.php index f149477..4455569 100644 --- a/src/Kdyby/Aop/DI/AdviceDefinition.php +++ b/src/Kdyby/Aop/DI/AdviceDefinition.php @@ -20,9 +20,11 @@ /** * @author Filip Procházka */ -class AdviceDefinition extends Nette\Object +class AdviceDefinition { + use Nette\SmartObject; + /** * @var Method */ diff --git a/src/Kdyby/Aop/DI/AspectsConfig.php b/src/Kdyby/Aop/DI/AspectsConfig.php index 274d15f..e2b5c09 100644 --- a/src/Kdyby/Aop/DI/AspectsConfig.php +++ b/src/Kdyby/Aop/DI/AspectsConfig.php @@ -18,9 +18,11 @@ /** * @author Filip Procházka */ -class AspectsConfig extends Nette\Object +class AspectsConfig { + use Nette\SmartObject; + /** * @var array */ diff --git a/src/Kdyby/Aop/JoinPoint/MethodInvocation.php b/src/Kdyby/Aop/JoinPoint/MethodInvocation.php index 8624e74..b02d404 100644 --- a/src/Kdyby/Aop/JoinPoint/MethodInvocation.php +++ b/src/Kdyby/Aop/JoinPoint/MethodInvocation.php @@ -20,9 +20,11 @@ /** * @author Filip Procházka */ -abstract class MethodInvocation extends Nette\Object +abstract class MethodInvocation { + use Nette\SmartObject; + /** * @var object */ diff --git a/src/Kdyby/Aop/PhpGenerator/AdvisedClassType.php b/src/Kdyby/Aop/PhpGenerator/AdvisedClassType.php index 87b95a5..7c00e76 100644 --- a/src/Kdyby/Aop/PhpGenerator/AdvisedClassType.php +++ b/src/Kdyby/Aop/PhpGenerator/AdvisedClassType.php @@ -19,9 +19,11 @@ /** * @author Filip Procházka */ -class AdvisedClassType extends Nette\Object +class AdvisedClassType { + use Nette\SmartObject; + const CG_INJECT_METHOD = '__injectAopContainer'; const CG_PUBLIC_PROXY_PREFIX = '__publicAopProxy_'; diff --git a/src/Kdyby/Aop/Pointcut/AspectAnalyzer.php b/src/Kdyby/Aop/Pointcut/AspectAnalyzer.php index 7f13637..030d7f6 100644 --- a/src/Kdyby/Aop/Pointcut/AspectAnalyzer.php +++ b/src/Kdyby/Aop/Pointcut/AspectAnalyzer.php @@ -21,8 +21,9 @@ /** * @author Filip Procházka */ -class AspectAnalyzer extends Nette\Object +class AspectAnalyzer { + use Nette\SmartObject; /** * @var \Doctrine\Common\Annotations\Reader diff --git a/src/Kdyby/Aop/Pointcut/Matcher/ClassAnnotateWithMatcher.php b/src/Kdyby/Aop/Pointcut/Matcher/ClassAnnotateWithMatcher.php index 9350648..58c5904 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/ClassAnnotateWithMatcher.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/ClassAnnotateWithMatcher.php @@ -19,9 +19,11 @@ /** * @author Filip Procházka */ -class ClassAnnotateWithMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Filter +class ClassAnnotateWithMatcher implements Kdyby\Aop\Pointcut\Filter { + use Nette\SmartObject; + /** * @var string */ diff --git a/src/Kdyby/Aop/Pointcut/Matcher/Criteria.php b/src/Kdyby/Aop/Pointcut/Matcher/Criteria.php index 8c9b1d1..594509f 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/Criteria.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/Criteria.php @@ -21,8 +21,11 @@ /** * @author Filip Procházka */ -class Criteria extends Nette\Object +class Criteria { + + use Nette\SmartObject; + const TYPE_AND = 'AND'; const TYPE_OR = 'OR'; diff --git a/src/Kdyby/Aop/Pointcut/Matcher/EvaluateMatcher.php b/src/Kdyby/Aop/Pointcut/Matcher/EvaluateMatcher.php index 5f7dcfd..d6781e1 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/EvaluateMatcher.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/EvaluateMatcher.php @@ -18,9 +18,11 @@ /** * @author Filip Procházka */ -class EvaluateMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Filter, Kdyby\Aop\Pointcut\RuntimeFilter +class EvaluateMatcher implements Kdyby\Aop\Pointcut\Filter, Kdyby\Aop\Pointcut\RuntimeFilter { + use Nette\SmartObject; + /** * @var Criteria */ diff --git a/src/Kdyby/Aop/Pointcut/Matcher/FilterMatcher.php b/src/Kdyby/Aop/Pointcut/Matcher/FilterMatcher.php index 5229c76..66da5bf 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/FilterMatcher.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/FilterMatcher.php @@ -18,9 +18,11 @@ /** * @author Filip Procházka */ -class FilterMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Filter +class FilterMatcher implements Kdyby\Aop\Pointcut\Filter { + use Nette\SmartObject; + /** * @var \Kdyby\Aop\Pointcut\Filter */ diff --git a/src/Kdyby/Aop/Pointcut/Matcher/Inverse.php b/src/Kdyby/Aop/Pointcut/Matcher/Inverse.php index b13ea35..5205f18 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/Inverse.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/Inverse.php @@ -18,9 +18,11 @@ /** * @author Filip Procházka */ -class Inverse extends Nette\Object implements Kdyby\Aop\Pointcut\Filter +class Inverse implements Kdyby\Aop\Pointcut\Filter { + use Nette\SmartObject; + /** * @var \Kdyby\Aop\Pointcut\Filter */ diff --git a/src/Kdyby/Aop/Pointcut/Matcher/MethodAnnotateWithMatcher.php b/src/Kdyby/Aop/Pointcut/Matcher/MethodAnnotateWithMatcher.php index 7eec990..93ccb92 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/MethodAnnotateWithMatcher.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/MethodAnnotateWithMatcher.php @@ -19,9 +19,11 @@ /** * @author Filip Procházka */ -class MethodAnnotateWithMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Filter +class MethodAnnotateWithMatcher implements Kdyby\Aop\Pointcut\Filter { + use Nette\SmartObject; + /** * @var string */ diff --git a/src/Kdyby/Aop/Pointcut/Matcher/MethodMatcher.php b/src/Kdyby/Aop/Pointcut/Matcher/MethodMatcher.php index 7630946..8954b61 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/MethodMatcher.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/MethodMatcher.php @@ -18,9 +18,11 @@ /** * @author Filip Procházka */ -class MethodMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Filter +class MethodMatcher implements Kdyby\Aop\Pointcut\Filter { + use Nette\SmartObject; + /** * @var string */ diff --git a/src/Kdyby/Aop/Pointcut/Matcher/SettingMatcher.php b/src/Kdyby/Aop/Pointcut/Matcher/SettingMatcher.php index 738b235..72c487a 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/SettingMatcher.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/SettingMatcher.php @@ -18,9 +18,11 @@ /** * @author Filip Procházka */ -class SettingMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Filter +class SettingMatcher implements Kdyby\Aop\Pointcut\Filter { + use Nette\SmartObject; + /** * @var Criteria */ diff --git a/src/Kdyby/Aop/Pointcut/Matcher/WithinMatcher.php b/src/Kdyby/Aop/Pointcut/Matcher/WithinMatcher.php index afef407..f27d62c 100644 --- a/src/Kdyby/Aop/Pointcut/Matcher/WithinMatcher.php +++ b/src/Kdyby/Aop/Pointcut/Matcher/WithinMatcher.php @@ -18,9 +18,11 @@ /** * @author Filip Procházka */ -class WithinMatcher extends Nette\Object implements Kdyby\Aop\Pointcut\Filter +class WithinMatcher implements Kdyby\Aop\Pointcut\Filter { + use Nette\SmartObject; + /** * @var string */ diff --git a/src/Kdyby/Aop/Pointcut/MatcherFactory.php b/src/Kdyby/Aop/Pointcut/MatcherFactory.php index 5a02739..581ce7a 100644 --- a/src/Kdyby/Aop/Pointcut/MatcherFactory.php +++ b/src/Kdyby/Aop/Pointcut/MatcherFactory.php @@ -20,9 +20,11 @@ /** * @author Filip Procházka */ -class MatcherFactory extends Nette\Object +class MatcherFactory { + use Nette\SmartObject; + /** * @var \Nette\DI\ContainerBuilder */ diff --git a/src/Kdyby/Aop/Pointcut/Method.php b/src/Kdyby/Aop/Pointcut/Method.php index 23f762c..2116291 100644 --- a/src/Kdyby/Aop/Pointcut/Method.php +++ b/src/Kdyby/Aop/Pointcut/Method.php @@ -24,8 +24,11 @@ * @property array|string[] $typesWithin * @property-read array|string[] $typesWithin */ -class Method extends Nette\Object +class Method { + + use Nette\SmartObject; + const VISIBILITY_PUBLIC = 'public'; const VISIBILITY_PROTECTED = 'protected'; const VISIBILITY_PRIVATE = 'private'; diff --git a/src/Kdyby/Aop/Pointcut/Parser.php b/src/Kdyby/Aop/Pointcut/Parser.php index 8746e03..04f4e39 100644 --- a/src/Kdyby/Aop/Pointcut/Parser.php +++ b/src/Kdyby/Aop/Pointcut/Parser.php @@ -21,8 +21,10 @@ /** * @author Filip Procházka */ -class Parser extends Nette\Object +class Parser { + use Nette\SmartObject; + const TOK_BRACKET = 'bracket'; const TOK_VISIBILITY = 'visibility'; const TOK_KEYWORD = 'keyword'; diff --git a/src/Kdyby/Aop/Pointcut/Rules.php b/src/Kdyby/Aop/Pointcut/Rules.php index 12c12a2..dcb715d 100644 --- a/src/Kdyby/Aop/Pointcut/Rules.php +++ b/src/Kdyby/Aop/Pointcut/Rules.php @@ -19,9 +19,11 @@ /** * @author Filip Procházka */ -class Rules extends Nette\Object implements Filter, RuntimeFilter +class Rules implements Filter, RuntimeFilter { + use Nette\SmartObject; + const OP_AND = 'AND'; const OP_OR = 'OR'; diff --git a/src/Kdyby/Aop/Pointcut/ServiceDefinition.php b/src/Kdyby/Aop/Pointcut/ServiceDefinition.php index 165dc04..36a7361 100644 --- a/src/Kdyby/Aop/Pointcut/ServiceDefinition.php +++ b/src/Kdyby/Aop/Pointcut/ServiceDefinition.php @@ -25,9 +25,11 @@ * @property Nette\Reflection\ClassType $typeReflection * @property-read Nette\Reflection\ClassType $typeReflection */ -class ServiceDefinition extends Nette\Object +class ServiceDefinition { + use Nette\SmartObject; + /** * @var \Nette\DI\ServiceDefinition */ diff --git a/tests/KdybyTests/Aop/files/aspect-examples.php b/tests/KdybyTests/Aop/files/aspect-examples.php index 608745e..25ea2d3 100644 --- a/tests/KdybyTests/Aop/files/aspect-examples.php +++ b/tests/KdybyTests/Aop/files/aspect-examples.php @@ -54,9 +54,11 @@ function create(); -class BeforeAspect extends Nette\Object +class BeforeAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\BeforeMethod[] */ @@ -84,8 +86,9 @@ public function log(Aop\JoinPoint\BeforeMethod $before) -class ConditionalBeforeAspect extends Nette\Object +class ConditionalBeforeAspect { + use Nette\SmartObject; /** * @var array|Aop\JoinPoint\BeforeMethod[] @@ -121,9 +124,11 @@ class SecondBeforeAspect extends BeforeAspect -class AroundAspect extends Nette\Object +class AroundAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\AroundMethod[] */ @@ -161,9 +166,11 @@ public function log(Aop\JoinPoint\AroundMethod $around) -class ConditionalAroundAspect extends Nette\Object +class ConditionalAroundAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\AroundMethod[] */ @@ -208,9 +215,11 @@ class SecondAroundAspect extends AroundAspect -class AroundBlockingAspect extends Nette\Object +class AroundBlockingAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\AroundMethod[] */ @@ -261,9 +270,11 @@ class SecondAroundBlockingAspect extends AroundBlockingAspect -class AfterReturningAspect extends Nette\Object +class AfterReturningAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\AfterReturning[] */ @@ -289,9 +300,11 @@ public function log(Aop\JoinPoint\AfterReturning $after) -class ConditionalAfterReturningAspect extends Nette\Object +class ConditionalAfterReturningAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\AfterReturning[] */ @@ -324,9 +337,11 @@ class SecondAfterReturningAspect extends AfterReturningAspect -class AfterThrowingAspect extends Nette\Object +class AfterThrowingAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\AfterThrowing[] */ @@ -353,9 +368,11 @@ class SecondAfterThrowingAspect extends AfterThrowingAspect -class AfterAspect extends Nette\Object +class AfterAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\AfterMethod[] */ @@ -380,9 +397,11 @@ class SecondAfterAspect extends AfterAspect } -class AspectWithArguments extends Nette\Object +class AspectWithArguments { + use Nette\SmartObject; + public $args; @@ -405,9 +424,11 @@ public function log(Aop\JoinPoint\AfterMethod $after) } -class ConstructorBeforeAspect extends Nette\Object +class ConstructorBeforeAspect { + use Nette\SmartObject; + /** * @var array|Aop\JoinPoint\BeforeMethod[] */