Compare commits

...

3 Commits

Author SHA1 Message Date
Dave Mc Nicoll
564a05a1d4 Merge branch 'master' of https://git.mcnd.ca/mcndave/notes into attributes 2023-02-08 16:32:11 +00:00
Dave Mc Nicoll
1accac94c0 - Fixed the Ignore attribute 2023-02-08 16:31:51 +00:00
aca093dd97 - Fixed a bug with Union types within methods arguments 2023-02-07 16:50:16 +00:00
2 changed files with 9 additions and 2 deletions

6
src/Attribute/Ignore.php Normal file
View File

@ -0,0 +1,6 @@
<?php
namespace Notes\Attribute;
#[\Attribute(\Attribute::TARGET_ALL)]
class Ignore implements \Notes\Attribute {}

View File

@ -3,6 +3,7 @@
namespace Notes; namespace Notes;
use Kash\HandleCacheTrait; use Kash\HandleCacheTrait;
use Notes\Attribute\Ignore;
use Psr\SimpleCache\CacheInterface; use Psr\SimpleCache\CacheInterface;
use Reflector, ReflectionClass, ReflectionProperty, ReflectionMethod, ReflectionUnionType, ReflectionNamedType, ReflectionParameter; use Reflector, ReflectionClass, ReflectionProperty, ReflectionMethod, ReflectionUnionType, ReflectionNamedType, ReflectionParameter;
@ -167,7 +168,7 @@ class ObjectReflection {
$current = [ $current = [
'name' => $method->getName(), 'name' => $method->getName(),
'type' => $method->hasReturnType() ? $method->getReturnType()->getName() : false, 'type' => $method->hasReturnType() && $method->getReturnType() instanceof \ReflectionNamedType ? $method->getReturnType()->getName() : false,
'constructor' => $method->isConstructor(), 'constructor' => $method->isConstructor(),
'destructor' => $method->isDestructor(), 'destructor' => $method->isDestructor(),
'parameters' => $parameters, 'parameters' => $parameters,
@ -187,7 +188,7 @@ class ObjectReflection {
protected function ignoreElementAnnotation($tags) : bool protected function ignoreElementAnnotation($tags) : bool
{ {
return in_array('IGNORE', array_map('strtoupper', array_column($tags, 'tag') )); return [] !== array_filter($tags, fn($e) => ( $e['object'] ?? null ) instanceof Ignore);
} }