|
| 1 | +<?php |
| 2 | + |
| 3 | +function a() |
| 4 | +{ |
| 5 | + $promises = ( |
| 6 | + /** |
| 7 | + * @return \Generator |
| 8 | + * @return \Generator |
| 9 | + */ |
| 10 | + static function () use ($paginator): \Generator { |
| 11 | + yield $paginator->getCurrentPageResultsAsync(); |
| 12 | + |
| 13 | + while ($paginator->hasNextPage()) { |
| 14 | + $paginator->nextPage(); |
| 15 | + |
| 16 | + yield $paginator->getCurrentPageResultsAsync(); |
| 17 | + } |
| 18 | + } |
| 19 | + )(); |
| 20 | +} |
| 21 | + |
| 22 | +function b() |
| 23 | +{ |
| 24 | + Psl\invariant( |
| 25 | + null |
| 26 | + === Iter\search( |
| 27 | + Vec\concat(...Vec\map($this->section->getRows(), static fn(ProductRow $row): array => $row->getFields())), |
| 28 | + static fn(ProductField $existing): bool => $existing->getName() === $field->getName(), |
| 29 | + ), |
| 30 | + 'Field names need to be unique per section.', |
| 31 | + ); |
| 32 | +} |
| 33 | + |
| 34 | +function c() |
| 35 | +{ |
| 36 | + [ |
| 37 | + 'claim_coverage_descriptions' => |
| 38 | + $claimCoverageDescriptions = Vec\map( |
| 39 | + $filter->claimCoverageDescriptions, |
| 40 | + static fn(ClaimCoverageDescription $claimCoverageDescription): string => $claimCoverageDescription->value, |
| 41 | + ), |
| 42 | + ]; |
| 43 | +} |
| 44 | + |
| 45 | +function d() |
| 46 | +{ |
| 47 | + return ( |
| 48 | + Iter\search( |
| 49 | + $infos, |
| 50 | + static fn(ProductCommercialPropertyInfo $existing): bool => ( |
| 51 | + $existing->getSubLocation()->getLocation()->getUuid()->equals($location->getUuid()) |
| 52 | + && $existing->getSubLocation()->getNumber() === $subLocationNumber |
| 53 | + ), |
| 54 | + ) |
| 55 | + ?? Iter\search( |
| 56 | + $infos, |
| 57 | + static fn(ProductCommercialPropertyInfo $existing): bool => ( |
| 58 | + $existing->getSubLocation()->getLocation()->getNumber() === $location->getNumber() |
| 59 | + && $existing->getSubLocation()->getNumber() === $subLocationNumber |
| 60 | + ), |
| 61 | + ) ?? null |
| 62 | + ); |
| 63 | +} |
| 64 | + |
| 65 | +function e() |
| 66 | +{ |
| 67 | + foreach ($target->getQuoteTemplateDefaults()->getFormSpecifications() as $formSpecification) { |
| 68 | + if ( |
| 69 | + null |
| 70 | + === Iter\search( |
| 71 | + $selectedFormSpecifications, |
| 72 | + static fn(FormSpecificationDTO $possible): bool => $formSpecification->getDocumentTemplateConfiguration() === $possible->documentTemplateConfiguration, |
| 73 | + ) |
| 74 | + ) { |
| 75 | + $target->getQuoteTemplateDefaults()->removeFormSpecification($formSpecification); |
| 76 | + } |
| 77 | + } |
| 78 | +} |
| 79 | + |
| 80 | +function getProductCount($division): int |
| 81 | +{ |
| 82 | + return 1; |
| 83 | +} |
| 84 | + |
| 85 | +function getFormsStep(Division $division): int |
| 86 | +{ |
| 87 | + return ( |
| 88 | + 3 + // foo |
| 89 | + (+\count([1, 2, 3])) |
| 90 | + + 1 // bar |
| 91 | + + 1 // baz |
| 92 | + + getProductCount($division) |
| 93 | + + 1 // bay |
| 94 | + ); |
| 95 | +} |
| 96 | + |
| 97 | +function f() |
| 98 | +{ |
| 99 | + if (true) { |
| 100 | + $a = !$subject->dto->inBusinessGreaterThanThreeYears |
| 101 | + ? Eligibility::create( |
| 102 | + EligibilityStatus::REFER, |
| 103 | + [ |
| 104 | + 'Builders in the construction business for less than 3 years require an underwriter to review. A resume showing related construction experience will be required.', |
| 105 | + ], |
| 106 | + ) : $currentEligibility; |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | +function g() |
| 111 | +{ |
| 112 | + $coverageCodes = isset($options['coverage']) |
| 113 | + ? [$options['coverage']] |
| 114 | + /** @phpstan-ignore offsetAccess.notFound */ |
| 115 | + : Type\vec(Type\instance_of(CoverageCode::class))->assert($options['coverage_codes']); |
| 116 | +} |
| 117 | + |
| 118 | +function h() |
| 119 | +{ |
| 120 | + if (true) { |
| 121 | + Vec\sort_by( |
| 122 | + Vec\concat( |
| 123 | + ($this->dataPointContextResolver)( |
| 124 | + [$context], |
| 125 | + $dataPointReplacements, |
| 126 | + static fn(TemplateReplacementInterface $templateReplacement) => Type\instance_of(DataPointDataSource::class) |
| 127 | + ->assert($templateReplacement->getDataSource())->value, |
| 128 | + ), |
| 129 | + $this->getProductReplacementsFor($context), |
| 130 | + ), |
| 131 | + static fn(TemplateReplacementInterface $replacement): string => $replacement->getType()->getReadable(), |
| 132 | + ); |
| 133 | + } |
| 134 | +} |
0 commit comments