Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update generators to follow php-cs-fixer formatting rules

+7 -5
+2 -2
src/Generator/ClassGenerator.php
··· 184 184 $docLines[] = ' */'; 185 185 $docBlock = implode("\n", $docLines); 186 186 187 - return "\n".$docBlock."\n public function __construct(\n".implode("\n", $params)."\n ) {}"; 187 + return "\n ".$docBlock."\n public function __construct(\n".implode("\n", $params)."\n ) {\n }"; 188 188 } 189 189 190 190 /** ··· 253 253 } 254 254 255 255 // Add local ref imports from nested namespace 256 - if (!empty($localRefs) && $currentNamespace && $currentClassName) { 256 + if (! empty($localRefs) && $currentNamespace && $currentClassName) { 257 257 foreach ($localRefs as $localRef) { 258 258 $refClassName = $this->naming->toClassName($localRef); 259 259 $uses[] = $currentNamespace . '\\' . $currentClassName . '\\' . $refClassName;
+2 -3
src/Generator/EnumGenerator.php
··· 2 2 3 3 namespace SocialDept\Schema\Generator; 4 4 5 - use SocialDept\Schema\Data\LexiconDocument; 6 - 7 5 class EnumGenerator 8 6 { 9 7 /** ··· 52 50 { 53 51 $type = $definition['type'] ?? null; 54 52 55 - if ($type !== 'string' || !isset($definition['knownValues'])) { 53 + if ($type !== 'string' || ! isset($definition['knownValues'])) { 56 54 throw new \InvalidArgumentException("Definition must be a string type with knownValues"); 57 55 } 58 56 ··· 80 78 { 81 79 if (str_contains($nsid, '#')) { 82 80 [$baseNsid, $defName] = explode('#', $nsid, 2); 81 + 83 82 return [$baseNsid, $defName]; 84 83 } 85 84
+3
src/Generator/TypeMapper.php
··· 209 209 // Convert fragment to class name 210 210 if (str_contains($ref, '#')) { 211 211 [$baseNsid, $fragment] = explode('#', $ref, 2); 212 + 212 213 return $this->naming->toClassName($fragment); 213 214 } 214 215 ··· 304 305 if (str_contains($ref, '#')) { 305 306 [$baseNsid, $fragment] = explode('#', $ref, 2); 306 307 $types[] = $this->naming->toClassName($fragment); 308 + 307 309 continue; 308 310 } 309 311 ··· 421 423 [$baseNsid, $fragment] = explode('#', $ref, 2); 422 424 $namespace = $this->naming->nsidToNamespace($baseNsid); 423 425 $className = $this->naming->toClassName($fragment); 426 + 424 427 return [$namespace . '\\' . $className]; 425 428 } 426 429