Mercurial > hg > cmmr2012-drupal-site
comparison vendor/symfony/validator/Mapping/MemberMetadata.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
50 public $property; | 50 public $property; |
51 | 51 |
52 /** | 52 /** |
53 * @var \ReflectionMethod[]|\ReflectionProperty[] | 53 * @var \ReflectionMethod[]|\ReflectionProperty[] |
54 */ | 54 */ |
55 private $reflMember = array(); | 55 private $reflMember = []; |
56 | 56 |
57 /** | 57 /** |
58 * @param string $class The name of the class this member is defined on | 58 * @param string $class The name of the class this member is defined on |
59 * @param string $name The name of the member | 59 * @param string $name The name of the member |
60 * @param string $property The property the member belongs to | 60 * @param string $property The property the member belongs to |
69 /** | 69 /** |
70 * {@inheritdoc} | 70 * {@inheritdoc} |
71 */ | 71 */ |
72 public function addConstraint(Constraint $constraint) | 72 public function addConstraint(Constraint $constraint) |
73 { | 73 { |
74 if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { | 74 if (!\in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { |
75 throw new ConstraintDefinitionException(sprintf( | 75 throw new ConstraintDefinitionException(sprintf('The constraint %s cannot be put on properties or getters', \get_class($constraint))); |
76 'The constraint %s cannot be put on properties or getters', | |
77 get_class($constraint) | |
78 )); | |
79 } | 76 } |
80 | 77 |
81 parent::addConstraint($constraint); | 78 parent::addConstraint($constraint); |
82 | 79 |
83 return $this; | 80 return $this; |
86 /** | 83 /** |
87 * {@inheritdoc} | 84 * {@inheritdoc} |
88 */ | 85 */ |
89 public function __sleep() | 86 public function __sleep() |
90 { | 87 { |
91 return array_merge(parent::__sleep(), array( | 88 return array_merge(parent::__sleep(), [ |
92 'class', | 89 'class', |
93 'name', | 90 'name', |
94 'property', | 91 'property', |
95 )); | 92 ]); |
96 } | 93 } |
97 | 94 |
98 /** | 95 /** |
99 * Returns the name of the member. | 96 * Returns the name of the member. |
100 * | 97 * |
164 * | 161 * |
165 * @return \ReflectionMethod|\ReflectionProperty The reflection instance | 162 * @return \ReflectionMethod|\ReflectionProperty The reflection instance |
166 */ | 163 */ |
167 public function getReflectionMember($objectOrClassName) | 164 public function getReflectionMember($objectOrClassName) |
168 { | 165 { |
169 $className = is_string($objectOrClassName) ? $objectOrClassName : get_class($objectOrClassName); | 166 $className = \is_string($objectOrClassName) ? $objectOrClassName : \get_class($objectOrClassName); |
170 if (!isset($this->reflMember[$className])) { | 167 if (!isset($this->reflMember[$className])) { |
171 $this->reflMember[$className] = $this->newReflectionMember($objectOrClassName); | 168 $this->reflMember[$className] = $this->newReflectionMember($objectOrClassName); |
172 } | 169 } |
173 | 170 |
174 return $this->reflMember[$className]; | 171 return $this->reflMember[$className]; |