88use Azura \Normalizer \TypeExtractor \EntityTypeExtractor ;
99use Doctrine \Common \Collections \Collection ;
1010use Doctrine \ORM \EntityManagerInterface ;
11- use Doctrine \ORM \Proxy \DefaultProxyClassNameResolver ;
1211use InvalidArgumentException ;
1312use ReflectionClass ;
1413use ReflectionException ;
2019
2120final class DoctrineEntityNormalizer extends AbstractObjectNormalizer
2221{
23- public const CLASS_METADATA = 'class_metadata ' ;
24- public const ASSOCIATION_MAPPINGS = 'association_mappings ' ;
22+ public const string CLASS_METADATA = 'class_metadata ' ;
23+ public const string ASSOCIATION_MAPPINGS = 'association_mappings ' ;
2524
26- public const NORMALIZE_TO_IDENTIFIERS = 'form_mode ' ;
25+ public const string NORMALIZE_TO_IDENTIFIERS = 'form_mode ' ;
2726
2827 private EntityTypeExtractor $ typeExtractor ;
2928
@@ -150,7 +149,7 @@ public function supportsDenormalization(mixed $data, string $type, ?string $form
150149 * @return string[]|AttributeMetadataInterface[]|bool
151150 */
152151 protected function getAllowedAttributes (
153- $ classOrObject ,
152+ string | object $ classOrObject ,
154153 array $ context ,
155154 bool $ attributesAsString = false
156155 ): array |bool {
@@ -186,7 +185,6 @@ protected function extractAttributes(object $object, ?string $format = null, arr
186185 * @param string|null $format
187186 * @param array $context
188187 * @return bool
189- * @throws ReflectionException
190188 */
191189 protected function isAllowedAttribute (
192190 object |string $ classOrObject ,
@@ -290,7 +288,7 @@ private function supportsDeepNormalization(ReflectionClass $reflClass, string $a
290288 /** @var DeepNormalize $deepNormalize */
291289 $ deepNormalize = current ($ deepNormalizeAttrs )->newInstance ();
292290 return $ deepNormalize ->getDeepNormalize ();
293- } catch (\ ReflectionException ) {
291+ } catch (ReflectionException ) {
294292 return false ;
295293 }
296294 }
@@ -308,7 +306,7 @@ private function getProperty(
308306 string $ key
309307 ): mixed {
310308 if (null !== $ accessor = $ this ->typeExtractor ->getAccessorMethod ($ reflClass , $ key )) {
311- [$ method , $ prefix ] = $ accessor ;
309+ [$ method ,] = $ accessor ;
312310 return $ method ->invoke ($ entity );
313311 }
314312
@@ -389,7 +387,7 @@ private function setProperty(
389387 ): void {
390388 // Prefer setter if it exists.
391389 if (null !== $ mutator = $ this ->typeExtractor ->getMutatorMethod ($ reflClass , $ key )) {
392- [$ method , $ prefix ] = $ mutator ;
390+ [$ method ,] = $ mutator ;
393391 $ method ->invoke ($ entity , $ value );
394392 return ;
395393 }
@@ -406,7 +404,7 @@ private function setProperty(
406404 private function isEntity (mixed $ class ): bool
407405 {
408406 if (is_object ($ class )) {
409- $ class = DefaultProxyClassNameResolver:: getClass ( $ class) ;
407+ $ class = $ class :: class;
410408 }
411409
412410 if (!is_string ($ class ) || !class_exists ($ class )) {
0 commit comments