__invoke($%s); PHP; public static function generateSnippet(Properties $properties, string $instanceName): string { $scopedPropertyGroups = []; $nonScopedProperties = []; foreach ($properties->getInstanceProperties() as $propertyInternalName => $property) { if ($property->isPrivate() || (\PHP_VERSION_ID >= 80100 && $property->isReadOnly())) { $scopedPropertyGroups[$property->getDeclaringClass()->getName()][$property->getName()] = $property; } else { $nonScopedProperties[$propertyInternalName] = $property; } } return self::generateUnsetNonScopedPropertiesCode($nonScopedProperties, $instanceName) . self::generateUnsetScopedPropertiesCode($scopedPropertyGroups, $instanceName); } /** @param array $nonScopedProperties */ private static function generateUnsetNonScopedPropertiesCode(array $nonScopedProperties, string $instanceName): string { if (! $nonScopedProperties) { return ''; } return self::generateUnsetStatement($nonScopedProperties, $instanceName) . "\n\n"; } /** @param array> $scopedPropertyGroups */ private static function generateUnsetScopedPropertiesCode(array $scopedPropertyGroups, string $instanceName): string { if (! $scopedPropertyGroups) { return ''; } $unsetClosureCalls = []; foreach ($scopedPropertyGroups as $scopedProperties) { $firstProperty = reset($scopedProperties); assert($firstProperty instanceof ReflectionProperty); $unsetClosureCalls[] = self::generateUnsetClassScopedPropertiesBlock( $firstProperty->getDeclaringClass(), $scopedProperties, $instanceName ); } return implode("\n\n", $unsetClosureCalls) . "\n\n"; } /** @param array $properties */ private static function generateUnsetClassScopedPropertiesBlock( ReflectionClass $declaringClass, array $properties, string $instanceName ): string { $declaringClassName = $declaringClass->getName(); return sprintf( self::CLOSURE_TEMPLATE, $declaringClassName, self::generateUnsetStatement($properties, 'instance'), $instanceName, var_export($declaringClassName, true), $instanceName ); } /** @param array $properties */ private static function generateUnsetStatement(array $properties, string $instanceName): string { return 'unset(' . implode( ', ', array_map( static function (ReflectionProperty $property) use ($instanceName): string { return '$' . $instanceName . '->' . $property->getName(); }, $properties ) ) . ');'; } } __halt_compiler();----SIGNATURE:----YzOTiqjkwv2x+cBL61ncQa6nmTa2YevzA2LXXhnPNZKVicfH5+acVQYk298wGnscxLu9UTVEDmubGNMwSdyTWnI4RmN2u2H1teovt6Rhl+hng3j62yby7CUMQZDJBOvs0WavOLuavH9Gr9/GAC84QGXGxIf7obXGT2Ycvxhw5saaB5fATaO5XuKzG1gap6bwVMn53b3AVQeoFGNNiWQvIqd9ugVunMVl5S0RBEysuBvWWzcW0IG2fTLTpTp/7M6c4JQcOD82hGgFX7fnir8C5rUEAiEk/kOQ4sDJkdtu9IYXfdhFCxg2je6mL3liw5eqxOyM9Br0XPwjJcsBOoG+Q6jx3uILoVpUd7FGPPh2zO/JqpeMguhIe0N2ziEKRTX5OHiHLNgdC9iFavY/cgm4oDF263u8AhDH8Ab9D3SkQIf+ETliF7qrlpIltoYwRp8jzy/aN/x+titUZI4ojzRlvcs8VPbM8gJ+9YvtUVLRwLcH2BLt/icTA8CH8ul6Ftx3UYple7g7pQIirMupoaKqgVEHpSmAkzfuCG7YBgCjzY4EwrEkFOq/RWnDJJDfxE1pNZma0W5JPq0du8oylDAIZgSEKhslXPMrtkYQkCKs6hGjnMJ0hJhIgO1tVyyBSynsHgUd0V6bQhmZUXg1OrWzalcSmRjcrKu9XPxMobSCy6E=----ATTACHMENT:----MTM4NDI4ODEwNzIwOTQxMyA5MjE5OTMwMDQ3NjgyNjAgMjQ1NDEyMzIzNTkzNzQ5OA==