8000 Add convenient interface for read and write accessors · symfony/symfony@95c8905 · GitHub
[go: up one dir, main page]

Skip to content

Commit 95c8905

Browse files
committed
Add convenient interface for read and write accessors
1 parent 849250a commit 95c8905

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\PropertyInfo;
13+
14+
/**
15+
* Extracts read accessor and write mutator for property of a class.
16+
*
17+
* @author Joel Wurtz <jwurtz@jolicode.com>
18+
*/
19+
interface AccessorExtractorInterface extends ReadAccessorExtractorInterface, WriteMutatorExtractorInterface
20+
{
21+
}

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@
1212
namespace Symfony\Component\PropertyInfo\Extractor;
1313

1414
use Symfony\Component\Inflector\Inflector;
15+
use Symfony\Component\PropertyInfo\AccessorExtractorInterface;
1516
use Symfony\Component\PropertyInfo\PropertyAccessExtractorInterface;
1617
use Symfony\Component\PropertyInfo\PropertyInitializableExtractorInterface;
1718
use Symfony\Component\PropertyInfo\PropertyListExtractorInterface;
1819
use Symfony\Component\PropertyInfo\PropertyTypeExtractorInterface;
1920
use Symfony\Component\PropertyInfo\ReadAccessor;
20-
use Symfony\Component\PropertyInfo\ReadAccessorExtractorInterface;
2121
use Symfony\Component\PropertyInfo\Type;
2222
use Symfony\Component\PropertyInfo\WriteMutator;
23-
use Symfony\Component\PropertyInfo\WriteMutatorExtractorInterface;
2423

2524
/**
2625
* Extracts data using the reflection API.
@@ -29,7 +28,7 @@
2928
*
3029
* @final
3130
*/
32-
class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface, ReadAccessorExtractorInterface, WriteMutatorExtractorInterface
31+
class ReflectionExtractor implements PropertyListExtractorInterface, PropertyTypeExtractorInterface, PropertyAccessExtractorInterface, PropertyInitializableExtractorInterface, AccessorExtractorInterface
3332
{
3433
/**
3534
* @internal

src/Symfony/Component/PropertyInfo/Tests/Extractor/ReflectionExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function readAccessorProvider(): array
383383
public function testGetWriteMutator($class, $property, $allowConstruct, $found, $type, $name, $addName, $removeName, $private, $static, $hasParameter)
384384
{
385385
$writeMutator = $this->extractor->getWriteMutator($class, $property, [
386-
'enable_constructor_extraction' => $allowConstruct
386+
'enable_constructor_extraction' => $allowConstruct,
387387
]);
388388

389389
if (!$found) {

0 commit comments

Comments
 (0)
0