Skip to content

Commit 32c2476

Browse files
committed
* Fix if is_sub_class
* Refactor because of https://bugs.php.net/bug.php?id=61384
1 parent fe042a5 commit 32c2476

File tree

6 files changed

+15
-13
lines changed

6 files changed

+15
-13
lines changed

Maslosoft/Addendum/Addendum.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,10 @@ private static function getDeclaredAnnotations()
231231
self::$_annotations = array();
232232
foreach(get_declared_classes() as $class)
233233
{
234-
if(is_subclass_of($class, 'EAnnotation') || $class == 'EAnnotation')
234+
if(is_subclass_of($class, Annotation::class) || $class == Annotation::class)
235+
{
235236
self::$_annotations[] = $class;
237+
}
236238
}
237239
}
238240
return self::$_annotations;

Maslosoft/Addendum/Annotation.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract class Annotation extends CComponent
4545
public function __construct($data = [], $target = false)
4646
{
4747
$reflection = new ReflectionClass($this);
48-
$class = $reflection->getName();
48+
$class = $reflection->name;
4949
if (isset(self::$_creationStack[$class]))
5050
{
5151
trigger_error("Circular annotation reference on '$class'", E_USER_ERROR);
@@ -128,15 +128,15 @@ private function createName($target)
128128
{
129129
if ($target instanceof ReflectionMethod)
130130
{
131-
return $target->getDeclaringClass()->getName() . '::' . $target->getName();
131+
return $target->getDeclaringClass()->name . '::' . $target->name;
132132
}
133133
elseif ($target instanceof ReflectionProperty)
134134
{
135-
return $target->getDeclaringClass()->getName() . '::$' . $target->getName();
135+
return $target->getDeclaringClass()->name . '::$' . $target->name;
136136
}
137137
else
138138
{
139-
return $target->getName();
139+
return $target->name;
140140
}
141141
}
142142

Maslosoft/Addendum/Builder/Builder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ private function createName($target)
8585
{
8686
if($target instanceof ReflectionMethod)
8787
{
88-
return $target->getDeclaringClass()->getName() . '::' . $target->getName();
88+
return $target->getDeclaringClass()->name . '::' . $target->name;
8989
}
9090
elseif($target instanceof ReflectionProperty)
9191
{
92-
return $target->getDeclaringClass()->getName() . '::$' . $target->getName();
92+
return $target->getDeclaringClass()->name . '::$' . $target->name;
9393
}
9494
else
9595
{
96-
return $target->getName();
96+
return $target->name;
9797
}
9898
}
9999

Maslosoft/Addendum/Reflection/ReflectionAnnotatedClass.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ protected function createAnnotationBuilder()
9292

9393
private function createReflectionAnnotatedClass($class)
9494
{
95-
return ($class !== false) ? new ReflectionAnnotatedClass($class->getName()) : false;
95+
return ($class !== false) ? new ReflectionAnnotatedClass($class->name) : false;
9696
}
9797

9898
private function createReflectionAnnotatedMethod($method)
9999
{
100-
return ($method !== null) ? new ReflectionAnnotatedMethod($this->getName(), $method->getName()) : null;
100+
return ($method !== null) ? new ReflectionAnnotatedMethod($this->name, $method->name) : null;
101101
}
102102

103103
private function createReflectionAnnotatedProperty($property)
104104
{
105-
return ($property !== null) ? new ReflectionAnnotatedProperty($this->getName(), $property->getName()) : null;
105+
return ($property !== null) ? new ReflectionAnnotatedProperty($this->name, $property->name) : null;
106106
}
107107
}

Maslosoft/Addendum/Reflection/ReflectionAnnotatedMethod.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function getAllAnnotations($restriction = false)
3636
public function getDeclaringClass()
3737
{
3838
$class = parent::getDeclaringClass();
39-
return new ReflectionAnnotatedClass($class->getName());
39+
return new ReflectionAnnotatedClass($class->name);
4040
}
4141

4242
protected function createAnnotationBuilder()

Maslosoft/Addendum/Reflection/ReflectionAnnotatedProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getAllAnnotations($restriction = false)
4242
public function getDeclaringClass()
4343
{
4444
$class = parent::getDeclaringClass();
45-
return new ReflectionAnnotatedClass($class->getName());
45+
return new ReflectionAnnotatedClass($class->name);
4646
}
4747

4848
/**

0 commit comments

Comments
 (0)