|
5 | 5 | use JsonSerializable; |
6 | 6 | use Override; |
7 | 7 | use PHPStan\Dependency\ExportedNode; |
| 8 | +use PHPStan\Dependency\ExportedNodeDecoder; |
8 | 9 | use PHPStan\Dependency\RootExportedNode; |
9 | 10 | use PHPStan\ShouldNotHappenException; |
10 | 11 | use ReturnTypeWillChange; |
@@ -141,32 +142,32 @@ public function jsonSerialize() |
141 | 142 | /** |
142 | 143 | * @param mixed[] $data |
143 | 144 | */ |
144 | | - public static function decode(array $data): self |
| 145 | + public static function decode(array $data, ExportedNodeDecoder $decoder): self |
145 | 146 | { |
146 | 147 | return new self( |
147 | 148 | $data['name'], |
148 | | - $data['phpDoc'] !== null ? ExportedPhpDocNode::decode($data['phpDoc']['data']) : null, |
| 149 | + $data['phpDoc'] !== null ? ExportedPhpDocNode::decode($data['phpDoc']['data'], $decoder) : null, |
149 | 150 | $data['abstract'], |
150 | 151 | $data['final'], |
151 | 152 | $data['extends'], |
152 | 153 | $data['implements'], |
153 | 154 | $data['usedTraits'], |
154 | | - array_map(static function (array $traitUseAdaptationData): ExportedTraitUseAdaptation { |
| 155 | + array_map(static function (array $traitUseAdaptationData) use ($decoder): ExportedTraitUseAdaptation { |
155 | 156 | if ($traitUseAdaptationData['type'] !== ExportedTraitUseAdaptation::class) { |
156 | 157 | throw new ShouldNotHappenException(); |
157 | 158 | } |
158 | | - return ExportedTraitUseAdaptation::decode($traitUseAdaptationData['data']); |
| 159 | + return ExportedTraitUseAdaptation::decode($traitUseAdaptationData['data'], $decoder); |
159 | 160 | }, $data['traitUseAdaptations']), |
160 | | - array_map(static function (array $node): ExportedNode { |
| 161 | + array_map(static function (array $node) use ($decoder): ExportedNode { |
161 | 162 | $nodeType = $node['type']; |
162 | 163 |
|
163 | | - return $nodeType::decode($node['data']); |
| 164 | + return $nodeType::decode($node['data'], $decoder); |
164 | 165 | }, $data['statements']), |
165 | | - array_map(static function (array $attributeData): ExportedAttributeNode { |
| 166 | + array_map(static function (array $attributeData) use ($decoder): ExportedAttributeNode { |
166 | 167 | if ($attributeData['type'] !== ExportedAttributeNode::class) { |
167 | 168 | throw new ShouldNotHappenException(); |
168 | 169 | } |
169 | | - return ExportedAttributeNode::decode($attributeData['data']); |
| 170 | + return ExportedAttributeNode::decode($attributeData['data'], $decoder); |
170 | 171 | }, $data['attributes']), |
171 | 172 | ); |
172 | 173 | } |
|
0 commit comments