@@ -62,7 +62,7 @@ final class TranslatableClassMetadata
6262 private ?ReflectionProperty $ translationLocaleProperty = null ;
6363
6464 /**
65- * @var ReflectionClass<object>|null $translationClass
65+ * @var ReflectionClass<object>|null
6666 */
6767 private ?ReflectionClass $ translationClass = null ;
6868
@@ -75,9 +75,9 @@ final class TranslatableClassMetadata
7575
7676 /**
7777 * @param class-string<object> $class The FQCN for the entity class whose translatable fields are described by this
78- * TranslatableClassMetadata instance. If the class has base entity classes (or mapped
79- * superclasses), a separate instance of TranslatableClassMetadata will be used for
80- * their fields.
78+ * TranslatableClassMetadata instance. If the class has base entity classes (or mapped
79+ * superclasses), a separate instance of TranslatableClassMetadata will be used for
80+ * their fields.
8181 */
8282 private function __construct (
8383 private readonly string $ class
@@ -112,23 +112,23 @@ public function setLogger(?LoggerInterface $logger = null): void
112112
113113 public function sleep (): SerializedTranslatableClassMetadata
114114 {
115- if ($ this -> translationClass === null ) {
115+ if (null === $ this -> translationClass ) {
116116 throw new ShouldNotHappen ('translationClass cannot be null ' );
117117 }
118118
119- if ($ this -> primaryLocale === null ) {
119+ if (null === $ this -> primaryLocale ) {
120120 throw new ShouldNotHappen ('primaryLocale cannot be null ' );
121121 }
122122
123- if ($ this -> translationLocaleProperty === null ) {
123+ if (null === $ this -> translationLocaleProperty ) {
124124 throw new ShouldNotHappen ('translationLocaleProperty cannot be null ' );
125125 }
126126
127- if ($ this -> translationMappingProperty === null ) {
127+ if (null === $ this -> translationMappingProperty ) {
128128 throw new ShouldNotHappen ('translationMappingProperty cannot be null ' );
129129 }
130130
131- if ($ this -> translationsCollectionProperty === null ) {
131+ if (null === $ this -> translationsCollectionProperty ) {
132132 throw new ShouldNotHappen ('translationsCollectionProperty cannot be null ' );
133133 }
134134
@@ -164,7 +164,6 @@ public static function wakeup(SerializedTranslatableClassMetadata $data, Runtime
164164 $ self ->primaryLocale = $ data ->primaryLocale ;
165165 $ self ->translationClass = $ reflectionService ->getClass ($ data ->translationClass );
166166
167-
168167 foreach ($ data ->translationFieldMapping as $ fieldname => $ property ) {
169168 $ self ->translationFieldMapping [$ fieldname ] = $ reflectionService ->getAccessibleProperty (...$ property ) ??
170169 throw new ShouldNotHappen ("Cannot get reflection on {$ property [0 ]}:: {$ property [1 ]}" );
@@ -218,7 +217,7 @@ private function assertAttributesAreComplete(string $class): void
218217 */
219218 private function findTranslatedProperties (ClassMetadata $ cm , ClassMetadataFactory $ classMetadataFactory ): void
220219 {
221- if ($ this -> translationClass === null ) {
220+ if (null === $ this -> translationClass ) {
222221 return ;
223222 }
224223
@@ -234,13 +233,13 @@ private function findTranslatedProperties(ClassMetadata $cm, ClassMetadataFactor
234233 already contains that declaration, we need not include it.
235234 */
236235 $ declaringClass = $ reflectionProperty ->getDeclaringClass ()->name ;
237- if ($ declaringClass !== $ cm ->name && $ cm -> parentClasses !== [] && is_a ($ cm ->parentClasses [0 ], $ declaringClass , true )) {
236+ if ($ declaringClass !== $ cm ->name && [] !== $ cm -> parentClasses && is_a ($ cm ->parentClasses [0 ], $ declaringClass , true )) {
238237 continue ;
239238 }
240239
241240 $ attributes = $ reflectionProperty ->getAttributes (Attribute \Translatable::class);
242241
243- if ($ attributes === [] ) {
242+ if ([] === $ attributes ) {
244243 continue ;
245244 }
246245
@@ -268,7 +267,7 @@ private function findTranslationsCollection(ClassMetadata $cm, ClassMetadataFact
268267
269268 $ reflectionProperty = $ cm ->getReflectionProperty ($ fieldName );
270269
271- if ($ reflectionProperty !== null && $ reflectionProperty ->getAttributes (Attribute \TranslationCollection::class) !== [] ) {
270+ if (null !== $ reflectionProperty && [] !== $ reflectionProperty ->getAttributes (Attribute \TranslationCollection::class)) {
272271 if (!$ mapping instanceof InverseSideMapping) {
273272 return ;
274273 }
@@ -309,7 +308,7 @@ private function parseTranslationsEntity(ClassMetadata $cm): void
309308 foreach ($ cm ->fieldMappings as $ fieldName => $ mapping ) {
310309 $ reflectionProperty = $ cm ->getReflectionProperty ($ fieldName );
311310
312- if ($ reflectionProperty !== null && $ reflectionProperty ->getAttributes (Attribute \Locale::class) !== [] ) {
311+ if (null !== $ reflectionProperty && [] !== $ reflectionProperty ->getAttributes (Attribute \Locale::class)) {
313312 $ this ->translationLocaleProperty = $ reflectionProperty ;
314313
315314 return ;
0 commit comments