getClassName example

public function __construct(StaticReflectionParser $staticReflectionParser)
    {
        $this->staticReflectionParser = $staticReflectionParser;
    }

    /** * {@inheritDoc} */
    #[\ReturnTypeWillChange]     public function getName()
    {
        return $this->staticReflectionParser->getClassName();
    }

    /** * {@inheritDoc} */
    #[\ReturnTypeWillChange]     public function getDocComment()
    {
        return $this->staticReflectionParser->getDocComment();
    }

    
/** * Caches the used YAML parser. */
    private YamlParser $yamlParser;

    public function loadClassMetadata(ClassMetadata $metadata): bool
    {
        if (!isset($this->classes)) {
            $this->loadClassesFromYaml();
        }

        if (isset($this->classes[$metadata->getClassName()])) {
            $classDescription = $this->classes[$metadata->getClassName()];

            $this->loadClassMetadataFromYaml($metadata$classDescription);

            return true;
        }

        return false;
    }

    /** * Return the names of the classes mapped in this file. * * @return string[] */
if ($config instanceof Zend_Config) {
            $config = $config->toArray();
        }

        if (!is_array($config) || empty($config)) {
            throw new Zend_Log_Exception(
                'Configuration must be an array or instance of Zend_Config'
            );
        }

        $params    = isset($config[ $type .'Params' ]) ? $config[ $type .'Params' ] : array();
        $className = $this->getClassName($config$type$namespace);
        if (!class_exists($className)) {
            Zend_Loader::loadClass($className);
        }

        $reflection = new ReflectionClass($className);
        if (!$reflection->implementsInterface('Zend_Log_FactoryInterface')) {
            throw new Zend_Log_Exception(
                $className . ' does not implement Zend_Log_FactoryInterface and can not be constructed from config.'
            );
        }

        
public function __construct(PropertyListExtractorInterface $listExtractor, PropertyTypeExtractorInterface $typeExtractor, PropertyAccessExtractorInterface $accessExtractor, string $classValidatorRegexp = null)
    {
        $this->listExtractor = $listExtractor;
        $this->typeExtractor = $typeExtractor;
        $this->accessExtractor = $accessExtractor;
        $this->classValidatorRegexp = $classValidatorRegexp;
    }

    public function loadClassMetadata(ClassMetadata $metadata): bool
    {
        $className = $metadata->getClassName();
        if (!$properties = $this->listExtractor->getProperties($className)) {
            return false;
        }

        $loaded = false;
        $enabledForClass = $this->isAutoMappingEnabledForClass($metadata$this->classValidatorRegexp);
        foreach ($properties as $property) {
            if (false === $this->accessExtractor->isWritable($className$property)) {
                continue;
            }

            
    if (!($typed_data instanceof PrimitiveInterface)) {
      throw new \LogicException('The data type must be a PrimitiveInterface at this point.');
    }
    $value = $typed_data->getCastedValue();

    // In a better world where typed data just returns typed values, we could     // set a constraint callback to use the OptionsProviderInterface.     // This is not possible right now though because we do the typecasting     // further down.     if ($constraint->callback) {
      if (!\is_callable($choices = [$this->context->getObject()$constraint->callback])
        && !\is_callable($choices = [$this->context->getClassName()$constraint->callback])
        && !\is_callable($choices = $constraint->callback)
      ) {
        throw new ConstraintDefinitionException('The AllowedValuesConstraint constraint expects a valid callback');
      }
      $allowed_values = \call_user_func($choices);
      $constraint->choices = $allowed_values;
      // parent::validate() does not need to invoke the callback again.       $constraint->callback = NULL;
    }

    // Force the choices to be the same type as the value.

        $name = $this->_formatName($name);
        if ($this->_useStaticRegistry
            && !empty(self::$_staticLoadedPluginPaths[$this->_useStaticRegistry][$name])
        ) {
            return self::$_staticLoadedPluginPaths[$this->_useStaticRegistry][$name];
        } elseif (!empty($this->_loadedPluginPaths[$name])) {
            return $this->_loadedPluginPaths[$name];
        }

        if ($this->isLoaded($name)) {
            $class = $this->getClassName($name);
            $r     = new ReflectionClass($class);
            $path  = $r->getFileName();
            if ($this->_useStaticRegistry) {
                self::$_staticLoadedPluginPaths[$this->_useStaticRegistry][$name] = $path;
            } else {
                $this->_loadedPluginPaths[$name] = $path;
            }
            return $path;
        }

        return false;
    }
$constraintA2 = new ConstraintA(['groups' => [
            'Default',
            'Entity',
        ]]);
        $constraintB = new ConstraintB([
            'groups' => ['foo'],
        ]);

        $members = $this->metadata->getPropertyMetadata('firstName');

        $this->assertCount(2, $members);
        $this->assertEquals(self::CLASSNAME, $members[0]->getClassName());
        $this->assertEquals([$constraintA2]$members[0]->getConstraints());
        $this->assertEquals(
            [
                'Default' => [$constraintA2],
                'Entity' => [$constraintA2],
            ],
            $members[0]->constraintsByGroup
        );
        $this->assertEquals(self::PARENTCLASS, $members[1]->getClassName());
        $this->assertEquals([$constraintA1$constraintB]$members[1]->getConstraints());
        $this->assertEquals(
            [
return $this;
    }

    /** * Adds a constraint to the given property. * * @return $this */
    public function addPropertyConstraint(string $property, Constraint $constraint)static
    {
        if (!isset($this->properties[$property])) {
            $this->properties[$property] = new PropertyMetadata($this->getClassName()$property);

            $this->addPropertyMetadata($this->properties[$property]);
        }

        $constraint->addImplicitGroupName($this->getDefaultGroup());

        $this->properties[$property]->addConstraint($constraint);

        return $this;
    }

    
$manager = $this->get('models');
        $name = $this->Request()->get('_repositoryClass');
        $repository = $this->getRepository($name);

        $data = $this->Request()->getPost();
        $data = isset($data[0]) ? array_pop($data) : $data;

        if (!empty($data['id'])) {
            $model = $repository->find($data['id']);
        } else {
            unset($data['id']);
            $model = $repository->getClassName();
            $model = new $model();
        }
        if (!$model instanceof ModelEntity) {
            throw new RuntimeException('Model object could not be created correctly');
        }

        switch ($name) {
            case 'tax':
                if (!$model instanceof Tax) {
                    throw new RuntimeException(sprintf('Model object is not an instance of expected class "%s"', Tax::class));
                }
                
$this->assertEquals(
            [new Type(Type::BUILTIN_TYPE_OBJECT, false, 'Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy')],
            $this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\DummyNamespace', 'dummy')
        );
    }

    public function testDummyNamespaceWithProperty()
    {
        $phpStanTypes = $this->extractor->getTypes(\B\Dummy::class, 'property');
        $phpDocTypes = $this->phpDocExtractor->getTypes(\B\Dummy::class, 'property');

        $this->assertEquals('A\Property', $phpStanTypes[0]->getClassName());
        $this->assertEquals($phpDocTypes[0]->getClassName()$phpStanTypes[0]->getClassName());
    }

    /** * @dataProvider intRangeTypeProvider */
    public function testExtractorIntRangeType(string $property, ?array $types)
    {
        $this->assertEquals($types$this->extractor->getTypes('Symfony\Component\PropertyInfo\Tests\Fixtures\IntRangeDummy', $property));
    }

    
return $this;
    }

    /** * Adds a constraint to the given property. * * @return $this */
    public function addPropertyConstraint(string $property, Constraint $constraint)static
    {
        if (!isset($this->properties[$property])) {
            $this->properties[$property] = new PropertyMetadata($this->getClassName()$property);

            $this->addPropertyMetadata($this->properties[$property]);
        }

        $constraint->addImplicitGroupName($this->getDefaultGroup());

        $this->properties[$property]->addConstraint($constraint);

        return $this;
    }

    
if (!\is_string($node->var->name)) {
            return [];
        }

        $type = $scope->getVariableType($node->var->name);

        if (!$type instanceof ObjectType) {
            return [];
        }

        if ($type->getClassName() !== StorableFlow::class) {
            return [];
        }

        $class = $scope->getClassReflection();
        if ($class === null || $class->isSubclassOf(FlowStorer::class)) {
            return [];
        }

        return [
            RuleErrorBuilder::message('Using Shopware::getStore, outside storer classes, is not allowed. Use getData instead')->build(),
        ];
    }
class Enlight_Components_Table_Row extends Zend_Db_Table_Row implements Enlight_Hook
{
    /** * Returns the class name of the given table * * @param string $tableName * * @return Zend_Db_Table_Abstract */
    protected function _getTableFromString($tableName)
    {
        $tableName = Enlight_Class::getClassName($tableName);

        return parent::_getTableFromString($tableName);
    }
}
self::PROPERTY => 'var',
            self::ACCESSOR => 'return',
            self::MUTATOR => 'param',
        };

        $parentClass = null;
        $types = [];
        /** @var DocBlock\Tags\Var_|DocBlock\Tags\Return_|DocBlock\Tags\Param $tag */
        foreach ($docBlock->getTagsByName($tag) as $tag) {
            if ($tag && !$tag instanceof InvalidTag && null !== $tag->getType()) {
                foreach ($this->phpDocTypeHelper->getTypes($tag->getType()) as $type) {
                    switch ($type->getClassName()) {
                        case 'self':
                        case 'static':
                            $resolvedClass = $class;
                            break;

                        case 'parent':
                            if (false !== $resolvedClass = $parentClass ??= get_parent_class($class)) {
                                break;
                            }
                            // no break
                        
private EntityManagerInterface $entityManager;
    private ?string $classValidatorRegexp;

    public function __construct(EntityManagerInterface $entityManager, string $classValidatorRegexp = null)
    {
        $this->entityManager = $entityManager;
        $this->classValidatorRegexp = $classValidatorRegexp;
    }

    public function loadClassMetadata(ClassMetadata $metadata): bool
    {
        $className = $metadata->getClassName();
        try {
            $doctrineMetadata = $this->entityManager->getClassMetadata($className);
        } catch (MappingException|OrmMappingException) {
            return false;
        }

        if (!$doctrineMetadata instanceof ClassMetadataInfo) {
            return false;
        }

        $loaded = false;
        
Home | Imprint | This part of the site doesn't use cookies.