Skip to content

Commit 0fc7d6b

Browse files
author
Enno Woortmann
committed
Remove invalid characters from namespaces
1 parent 8bbfba3 commit 0fc7d6b

File tree

4 files changed

+3
-3
lines changed

4 files changed

+3
-3
lines changed

src/SchemaProcessor/SchemaProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ protected function setCurrentClassPath(string $jsonSchemaFile): void
313313
{
314314
$path = str_replace($this->baseSource, '', dirname($jsonSchemaFile));
315315
$pieces = array_map(
316-
static fn(string $directory): string => ucfirst($directory),
316+
static fn(string $directory): string => ucfirst(preg_replace('/\W/', '', $directory)),
317317
explode(DIRECTORY_SEPARATOR, $path),
318318
);
319319

tests/Basic/IdenticalNestedSchemaTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ public function testIdenticalSchemasInDifferentNamespaceAreMappedToOneClass(): v
120120
->setOutputEnabled(false),
121121
);
122122

123-
$subClass1FQCN = '\\IdenticalSubSchemaDifferentNamespace\\DifferentNamespaceSubFolder1\\SubSchema';
123+
$subClass1FQCN = '\\IdenticalSubSchemaDifferentNamespace\\DifferentNamespaceSubFolder10\\SubSchema';
124124
$subObject1 = new $subClass1FQCN(['object1' => ['property1' => 'Hello']]);
125125
$this->assertSame('Hello', $subObject1->getObject1()->getProperty1());
126126

127-
$subClass2FQCN = '\\IdenticalSubSchemaDifferentNamespace\\DifferentNamespaceSubFolder2\\SubSchema';
127+
$subClass2FQCN = '\\IdenticalSubSchemaDifferentNamespace\\DifferentNamespaceSubFolder20\\SubSchema';
128128
$subObject2 = new $subClass2FQCN(['object1' => ['property1' => 'Goodbye']]);
129129
$this->assertSame('Goodbye', $subObject2->getObject1()->getProperty1());
130130

0 commit comments

Comments
 (0)