<?php

namespace Symfony\Component\PropertyAccess;

interface PropertyAccessorInterface
{
    /**
     * @template T as object|array
     * @psalm-param T $objectOrArray
     * @psalm-param string|PropertyPathInterface $propertyPath
     * @psalm-param mixed $value
     * @psalm-param-out T $objectOrArray
     */
    public function setValue(object|array &$objectOrArray, string|PropertyPathInterface $propertyPath, mixed $value);

    /**
     * @param object|array $objectOrArray
     * @param string|PropertyPathInterface $propertyPath
     *
     * @return mixed
     */
    public function getValue(object|array $objectOrArray, string|PropertyPathInterface $propertyPath): mixed;

    /**
     * @param object|array $objectOrArray
     * @param string|PropertyPathInterface $propertyPath
     *
     * @return bool
     */
    public function isWritable(object|array $objectOrArray, string|PropertyPathInterface $propertyPath): bool;

    /**
     * @param object|array $objectOrArray
     * @param string|PropertyPathInterface $propertyPath
     *
     * @return bool
     */
    public function isReadable(object|array $objectOrArray, string|PropertyPathInterface $propertyPath): bool;
}
