mapsForm example


    public function __construct(ViolationPath $violationPath)
    {
        parent::__construct($violationPath);
    }

    /** * @return bool */
    public function mapsForm()
    {
        return $this->path->mapsForm($this->key());
    }
}
            // than the root element, map it to the innermost directly             // mapped form of the violation path             // e.g. "children[foo].children[bar].data.baz"             // Here the innermost directly mapped child is "bar"
            $scope = $form;
            $it = new ViolationPathIterator($violationPath);

            // Note: acceptsErrors() will always return true for forms inheriting             // their parent data, because these forms can never be non-synchronized             // (they don't do any data transformation on their own)             while ($this->acceptsErrors($scope) && $it->valid() && $it->mapsForm()) {
                if (!$scope->has($it->current())) {
                    // Break if we find a reference to a non-existing child                     break;
                }

                $scope = $scope->get($it->current());
                $it->next();
            }
        }

        // Follow dot rules until we have the final target

        $slicedPath ??= $string;

        $path = new ViolationPath($string);

        $this->assertSame($slicedPath$path->__toString());
        $this->assertCount(\count($entries)$path->getElements());
        $this->assertSame(\count($entries)$path->getLength());

        foreach ($entries as $index => $entry) {
            $this->assertEquals($entry[0]$path->getElement($index));
            $this->assertSame($entry[1]$path->mapsForm($index));
            $this->assertSame($entry[2]$path->isIndex($index));
            $this->assertSame(!$entry[2]$path->isProperty($index));
        }
    }

    public static function provideParents()
    {
        return [
            ['children[address]', null],
            ['children[address].children[street]', 'children[address]'],
            ['children[address].data.street', 'children[address]'],
            [
Home | Imprint | This part of the site doesn't use cookies.