Skip to content

Commit 4669fc0

Browse files
committed
Remove defunct __set and __get methods on AbstractAnnotation
1 parent 10887c1 commit 4669fc0

3 files changed

Lines changed: 4 additions & 24 deletions

File tree

rector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
34
use Rector\CodeQuality\Rector\For_\ForRepeatedCountToOwnVariableRector;
45
use Rector\CodeQuality\Rector\If_\CombineIfRector;
56
use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
@@ -37,6 +38,9 @@
3738
__DIR__ . '/src/Serializer.php',
3839
],
3940
ClassPropertyAssignToConstructorPromotionRector::class,
41+
CompleteDynamicPropertiesRector::class => [
42+
__DIR__ . '/src/Annotations/AbstractAnnotation.php',
43+
],
4044
])
4145
->withPreparedSets(
4246
deadCode: true,

src/Annotations/AbstractAnnotation.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,6 @@ public function __construct(array $properties)
151151
}
152152
}
153153

154-
public function __get(string $property)
155-
{
156-
$properties = get_object_vars($this);
157-
$this->_context->logger->warning('Property "' . $property . '" doesn\'t exist in a ' . $this->identity() . ', existing properties: "' . implode('", "', array_keys($properties)) . '" in ' . $this->_context);
158-
}
159-
160-
public function __set(string $property, mixed $value)
161-
{
162-
$fields = get_object_vars($this);
163-
foreach (static::$_blacklist as $_property) {
164-
unset($fields[$_property]);
165-
}
166-
$this->_context->logger->warning('Ignoring unexpected property "' . $property . '" for ' . $this->identity() . ', expecting "' . implode('", "', array_keys($fields)) . '" in ' . $this->_context);
167-
}
168-
169154
/**
170155
* Merge given annotations to their mapped properties configured in static::$_nested.
171156
*

tests/Annotations/AbstractAnnotationTest.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ public function testVendorFields(): void
2020
$this->assertSame(123, $output->$prefixedProperty);
2121
}
2222

23-
/**
24-
* @requires PHP < 8.2
25-
*/
26-
public function testInvalidField(): void
27-
{
28-
$this->assertOpenApiLogEntryContains('Ignoring unexpected property "doesnot" for @OA\Get(), expecting');
29-
$this->annotationsFromDocBlockParser('@OA\Get(doesnot="exist")');
30-
}
31-
3223
public function testUmergedAnnotation(): void
3324
{
3425
$openapi = $this->createOpenApiWithInfo();

0 commit comments

Comments
 (0)