Creates an instance of the class being reflected using the no-argument constructor.

@return A <code>Reflect</code> object to do further reflection
@throws ReflectionException Something went wrong constructing the object
13684
public Reflect create() throws ReflectionException {
      try {
         return on(clazz.getConstructor(), accessAll);
      } catch (NoSuchMethodException e) {
         if (accessAll) {
            try {
               return on(clazz.getDeclaredConstructor(), accessAll);
            } catch (NoSuchMethodException e2) {
               throw new ReflectionException(e2);
            }
         }
         throw new ReflectionException(e);
      }
   }
427735
public function getReflectionClass()
    {
        if (!$this->reflClass) {
            $this->reflClass = new \ReflectionClass($this->getClassName());
        }

        return $this->reflClass;
    }
1150901
public static ReflectionUtil getInstance() {

    if (instance == null) {
      ReflectionUtilImpl impl = null;
      synchronized (ReflectionUtilImpl.class) {
        if (instance == null) {
          impl = new ReflectionUtilImpl();
          instance = impl;
        }
      }
      if (impl != null) {
        // static access is generally discouraged, cyclic dependency forces this ugly initialization to
        // prevent deadlock.
        impl.initialize();
      }
    }
    return instance;
  }
1054796
public function replay()
    {
        $mockClassName = parent::replay();

        $mockClassReflector = new \ReflectionClass($mockClassName);
        return $mockClassReflector->newInstanceArgs($this->constructor_arguments);
    }
812827
public static Object createInstance(String className)
    {
        //get type
        Class<?> type=ReflectionHelper.getType(className);

        //create instance
        Object instance=ReflectionHelper.createInstance(type);
        
        return instance;
    }
1092067
protected static function execute()
    {
        try {
            $instance = static::getInstance();

            $reflectionMethod = new ReflectionMethod($instance, static::$method);

            return $reflectionMethod->invokeArgs($instance, static::$arguments);
        } catch (Exception $e) {
            throw new Exception($e->getMessage());
        }
    }
435569
public Class createClass(String className) throws ClassNotFoundException {
        Class clazz;
        try {
            clazz = Class.forName(className);
            return clazz;

        } catch (ExceptionInInitializerError eiie) {
            String info = "Could not load the " + description + " object: " + className
                    + ". Could not initialize static object in server: ";
            info += eiie.getMessage();
            throw new ClassNotFoundException(info, eiie);

        } catch (LinkageError le) {
            String info = "Could not load the " + description + " object: " + className
                    + ". This object is depending on a class that has been changed after compilation ";
            info += "or a class that was not found: ";
            info += le.getMessage();
            throw new ClassNotFoundException(info, le);

        } catch (ClassNotFoundException cnfe) {
            String info = "Could not find the " + description + " object: " + className + ": ";
            info += cnfe.getMessage();
            throw new ClassNotFoundException(info, cnfe);
        }
    }
271593
public function create()
    {
        if ($this->reflectionService !== null) {
            return $this->reflectionService;
        }

        $cacheManager = $this->bootstrap->getEarlyInstance(CacheManager::class);
        $configurationManager = $this->bootstrap->getEarlyInstance(ConfigurationManager::class);
        $settings = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'Neos.Flow');

        $reflectionService = new ReflectionService();
        $reflectionService->injectLogger($this->bootstrap->getEarlyInstance(PsrLoggerFactoryInterface::class)->get('systemLogger'));
        $reflectionService->injectSettings($settings);
        $reflectionService->injectPackageManager($this->bootstrap->getEarlyInstance(PackageManager::class));
        $reflectionService->setStatusCache($cacheManager->getCache('Flow_Reflection_Status'));
        $reflectionService->setReflectionDataCompiletimeCache($cacheManager->getCache('Flow_Reflection_CompiletimeData'));
        $reflectionService->setReflectionDataRuntimeCache($cacheManager->getCache('Flow_Reflection_RuntimeData'));
        $reflectionService->setClassSchemataRuntimeCache($cacheManager->getCache('Flow_Reflection_RuntimeClassSchemata'));
        $reflectionService->injectEnvironment($this->bootstrap->getEarlyInstance(Environment::class));

        $this->reflectionService = $reflectionService;
        return $reflectionService;
    }
223536
private static function getReflection(): ReflectionClass
    {
        $class = static::class;

        if (array_key_exists($class, self::$reflections)) {
            return self::$reflections[$class];
        }

        self::$reflections[$class] = $reflection = new ReflectionClass($class);

        $constants = $reflection->getConstants();
        if ([] === $constants) {
            throw new LogicException(sprintf('Class %s must define Constants', static::class));
        }

        foreach ($constants as $value) {
            if (!\is_int($value)) {
                throw new LogicException('All enum constants must be in integer type');
            }
        }

        return $reflection;
    }
674327
public static <T> T instantiate(Class<T> type) {
        try {
            return BeanIntrospector.SHARED.findIntrospection(type).map(BeanIntrospection::instantiate).orElseGet(() -> {
                try {
                    Logger log = ClassUtils.REFLECTION_LOGGER;
                    if (log.isDebugEnabled()) {
                        log.debug("Reflectively instantiating type: " + type);
                    }
                    return type.newInstance();
                } catch (Throwable e) {
                    throw new InstantiationException("Could not instantiate type [" + type.getName() + "]: " + e.getMessage(), e);
                }
            });
        } catch (Throwable e) {
            throw new InstantiationException("Could not instantiate type [" + type.getName() + "]: " + e.getMessage(), e);
        }
    }
1326963
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                MatcherFactory::instance(),
                MatcherVerifier::instance(),
                GeneratorVerifierFactory::instance(),
                IterableVerifierFactory::instance(),
                ExceptionAssertionRecorder::instance(),
                AssertionRenderer::instance()
            );
        }

        return self::$instance;
    }
1171331
final protected function getModularReflection() : ReflectionClass
    {
        if (! $this->privateModularReflectionClass instanceof ReflectionClass) {
            $this->privateModularReflectionClass = new ReflectionClass($this);
        }

        return $this->privateModularReflectionClass;
    }
530997
public static function instance(): self
    {
        if (!self::$instance) {
            self::$instance = new self(
                StubFactory::instance(),
                StubVerifierFactory::instance(),
                EmptyValueFactory::instance(),
                AssertionRenderer::instance(),
                ExceptionAssertionRecorder::instance(),
                Invoker::instance()
            );
        }

        return self::$instance;
    }
974489
public function getReflectionClass()
    {
        if ($this->reflectionClass === null)
        {
            $this->reflectionClass = new ReflectionClass($this->getName());
        }
        return $this->reflectionClass;
    }
694709
public function build(): object
    {
        $object = $this->instanciator->build($this->class, $this->properties);
        $parameters = $this->instanciator->parameters($this->class);

        //avoid injecting the properties already used in the constructor
        $properties = $this
            ->properties
            ->filter(function(string $property) use ($parameters) {
                return !$parameters->contains($property);
            });
        $refl = new ReflectionObject(
            $object,
            $properties,
            $this->injectionStrategy
        );

        return $refl->build();
    }
1188391
public static DeploymentReflectionIndex create() {
        final SecurityManager sm = System.getSecurityManager();
        if (sm != null) {
            sm.checkPermission(ServerPermission.CREATE_DEPLOYMENT_REFLECTION_INDEX);
        }
        return new DeploymentReflectionIndex();
    }
1149293
static <T> Object[] arguments(final Class<T> klass, final T instance,
                                  final Class<?>[] types,
                                  final String[] literals)
            throws ReflectiveOperationException {
        final Object[] arguments = new Object[literals.length];
        for (int i = 0; i < literals.length; i++) {
            if ("null".equals(literals[i])) {
                arguments[i] = null;
                continue;
            }
            if (literals[i].startsWith(":")) {
                final String name = literals[i].substring(1);
                final Field field = field(klass, name);
                if (!field.isAccessible()) {
                    field.setAccessible(true);
                }
                arguments[i] = field.get(instance);
                continue;
            }
            if (types[i] == String.class) {
                arguments[i] = literals[i];
                continue;
            }
            if (types[i].isPrimitive()) {
                types[i] = wrapper(types[i]);
            }
            arguments[i] = types[i]
                    .getMethod("valueOf", String.class)
                    .invoke(null, literals[i]);
        }
        return arguments;
    }