$method->getName(), array_filter( (new ReflectionClass(CloudPublicNetworkAddressPolicy::class)) ->getMethods(ReflectionMethod::IS_PUBLIC), static fn (ReflectionMethod $method): bool => $method->getDeclaringClass()->getName() === CloudPublicNetworkAddressPolicy::class ) )); sort($methods, SORT_STRING); if ($methods !== [ 'addressSelectable', 'assertIdentity', 'assertSelectable', 'contract', ]) { throw new RuntimeException('Address policy public seam drifted.'); } foreach ([ 'DB::', 'lockForUpdate(', '::find(', '->save(', '->update(', '->insert(', '->delete(', ] as $forbidden) { if (str_contains($policy, $forbidden)) { throw new RuntimeException( 'Pure address policy performs persistence: ' . $forbidden ); } } if (!str_contains($allocator, 'CloudPublicNetworkAddressPolicy::') || !str_contains($transition, 'CloudPublicNetworkAddressPolicy::') || str_contains($allocator, 'rawAddressAllowedByPool') || str_contains($allocator, 'rawAddressBelongsToPool') || !str_contains($allocator, "'contracts' => \$contracts") || !str_contains($allocator, "'contracts' => \$selectedContracts")) { throw new RuntimeException( 'Allocation and transition do not share the pure address policy.' ); } echo "Public-network shared address-policy contracts passed.\n";