Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bcb79a3

Browse filesBrowse files
author
Amrouche Hamza
committed
[Validator] add missing parent isset and add test
1 parent 8e8ee09 commit bcb79a3
Copy full SHA for bcb79a3

File tree

2 files changed

+20
-0
lines changed
Filter options

2 files changed

+20
-0
lines changed

‎src/Symfony/Component/Validator/Constraint.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraint.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ public function __get($option)
214214
throw new InvalidOptionsException(sprintf('The option "%s" does not exist in constraint %s', $option, get_class($this)), array($option));
215215
}
216216

217+
/**
218+
* @param string $option The option name
219+
*
220+
* @return bool
221+
*/
222+
public function __isset($option)
223+
{
224+
return 'groups' === $option;
225+
}
226+
217227
/**
218228
* Adds the given group if this constraint is in the Default group.
219229
*

‎src/Symfony/Component/Validator/Tests/Constraints/FileTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/FileTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ public function testMaxSize($maxSize, $bytes, $binaryFormat)
2626

2727
$this->assertSame($bytes, $file->maxSize);
2828
$this->assertSame($binaryFormat, $file->binaryFormat);
29+
$this->assertTrue($file->__isset('maxSize'));
30+
}
31+
32+
public function testMagicIsset()
33+
{
34+
$file = new File(array('maxSize' => 1));
35+
36+
$this->assertTrue($file->__isset('maxSize'));
37+
$this->assertTrue($file->__isset('groups'));
38+
$this->assertFalse($file->__isset('toto'));
2939
}
3040

3141
/**

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.