Skip to content

[PropertyInfo] @Internal directive on class prevents custom read/write extractor implementation #58988

Closed
@Guarrakesh

Description

@Guarrakesh

Symfony IsVersions(s) Affected

All

Description

I'm trying to use a custom Read/Write Info Extractor within the PropertyAccessor.

// CustomReadExtractor.php
class CustomReadExtractor implements PropertyReadInfoExtractorInterface {
        public function getReadInfo(string $class, string $property, array $context = []): ?PropertyReadInfo;
        {
               //custom logic
        }
}

// example usage
$extractor = new CustomReadExtractor();
(new PropertyAccessorBuilder)->setReadInfoExtractor($extractor);

Howevery, the class PropertyReadInfo is marked as @internal in it's docblock, causing the IDE and PHPStan to complain about usage of internal members.

I assume that creating a custom extractor is something that should be supported, as the documentation states [...] While you can create your own extractors, the following are already available to cover most use-cases

The same problem is with PropertyWriteInfo while implementing a custom class for PropertyWriteExtractorInterface.

Is it a wanted limitation or something we can fix?

Example

The new PropertyReadInfo and PropertyWriteInfo should not be marked as @internal

Before:

/**
 * The property read info tells how a property can be read.
 *
 * @author Joel Wurtz <jwurtz@jolicode.com>
 *
 * @internal
 */
final class PropertyReadInfo
{
}

After

/**
 * The property read info tells how a property can be read.
 *
 * @author Joel Wurtz <jwurtz@jolicode.com>
 *
 */
final class PropertyReadInfo
{

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions