changed getName() to name on all Reflection* object calls (fixes #4555, refs https://bugs.php.net/bug.php?id=61384)
This commit is contained in:
parent
27100ba4eb
commit
ba16a51d37
@ -230,7 +230,7 @@ class Registry implements RegistryInterface
|
||||
{
|
||||
$proxyClass = new \ReflectionClass($class);
|
||||
if ($proxyClass->implementsInterface('Doctrine\ORM\Proxy\Proxy')) {
|
||||
$class = $proxyClass->getParentClass()->getName();
|
||||
$class = $proxyClass->getParentClass()->name;
|
||||
}
|
||||
|
||||
foreach ($this->entityManagers as $id) {
|
||||
|
@ -274,7 +274,7 @@ class Container implements ContainerInterface
|
||||
$ids = array();
|
||||
$r = new \ReflectionClass($this);
|
||||
foreach ($r->getMethods() as $method) {
|
||||
if (preg_match('/^get(.+)Service$/', $method->getName(), $match)) {
|
||||
if (preg_match('/^get(.+)Service$/', $method->name, $match)) {
|
||||
$ids[] = self::underscore($match[1]);
|
||||
}
|
||||
}
|
||||
|
@ -290,13 +290,13 @@ class PropertyPath implements \IteratorAggregate
|
||||
|
||||
if ($reflClass->hasMethod($getter)) {
|
||||
if (!$reflClass->getMethod($getter)->isPublic()) {
|
||||
throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $getter, $reflClass->getName()));
|
||||
throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $getter, $reflClass->name));
|
||||
}
|
||||
|
||||
return $object->$getter();
|
||||
} elseif ($reflClass->hasMethod($isser)) {
|
||||
if (!$reflClass->getMethod($isser)->isPublic()) {
|
||||
throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $isser, $reflClass->getName()));
|
||||
throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $isser, $reflClass->name));
|
||||
}
|
||||
|
||||
return $object->$isser();
|
||||
@ -305,7 +305,7 @@ class PropertyPath implements \IteratorAggregate
|
||||
return $object->$property;
|
||||
} elseif ($reflClass->hasProperty($property)) {
|
||||
if (!$reflClass->getProperty($property)->isPublic()) {
|
||||
throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()" or "%s()"?', $property, $reflClass->getName(), $getter, $isser));
|
||||
throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()" or "%s()"?', $property, $reflClass->name, $getter, $isser));
|
||||
}
|
||||
|
||||
return $object->$property;
|
||||
@ -313,7 +313,7 @@ class PropertyPath implements \IteratorAggregate
|
||||
// needed to support \stdClass instances
|
||||
return $object->$property;
|
||||
} else {
|
||||
throw new InvalidPropertyException(sprintf('Neither property "%s" nor method "%s()" nor method "%s()" exists in class "%s"', $property, $getter, $isser, $reflClass->getName()));
|
||||
throw new InvalidPropertyException(sprintf('Neither property "%s" nor method "%s()" nor method "%s()" exists in class "%s"', $property, $getter, $isser, $reflClass->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -341,7 +341,7 @@ class PropertyPath implements \IteratorAggregate
|
||||
|
||||
if ($reflClass->hasMethod($setter)) {
|
||||
if (!$reflClass->getMethod($setter)->isPublic()) {
|
||||
throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $setter, $reflClass->getName()));
|
||||
throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $setter, $reflClass->name));
|
||||
}
|
||||
|
||||
$objectOrArray->$setter($value);
|
||||
@ -350,7 +350,7 @@ class PropertyPath implements \IteratorAggregate
|
||||
$objectOrArray->$property = $value;
|
||||
} elseif ($reflClass->hasProperty($property)) {
|
||||
if (!$reflClass->getProperty($property)->isPublic()) {
|
||||
throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()"?', $property, $reflClass->getName(), $setter));
|
||||
throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()"?', $property, $reflClass->name, $setter));
|
||||
}
|
||||
|
||||
$objectOrArray->$property = $value;
|
||||
@ -358,7 +358,7 @@ class PropertyPath implements \IteratorAggregate
|
||||
// needed to support \stdClass instances
|
||||
$objectOrArray->$property = $value;
|
||||
} else {
|
||||
throw new InvalidPropertyException(sprintf('Neither element "%s" nor method "%s()" exists in class "%s"', $property, $setter, $reflClass->getName()));
|
||||
throw new InvalidPropertyException(sprintf('Neither element "%s" nor method "%s()" exists in class "%s"', $property, $setter, $reflClass->name));
|
||||
}
|
||||
} else {
|
||||
$objectOrArray[$property] = $value;
|
||||
|
@ -110,8 +110,8 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
$attributes = $request->attributes->all();
|
||||
$arguments = array();
|
||||
foreach ($parameters as $param) {
|
||||
if (array_key_exists($param->getName(), $attributes)) {
|
||||
$arguments[] = $attributes[$param->getName()];
|
||||
if (array_key_exists($param->name, $attributes)) {
|
||||
$arguments[] = $attributes[$param->name];
|
||||
} elseif ($param->getClass() && $param->getClass()->isInstance($request)) {
|
||||
$arguments[] = $request;
|
||||
} elseif ($param->isDefaultValueAvailable()) {
|
||||
@ -125,7 +125,7 @@ class ControllerResolver implements ControllerResolverInterface
|
||||
$repr = $controller;
|
||||
}
|
||||
|
||||
throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (because there is no default value or because there is a non optional argument after this one).', $repr, $param->getName()));
|
||||
throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (because there is no default value or because there is a non optional argument after this one).', $repr, $param->name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ abstract class AnnotationClassLoader implements LoaderInterface
|
||||
*/
|
||||
protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
|
||||
{
|
||||
$name = strtolower(str_replace('\\', '_', $class->getName()).'_'.$method->getName());
|
||||
$name = strtolower(str_replace('\\', '_', $class->name).'_'.$method->name);
|
||||
if ($this->defaultRouteIndex > 0) {
|
||||
$name .= '_'.$this->defaultRouteIndex;
|
||||
}
|
||||
|
@ -47,6 +47,6 @@ foreach ($finder as $file) {
|
||||
}
|
||||
|
||||
$platform = $reflection->newInstance();
|
||||
$targetFile = sprintf(__DIR__.'/../schema/%s.sql', $platform->getName());
|
||||
$targetFile = sprintf(__DIR__.'/../schema/%s.sql', $platform->name);
|
||||
file_put_contents($targetFile, implode("\n\n", $schema->toSql($platform)));
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer
|
||||
$attributes = array();
|
||||
foreach ($reflectionMethods as $method) {
|
||||
if ($this->isGetMethod($method)) {
|
||||
$attributeName = strtolower(substr($method->getName(), 3));
|
||||
$attributeName = strtolower(substr($method->name, 3));
|
||||
|
||||
$attributeValue = $method->invoke($object);
|
||||
if (null !== $attributeValue && !is_scalar($attributeValue)) {
|
||||
@ -73,7 +73,7 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer
|
||||
|
||||
$params = array();
|
||||
foreach ($constructorParameters as $constructorParameter) {
|
||||
$paramName = strtolower($constructorParameter->getName());
|
||||
$paramName = strtolower($constructorParameter->name);
|
||||
|
||||
if (isset($data[$paramName])) {
|
||||
$params[] = $data[$paramName];
|
||||
@ -83,7 +83,7 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer
|
||||
throw new RuntimeException(
|
||||
'Cannot create an instance of '.$class.
|
||||
' from serialized data because its constructor requires '.
|
||||
'parameter "'.$constructorParameter->getName().
|
||||
'parameter "'.$constructorParameter->name.
|
||||
'" to be present.');
|
||||
}
|
||||
}
|
||||
@ -147,8 +147,8 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer
|
||||
private function isGetMethod(\ReflectionMethod $method)
|
||||
{
|
||||
return (
|
||||
0 === strpos($method->getName(), 'get') &&
|
||||
3 < strlen($method->getName()) &&
|
||||
0 === strpos($method->name, 'get') &&
|
||||
3 < strlen($method->name) &&
|
||||
0 === $method->getNumberOfRequiredParameters()
|
||||
);
|
||||
}
|
||||
|
@ -57,12 +57,12 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
||||
|
||||
// Include constraints from the parent class
|
||||
if ($parent = $metadata->getReflectionClass()->getParentClass()) {
|
||||
$metadata->mergeConstraints($this->getClassMetadata($parent->getName()));
|
||||
$metadata->mergeConstraints($this->getClassMetadata($parent->name));
|
||||
}
|
||||
|
||||
// Include constraints from all implemented interfaces
|
||||
foreach ($metadata->getReflectionClass()->getInterfaces() as $interface) {
|
||||
$metadata->mergeConstraints($this->getClassMetadata($interface->getName()));
|
||||
$metadata->mergeConstraints($this->getClassMetadata($interface->name));
|
||||
}
|
||||
|
||||
$this->loader->loadClassMetadata($metadata);
|
||||
|
@ -32,7 +32,7 @@ class AnnotationLoader implements LoaderInterface
|
||||
public function loadClassMetadata(ClassMetadata $metadata)
|
||||
{
|
||||
$reflClass = $metadata->getReflectionClass();
|
||||
$className = $reflClass->getName();
|
||||
$className = $reflClass->name;
|
||||
$loaded = false;
|
||||
|
||||
foreach ($this->reader->getClassAnnotations($reflClass) as $constraint) {
|
||||
@ -46,10 +46,10 @@ class AnnotationLoader implements LoaderInterface
|
||||
}
|
||||
|
||||
foreach ($reflClass->getProperties() as $property) {
|
||||
if ($property->getDeclaringClass()->getName() == $className) {
|
||||
if ($property->getDeclaringClass()->name == $className) {
|
||||
foreach ($this->reader->getPropertyAnnotations($property) as $constraint) {
|
||||
if ($constraint instanceof Constraint) {
|
||||
$metadata->addPropertyConstraint($property->getName(), $constraint);
|
||||
$metadata->addPropertyConstraint($property->name, $constraint);
|
||||
}
|
||||
|
||||
$loaded = true;
|
||||
@ -58,13 +58,13 @@ class AnnotationLoader implements LoaderInterface
|
||||
}
|
||||
|
||||
foreach ($reflClass->getMethods() as $method) {
|
||||
if ($method->getDeclaringClass()->getName() == $className) {
|
||||
if ($method->getDeclaringClass()->name == $className) {
|
||||
foreach ($this->reader->getMethodAnnotations($method) as $constraint) {
|
||||
if ($constraint instanceof Constraint) {
|
||||
if (preg_match('/^(get|is)(.+)$/i', $method->getName(), $matches)) {
|
||||
if (preg_match('/^(get|is)(.+)$/i', $method->name, $matches)) {
|
||||
$metadata->addGetterConstraint(lcfirst($matches[2]), $constraint);
|
||||
} else {
|
||||
throw new MappingException(sprintf('The constraint on "%s::%s" cannot be added. Constraints can only be added on methods beginning with "get" or "is".', $className, $method->getName()));
|
||||
throw new MappingException(sprintf('The constraint on "%s::%s" cannot be added. Constraints can only be added on methods beginning with "get" or "is".', $className, $method->name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -34,10 +34,10 @@ class StaticMethodLoader implements LoaderInterface
|
||||
$reflMethod = $reflClass->getMethod($this->methodName);
|
||||
|
||||
if (!$reflMethod->isStatic()) {
|
||||
throw new MappingException(sprintf('The method %s::%s should be static', $reflClass->getName(), $this->methodName));
|
||||
throw new MappingException(sprintf('The method %s::%s should be static', $reflClass->name, $this->methodName));
|
||||
}
|
||||
|
||||
if ($reflMethod->getDeclaringClass()->getName() != $reflClass->getName()) {
|
||||
if ($reflMethod->getDeclaringClass()->name != $reflClass->name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user