@param \ReflectionClass $reflectionClass

@return bool|CoverFishMessageError
199269
public function validateReflectionClassForAccessorNotPublic(\ReflectionClass $reflectionClass)
    {
        $methods = array_merge(
            $reflectionClass->getMethods(\ReflectionMethod::IS_PRIVATE),
            $reflectionClass->getMethods(\ReflectionMethod::IS_PROTECTED)
        );

        if (empty($methods)) {
            return new CoverFishMessageError(
                CoverFishMessageError::PHPUNIT_REFLECTION_NO_NOT_PUBLIC_METHODS_FOUND, null
            );
        }

        return true;
    }
321608
public function createInjection(\ReflectionClass $class, string $context = null)
    {
        if ($class->isSubclassOf(ClassesInterface::class)) {
            return $this->classLocator();
        } elseif ($class->isSubclassOf(InvocationsInterface::class)) {
            return $this->invocationLocator();
        }

        throw new InjectionException("Unable to create injection for {$class}");
    }
595867
protected function canInstantiate(ReflectionClass $class)
    {
        if (!$class->isInstantiable()) {
            return false;
        }

        $constructor = $class->getConstructor();

        return is_null($constructor) || 0 === $constructor->getNumberOfRequiredParameters();
    }
473907
public static function createResourceForClass(\ReflectionClass $reflectionClass)
    {
        @trigger_error('The '.__METHOD__.'() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use ContainerBuilder::getReflectionClass() instead.', E_USER_DEPRECATED);

        $metadata = array();

        foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $reflectionMethod) {
            if (!$reflectionMethod->isStatic()) {
                $metadata[$reflectionMethod->name] = self::getResourceMetadataForMethod($reflectionMethod);
            }
        }

        return new AutowireServiceResource($reflectionClass->name, $reflectionClass->getFileName(), $metadata);
    }
254400
public function getPostConstruct(\ReflectionClass $class)
    {
        $methods = $class->getMethods();
        foreach ($methods as $method) {
            /* @var $annotation PostConstruct|null */
            $annotation = $this->reader->getMethodAnnotation($method, PostConstruct::class);
            if ($annotation instanceof PostConstruct) {
                return $method;
            }
        }
    }
1171331
final protected function getModularReflection() : ReflectionClass
    {
        if (! $this->privateModularReflectionClass instanceof ReflectionClass) {
            $this->privateModularReflectionClass = new ReflectionClass($this);
        }

        return $this->privateModularReflectionClass;
    }
1177161
public function validateReflectionClassForAccessorNotPrivate(\ReflectionClass $reflectionClass)
    {
        $methods = array_merge(
            $reflectionClass->getMethods(\ReflectionMethod::IS_PROTECTED),
            $reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC)
        );

        if (empty($methods)) {
            return new CoverFishMessageError(
                CoverFishMessageError::PHPUNIT_REFLECTION_NO_NOT_PRIVATE_METHODS_FOUND, null
            );
        }

        return true;
    }
1112344
private function hasFileEncryptionEnabled(\ReflectionClass $reflection)
    {
        $classMetadata = $this->getEncryptionMetadataFor($reflection->getName());
        return $classMetadata->encryptionEnabled && $classMetadata->encryptedFile;
    }
821395
private function supports($class)
    {
        $class = new \ReflectionClass($class);
        $methods = $class->getMethods(\ReflectionMethod::IS_PUBLIC);
        foreach ($methods as $method) {
            if ($this->isGetMethod($method)) {
                return true;
            }
        }

        return false;
    }
386304
public function validateClassMethod(CoverFishMapping $coverMapping, CoverFishResult $coverFishResult)
    {
        $methodReflectionResult = $this->validateReflectionMethod($coverMapping->getClassFQN(), $coverMapping->getMethod());
        if ($methodReflectionResult instanceof CoverFishMessageError) {
            $coverFishResult = $this->setValidationError(
                $coverFishResult,
                $methodReflectionResult->getMessageCode()
            );
        }

        return $coverFishResult;
    }
730776
public function validateDefaultCoverClassMapping(CoverFishMapping $coverMapping, CoverFishResult $coverFishResult)
    {
        if (empty($coverMapping->getClassFQN())) {
            $coverFishResult = $this->setValidationError(
                $coverFishResult,
                empty($coverMapping->getClass())
                    ? CoverFishMessageError::PHPUNIT_VALIDATOR_MISSING_DEFAULT_COVER_CLASS_PROBLEM
                    : CoverFishMessageError::PHPUNIT_REFLECTION_CLASS_NOT_DEFINED
            );
        }

        return $coverFishResult;
    }
888280
private function getFromAnnotation(ReflectionClass $class): array
    {
        $sortings = Utils::getRecursiveClassAnnotations($this->getAnnotationReader(), $class, Sorting::class);

        $result = [];
        foreach ($sortings as $classWithAnnotation => $sorting) {
            foreach ($sorting->classes as $className) {
                $this->throwIfInvalidAnnotation($classWithAnnotation, 'Sorting', SortingInterface::class, $className);

                $name = lcfirst(preg_replace('~Type$~', '', Utils::getTypeName($className)));
                $result[$name] = new $className();
            }
        }

        return $result;
    }
11661
private function make(string $class)
    {
        if (! array_key_exists($class, $this->instances)) {

            try {

                return $this->instances[$class] = ($this->factory)($class)->value($this);

            }

            catch (ResolvingExceptionInterface $e) {

                throw new ReflectionContainerException($class, $e);

            }

        }

        return $this->instances[$class];
    }
1333059
public function parse(\ReflectionClass $class)
    {
        $className = $class->getName();

        if ($class->isTrait()) {
            return false;
        }

        if (!isset($this->documents[$className])) {
            /** @var Document $document */
            $document = $this->reader->getClassAnnotation($class, self::DOCUMENT_ANNOTATION);

            if ($document === null) {
                throw new MissingDocumentAnnotationException(
                    sprintf(
                        '"%s" class cannot be parsed as document because @Document annotation is missing.',
                        $class->getName()
                    )
                );
            }

            $fields = [];
            $aliases = $this->getAliases($class, $fields);

            $this->documents[$className] = [
                'type' => $document->type ?: Caser::snake($class->getShortName()),
                'properties' => $this->getProperties($class),
                'fields' => array_filter(
                    array_merge(
                        $document->dump(),
                        $fields
                    )
                ),
                'aliases' => $aliases,
                'analyzers' => $this->getAnalyzers($class),
                'objects' => $this->getObjects(),
                'namespace' => $class->getName(),
                'class' => $class->getShortName(),
            ];
        }
        return $this->documents[$className];
    }
445348
public function getFilters(\ReflectionClass $reflectionClass)
    {
        if ($this->isProduction()) {
            $this->grid->getFilter()->getFields();
        }

        $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PRIVATE | \ReflectionProperty::IS_PROTECTED);
        /** @var \ReflectionProperty $property */
        foreach ($properties as $property) {
            $propertyAnnotations = $this->extractorFactory->extract($property, Extractor::PROPERTY_ANNOTATION);
            foreach ($propertyAnnotations as $annotation) {
                if ($annotation instanceof Filter) {
                    $fields[] = $property->getName();
                }
            }
        }

        return !empty($fields) ? $fields : $this->grid->getFilter()->getFields();
    }
643422
public function read(\ReflectionClass $reflectionClass)
    {
        $collection = new RestRouteCollection();
        $collection->addResource(new FileResource($reflectionClass->getFileName()));

        // read prefix annotation
        if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, Annotations\Prefix::class)) {
            $this->actionReader->setRoutePrefix($annotation->value);
        }

        // read name-prefix annotation
        if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, Annotations\NamePrefix::class)) {
            $this->actionReader->setNamePrefix($annotation->value);
        }

        // read version annotation
        if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, Annotations\Version::class)) {
            $this->actionReader->setVersions($annotation->value);
        }

        $resource = [];
        // read route-resource annotation
        if ($annotation = $this->annotationReader->getClassAnnotation($reflectionClass, Annotations\RouteResource::class)) {
            $resource = explode('_', $annotation->resource);
            $this->actionReader->setPluralize($annotation->pluralize);
        } elseif ($reflectionClass->implementsInterface(ClassResourceInterface::class)) {
            $resource = preg_split(
                '/([A-Z][^A-Z]*)Controller/', $reflectionClass->getShortName(), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
            );
            if (empty($resource)) {
                throw new \InvalidArgumentException("Controller '{$reflectionClass->name}' does not identify a resource");
            }
        }

        // trim '/' at the start of the prefix
        if ('/' === substr($prefix = $this->actionReader->getRoutePrefix(), 0, 1)) {
            $this->actionReader->setRoutePrefix(substr($prefix, 1));
        }

        // read action routes into collection
        foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
            $this->actionReader->read($collection, $method, $resource);
        }

        $this->actionReader->setRoutePrefix(null);
        $this->actionReader->setNamePrefix(null);
        $this->actionReader->setVersions(null);
        $this->actionReader->setPluralize(null);
        $this->actionReader->setParents([]);

        return $collection;
    }
222252
private function getParentProperties(\ReflectionClass $reflectionClass)
    {
        $parent = $reflectionClass->getParentClass();
        if ($parent != null) {
            return array_merge($reflectionClass->getProperties(), $this->getParentProperties($parent));
        }

        return $reflectionClass->getProperties();
    }