JsonParsedDataStorage
class JsonParsedDataStorage implements ParsedDataPersistentStorageProvider (View source)
JSON storage for parsed entities.
Handles file I/O operations while delegating serialization to a pluggable serializer. Optionally coordinates with PhpDocStorage for separated PhpDoc storage.
Methods
No description
No description
No description
No description
Save entities to persistent storage
Load entities from the cache file.
Details
__construct(string $pathToJsonFile, EntitySerializerInterface $serializer, bool $loadExisting = true, PhpDocStorage|null $phpDocStorage = null, bool $ownsPhpDocStorage = true)
No description
array
getEntities()
No description
void
addEntity(mixed $entity)
No description
void
clearEntities()
No description
void
save()
Save entities to persistent storage
void
load()
Load entities from the cache file.
A missing file yields no entities and is not an error: callers decide whether to
regenerate (see Runner::isStubsCacheComplete()), and MultiFileJsonStorage constructs a
storage per entity type whether or not every file has been written yet.
A file that exists but cannot be read as JSON is a different matter and throws. Returning
no entities there is indistinguishable from a legitimately empty cache, and the
consequences are silent: a truncated StubsClasses.json yielded zero classes while the
other four type files loaded normally, so every class-level check iterated an empty list
and reported success. The suite stayed green while validating nothing. This happened —
commit 51b2a776 carried a 2.3 MB prefix of a 20.4 MB file.