@@ -41,13 +41,15 @@ discard block |
||
| 41 | 41 | ? (new Factory())->create() |
| 42 | 42 | : new AttributeReader($this->namedArguments ? new NamedArgumentsInstantiator() : null); |
| 43 | 43 | |
| 44 | - if ($attribute === null) { |
|
| 44 | + if ($attribute === null) |
|
| 45 | + { |
|
| 45 | 46 | return; |
| 46 | 47 | } |
| 47 | 48 | |
| 48 | 49 | $attribute = $attribute->newInstance(); |
| 49 | 50 | |
| 50 | - foreach ($classes as $class) { |
|
| 51 | + foreach ($classes as $class) |
|
| 52 | + { |
|
| 51 | 53 | // If attribute is defined on class level and class has target attribute |
| 52 | 54 | // then we can add it to the list of classes |
| 53 | 55 | if (($attribute->flags & \Attribute::TARGET_CLASS) |
@@ -59,9 +61,12 @@ discard block |
||
| 59 | 61 | |
| 60 | 62 | // If attribute is defined on method level and class methods has target attribute |
| 61 | 63 | // then we can add it to the list of classes |
| 62 | - if ($attribute->flags & \Attribute::TARGET_METHOD) { |
|
| 63 | - foreach ($class->getMethods() as $method) { |
|
| 64 | - if ($reader->firstFunctionMetadata($method, $target->getName())) { |
|
| 64 | + if ($attribute->flags & \Attribute::TARGET_METHOD) |
|
| 65 | + { |
|
| 66 | + foreach ($class->getMethods() as $method) |
|
| 67 | + { |
|
| 68 | + if ($reader->firstFunctionMetadata($method, $target->getName())) |
|
| 69 | + { |
|
| 65 | 70 | yield $class->getName(); |
| 66 | 71 | continue 2; |
| 67 | 72 | } |
@@ -70,9 +75,12 @@ discard block |
||
| 70 | 75 | |
| 71 | 76 | // If attribute is defined on property level and class properties has target attribute |
| 72 | 77 | // then we can add it to the list of classes |
| 73 | - if ($attribute->flags & \Attribute::TARGET_PROPERTY) { |
|
| 74 | - foreach ($class->getProperties() as $property) { |
|
| 75 | - if ($reader->firstPropertyMetadata($property, $target->getName())) { |
|
| 78 | + if ($attribute->flags & \Attribute::TARGET_PROPERTY) |
|
| 79 | + { |
|
| 80 | + foreach ($class->getProperties() as $property) |
|
| 81 | + { |
|
| 82 | + if ($reader->firstPropertyMetadata($property, $target->getName())) |
|
| 83 | + { |
|
| 76 | 84 | yield $class->getName(); |
| 77 | 85 | continue 2; |
| 78 | 86 | } |
@@ -82,9 +90,12 @@ discard block |
||
| 82 | 90 | |
| 83 | 91 | // If attribute is defined on constant level and class constants has target attribute |
| 84 | 92 | // then we can add it to the list of classes |
| 85 | - if ($attribute->flags & \Attribute::TARGET_CLASS_CONSTANT) { |
|
| 86 | - foreach ($class->getReflectionConstants() as $constant) { |
|
| 87 | - if ($reader->firstConstantMetadata($constant, $target->getName())) { |
|
| 93 | + if ($attribute->flags & \Attribute::TARGET_CLASS_CONSTANT) |
|
| 94 | + { |
|
| 95 | + foreach ($class->getReflectionConstants() as $constant) |
|
| 96 | + { |
|
| 97 | + if ($reader->firstConstantMetadata($constant, $target->getName())) |
|
| 98 | + { |
|
| 88 | 99 | yield $class->getName(); |
| 89 | 100 | continue 2; |
| 90 | 101 | } |
@@ -94,10 +105,14 @@ discard block |
||
| 94 | 105 | |
| 95 | 106 | // If attribute is defined on method parameters level and class method parameter has target attribute |
| 96 | 107 | // then we can add it to the list of classes |
| 97 | - if ($attribute->flags & \Attribute::TARGET_PARAMETER) { |
|
| 98 | - foreach ($class->getMethods() as $method) { |
|
| 99 | - foreach ($method->getParameters() as $parameter) { |
|
| 100 | - if ($reader->firstParameterMetadata($parameter, $target->getName())) { |
|
| 108 | + if ($attribute->flags & \Attribute::TARGET_PARAMETER) |
|
| 109 | + { |
|
| 110 | + foreach ($class->getMethods() as $method) |
|
| 111 | + { |
|
| 112 | + foreach ($method->getParameters() as $parameter) |
|
| 113 | + { |
|
| 114 | + if ($reader->firstParameterMetadata($parameter, $target->getName())) |
|
| 115 | + { |
|
| 101 | 116 | yield $class->getName(); |
| 102 | 117 | continue 3; |
| 103 | 118 | } |