*/ private $readOnlyPropertyNames = []; /** * Constructor * * @throws InvalidArgumentException */ public function __construct(Properties $properties) { parent::__construct( IdentifierSuffixer::getIdentifier('privateProperties') ); $this->setVisibility(self::VISIBILITY_PRIVATE); $this->setStatic(true); $this->setDocBlock( '@var array[][] visibility and default value of defined properties, indexed by property name and class name' ); $this->setDefaultValue($this->getMap($properties)); } /** * @return list */ public function getReadOnlyPropertyNames(): array { return $this->readOnlyPropertyNames; } /** * @return array> */ private function getMap(Properties $properties): array { $map = []; foreach ($properties->getInstanceProperties() as $property) { if (\PHP_VERSION_ID >= 80100 && $property->isReadOnly()) { $this->readOnlyPropertyNames[] = $property->getName(); } elseif (! $property->isPrivate()) { continue; } $map[$property->getName()][$property->getDeclaringClass()->getName()] = true; } return $map; } }