Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function getReadInfo(string $class, string $property, array $context = []
foreach ($this->accessorPrefixes as $prefix) {
$methodName = $prefix.$camelProp;

if ($reflClass->hasMethod($methodName) && ($reflClass->getMethod($methodName)->getModifiers() & $this->methodReflectionFlags)) {
if ($reflClass->hasMethod($methodName) && $reflClass->getMethod($methodName)->getModifiers() & $this->methodReflectionFlags && !$reflClass->getMethod($methodName)->getNumberOfRequiredParameters()) {
$method = $reflClass->getMethod($methodName);

return new PropertyReadInfo(PropertyReadInfo::TYPE_METHOD, $methodName, $this->getReadVisiblityForMethod($method), $method->isStatic(), false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function testGetProperties()
'xTotals',
'YT',
'date',
'element',
'c',
'd',
'e',
Expand Down Expand Up @@ -291,6 +292,7 @@ public function getReadableProperties()
['id', true],
['Guid', true],
['guid', false],
['element', false],
];
}

Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/PropertyInfo/Tests/Fixtures/Dummy.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ class Dummy extends ParentDummy
*/
public $nestedIterators;

private $elements;

public static function getStatic()
{
}
Expand Down Expand Up @@ -218,4 +220,8 @@ public function setDate(\DateTime $date)
public function addDate(\DateTime $date)
{
}

public function hasElement(string $element): bool
{
}
}