--- vendor/symfony/polyfill-mbstring/bootstrap.php +++ PHP_CodeSniffer @@ -16,36 +16,132 @@ define('MB_CASE_LOWER', 1); define('MB_CASE_TITLE', 2); - function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); } - function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); } - function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); } - function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); } - function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); } - function mb_language($lang = null) { return p\Mbstring::mb_language($lang); } - function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); } - function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); } - function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); } - function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); } - function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); } - function mb_parse_str($s, &$result = array()) { parse_str($s, $result); } - function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); } - function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); } - function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); } - function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); } - function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); } - function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); } - function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); } - function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); } - function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); } - function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); } - function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); } - function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); } - function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); } - function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); } - function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); } - function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); } - function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); } - function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); } - function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); } - function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $v0, $a, $b, $c, $d, $e, $f); } + function mb_convert_encoding($s, $to, $from = null) + { + return p\Mbstring::mb_convert_encoding($s, $to, $from); + } + function mb_decode_mimeheader($s) + { + return p\Mbstring::mb_decode_mimeheader($s); + } + function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) + { + return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); + } + function mb_convert_case($s, $mode, $enc = null) + { + return p\Mbstring::mb_convert_case($s, $mode, $enc); + } + function mb_internal_encoding($enc = null) + { + return p\Mbstring::mb_internal_encoding($enc); + } + function mb_language($lang = null) + { + return p\Mbstring::mb_language($lang); + } + function mb_list_encodings() + { + return p\Mbstring::mb_list_encodings(); + } + function mb_encoding_aliases($encoding) + { + return p\Mbstring::mb_encoding_aliases($encoding); + } + function mb_check_encoding($var = null, $encoding = null) + { + return p\Mbstring::mb_check_encoding($var, $encoding); + } + function mb_detect_encoding($str, $encodingList = null, $strict = false) + { + return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); + } + function mb_detect_order($encodingList = null) + { + return p\Mbstring::mb_detect_order($encodingList); + } + function mb_parse_str($s, &$result = array()) + { + parse_str($s, $result); + } + function mb_strlen($s, $enc = null) + { + return p\Mbstring::mb_strlen($s, $enc); + } + function mb_strpos($s, $needle, $offset = 0, $enc = null) + { + return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); + } + function mb_strtolower($s, $enc = null) + { + return p\Mbstring::mb_strtolower($s, $enc); + } + function mb_strtoupper($s, $enc = null) + { + return p\Mbstring::mb_strtoupper($s, $enc); + } + function mb_substitute_character($char = null) + { + return p\Mbstring::mb_substitute_character($char); + } + function mb_substr($s, $start, $length = 2147483647, $enc = null) + { + return p\Mbstring::mb_substr($s, $start, $length, $enc); + } + function mb_stripos($s, $needle, $offset = 0, $enc = null) + { + return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); + } + function mb_stristr($s, $needle, $part = false, $enc = null) + { + return p\Mbstring::mb_stristr($s, $needle, $part, $enc); + } + function mb_strrchr($s, $needle, $part = false, $enc = null) + { + return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); + } + function mb_strrichr($s, $needle, $part = false, $enc = null) + { + return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); + } + function mb_strripos($s, $needle, $offset = 0, $enc = null) + { + return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); + } + function mb_strrpos($s, $needle, $offset = 0, $enc = null) + { + return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); + } + function mb_strstr($s, $needle, $part = false, $enc = null) + { + return p\Mbstring::mb_strstr($s, $needle, $part, $enc); + } + function mb_get_info($type = 'all') + { + return p\Mbstring::mb_get_info($type); + } + function mb_http_output($enc = null) + { + return p\Mbstring::mb_http_output($enc); + } + function mb_strwidth($s, $enc = null) + { + return p\Mbstring::mb_strwidth($s, $enc); + } + function mb_substr_count($haystack, $needle, $enc = null) + { + return p\Mbstring::mb_substr_count($haystack, $needle, $enc); + } + function mb_output_handler($contents, $status) + { + return p\Mbstring::mb_output_handler($contents, $status); + } + function mb_http_input($type = '') + { + return p\Mbstring::mb_http_input($type); + } + function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) + { + return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $v0, $a, $b, $c, $d, $e, $f); + } } --- vendor/symfony/polyfill-mbstring/Mbstring.php +++ PHP_CodeSniffer @@ -115,11 +115,13 @@ $vars = array(&$a, &$b, &$c, &$d, &$e, &$f); $ok = true; - array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { - if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { - $ok = false; + array_walk_recursive( + $vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) { + if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) { + $ok = false; + } } - }); + ); return $ok ? $fromEncoding : false; } @@ -229,11 +231,11 @@ } switch ($lang = strtolower($lang)) { - case 'uni': - case 'neutral': - self::$language = $lang; + case 'uni': + case 'neutral': + self::$language = $lang; - return true; + return true; } return false; @@ -247,9 +249,9 @@ public static function mb_encoding_aliases($encoding) { switch (strtoupper($encoding)) { - case 'UTF8': - case 'UTF-8': - return array('utf8'); + case 'UTF8': + case 'UTF-8': + return array('utf8'); } return false; @@ -280,23 +282,23 @@ foreach ($encodingList as $enc) { switch ($enc) { - case 'ASCII': - if (!preg_match('/[\x80-\xFF]/', $str)) { - return $enc; - } - break; + case 'ASCII': + if (!preg_match('/[\x80-\xFF]/', $str)) { + return $enc; + } + break; - case 'UTF8': - case 'UTF-8': - if (preg_match('//u', $str)) { - return 'UTF-8'; - } - break; + case 'UTF8': + case 'UTF-8': + if (preg_match('//u', $str)) { + return 'UTF-8'; + } + break; - default: - if (0 === strncmp($enc, 'ISO-8859-', 9)) { - return $enc; - } + default: + if (0 === strncmp($enc, 'ISO-8859-', 9)) { + return $enc; + } } } @@ -316,13 +318,13 @@ foreach ($encodingList as $enc) { switch ($enc) { - default: - if (strncmp($enc, 'ISO-8859-', 9)) { - return false; - } - case 'ASCII': - case 'UTF8': - case 'UTF-8': + default: + if (strncmp($enc, 'ISO-8859-', 9)) { + return false; + } + case 'ASCII': + case 'UTF8': + case 'UTF-8': } } @@ -578,7 +580,7 @@ private static function getData($file) { if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) { - return require $file; + return include $file; } return false; --- vendor/symfony/translation/PluralizationRules.php +++ PHP_CodeSniffer @@ -55,135 +55,135 @@ * Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) */ switch ($locale) { - case 'az': - case 'bo': - case 'dz': - case 'id': - case 'ja': - case 'jv': - case 'ka': - case 'km': - case 'kn': - case 'ko': - case 'ms': - case 'th': - case 'tr': - case 'vi': - case 'zh': - return 0; + case 'az': + case 'bo': + case 'dz': + case 'id': + case 'ja': + case 'jv': + case 'ka': + case 'km': + case 'kn': + case 'ko': + case 'ms': + case 'th': + case 'tr': + case 'vi': + case 'zh': + return 0; break; - case 'af': - case 'bn': - case 'bg': - case 'ca': - case 'da': - case 'de': - case 'el': - case 'en': - case 'eo': - case 'es': - case 'et': - case 'eu': - case 'fa': - case 'fi': - case 'fo': - case 'fur': - case 'fy': - case 'gl': - case 'gu': - case 'ha': - case 'he': - case 'hu': - case 'is': - case 'it': - case 'ku': - case 'lb': - case 'ml': - case 'mn': - case 'mr': - case 'nah': - case 'nb': - case 'ne': - case 'nl': - case 'nn': - case 'no': - case 'om': - case 'or': - case 'pa': - case 'pap': - case 'ps': - case 'pt': - case 'so': - case 'sq': - case 'sv': - case 'sw': - case 'ta': - case 'te': - case 'tk': - case 'ur': - case 'zu': - return ($number == 1) ? 0 : 1; - - case 'am': - case 'bh': - case 'fil': - case 'fr': - case 'gun': - case 'hi': - case 'hy': - case 'ln': - case 'mg': - case 'nso': - case 'xbr': - case 'ti': - case 'wa': - return (($number == 0) || ($number == 1)) ? 0 : 1; - - case 'be': - case 'bs': - case 'hr': - case 'ru': - case 'sr': - case 'uk': - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'cs': - case 'sk': - return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); - - case 'ga': - return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); - - case 'lt': - return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); - - case 'sl': - return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); - - case 'mk': - return ($number % 10 == 1) ? 0 : 1; - - case 'mt': - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); - - case 'lv': - return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); - - case 'pl': - return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); - - case 'cy': - return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); + case 'af': + case 'bn': + case 'bg': + case 'ca': + case 'da': + case 'de': + case 'el': + case 'en': + case 'eo': + case 'es': + case 'et': + case 'eu': + case 'fa': + case 'fi': + case 'fo': + case 'fur': + case 'fy': + case 'gl': + case 'gu': + case 'ha': + case 'he': + case 'hu': + case 'is': + case 'it': + case 'ku': + case 'lb': + case 'ml': + case 'mn': + case 'mr': + case 'nah': + case 'nb': + case 'ne': + case 'nl': + case 'nn': + case 'no': + case 'om': + case 'or': + case 'pa': + case 'pap': + case 'ps': + case 'pt': + case 'so': + case 'sq': + case 'sv': + case 'sw': + case 'ta': + case 'te': + case 'tk': + case 'ur': + case 'zu': + return ($number == 1) ? 0 : 1; + + case 'am': + case 'bh': + case 'fil': + case 'fr': + case 'gun': + case 'hi': + case 'hy': + case 'ln': + case 'mg': + case 'nso': + case 'xbr': + case 'ti': + case 'wa': + return (($number == 0) || ($number == 1)) ? 0 : 1; + + case 'be': + case 'bs': + case 'hr': + case 'ru': + case 'sr': + case 'uk': + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + + case 'cs': + case 'sk': + return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2); + + case 'ga': + return ($number == 1) ? 0 : (($number == 2) ? 1 : 2); + + case 'lt': + return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); + + case 'sl': + return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3)); + + case 'mk': + return ($number % 10 == 1) ? 0 : 1; + + case 'mt': + return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 1) && ($number % 100 < 11))) ? 1 : ((($number % 100 > 10) && ($number % 100 < 20)) ? 2 : 3)); + + case 'lv': + return ($number == 0) ? 0 : ((($number % 10 == 1) && ($number % 100 != 11)) ? 1 : 2); + + case 'pl': + return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2); + + case 'cy': + return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3)); - case 'ro': - return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); + case 'ro': + return ($number == 1) ? 0 : ((($number == 0) || (($number % 100 > 0) && ($number % 100 < 20))) ? 1 : 2); - case 'ar': - return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); + case 'ar': + return ($number == 0) ? 0 : (($number == 1) ? 1 : (($number == 2) ? 2 : ((($number % 100 >= 3) && ($number % 100 <= 10)) ? 3 : ((($number % 100 >= 11) && ($number % 100 <= 99)) ? 4 : 5)))); - default: - return 0; + default: + return 0; } } --- vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ PHP_CodeSniffer @@ -46,8 +46,7 @@ $data .= pack('V', strlen($target)) .mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8') - .$this->writePadding($data) - ; + .$this->writePadding($data); } $resOffset = $this->getPosition($data); @@ -60,7 +59,8 @@ $bundleTop = $this->getPosition($data); - $root = pack('V7', + $root = pack( + 'V7', $resOffset + (2 << 28), // Resource Offset + Resource Type 6, // Index length $keyTop, // Index keys top @@ -70,7 +70,8 @@ 0 // Index attributes ); - $header = pack('vC2v4C12@32', + $header = pack( + 'vC2v4C12@32', 32, // Header size 0xDA, 0x27, // Magic number 1 and 2 20, 0, 0, 2, // Rest of the header, ..., Size of a char --- vendor/symfony/translation/Dumper/FileDumper.php +++ PHP_CodeSniffer @@ -114,10 +114,12 @@ */ private function getRelativePath($domain, $locale) { - return strtr($this->relativePathTemplate, array( + return strtr( + $this->relativePathTemplate, array( '%domain%' => $domain, '%locale%' => $locale, '%extension%' => $this->getExtension(), - )); + ) + ); } } --- vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php +++ PHP_CodeSniffer @@ -140,8 +140,7 @@ $translator = $this ->getMockBuilder('Symfony\Component\Translation\DataCollectorTranslator') ->disableOriginalConstructor() - ->getMock() - ; + ->getMock(); return $translator; } --- vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php +++ PHP_CodeSniffer @@ -19,8 +19,10 @@ public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en'); - $catalogue->add(array('foo' => 'bar', 'bar' => 'foo -foo', 'foo;foo' => 'bar')); + $catalogue->add( + array('foo' => 'bar', 'bar' => 'foo +foo', 'foo;foo' => 'bar') + ); $dumper = new CsvFileDumper(); --- vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php +++ PHP_CodeSniffer @@ -23,11 +23,12 @@ array( 'foo.bar1' => 'value1', 'foo.bar2' => 'value2', - )); + ) + ); - $dumper = new YamlFileDumper(); + $dumper = new YamlFileDumper(); - $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', array('as_tree' => true, 'inline' => 999))); + $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages.yml', $dumper->formatCatalogue($catalogue, 'messages', array('as_tree' => true, 'inline' => 999))); } public function testLinearFormatCatalogue() @@ -37,10 +38,11 @@ array( 'foo.bar1' => 'value1', 'foo.bar2' => 'value2', - )); + ) + ); - $dumper = new YamlFileDumper(); + $dumper = new YamlFileDumper(); - $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages_linear.yml', $dumper->formatCatalogue($catalogue, 'messages')); + $this->assertStringEqualsFile(__DIR__.'/../fixtures/messages_linear.yml', $dumper->formatCatalogue($catalogue, 'messages')); } } --- vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php +++ PHP_CodeSniffer @@ -19,11 +19,13 @@ public function testFormatCatalogue() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add( + array( 'foo' => 'bar', 'key' => '', 'key.with.cdata' => ' & ', - )); + ) + ); $catalogue->setMetadata('foo', array('notes' => array(array('priority' => 1, 'from' => 'bar', 'content' => 'baz')))); $catalogue->setMetadata('key', array('notes' => array(array('content' => 'baz'), array('content' => 'qux')))); @@ -38,11 +40,13 @@ public function testFormatCatalogueXliff2() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add( + array( 'foo' => 'bar', 'key' => '', 'key.with.cdata' => ' & ', - )); + ) + ); $catalogue->setMetadata('key', array('target-attributes' => array('order' => 1))); $dumper = new XliffFileDumper(); @@ -74,9 +78,11 @@ public function testFormatCatalogueWithTargetAttributesMetadata() { $catalogue = new MessageCatalogue('en_US'); - $catalogue->add(array( + $catalogue->add( + array( 'foo' => 'bar', - )); + ) + ); $catalogue->setMetadata('foo', array('target-attributes' => array('state' => 'needs-translation'))); $dumper = new XliffFileDumper(); --- vendor/symfony/translation/Tests/Catalogue/MergeOperationTest.php +++ PHP_CodeSniffer @@ -43,9 +43,11 @@ public function testGetResultFromSingleDomain() { $this->assertEquals( - new MessageCatalogue('en', array( + new MessageCatalogue( + 'en', array( 'messages' => array('a' => 'old_a', 'b' => 'old_b', 'c' => 'new_c'), - )), + ) + ), $this->createOperation( new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) --- vendor/symfony/translation/Tests/Catalogue/TargetOperationTest.php +++ PHP_CodeSniffer @@ -43,9 +43,11 @@ public function testGetResultFromSingleDomain() { $this->assertEquals( - new MessageCatalogue('en', array( + new MessageCatalogue( + 'en', array( 'messages' => array('a' => 'old_a', 'c' => 'new_c'), - )), + ) + ), $this->createOperation( new MessageCatalogue('en', array('messages' => array('a' => 'old_a', 'b' => 'old_b'))), new MessageCatalogue('en', array('messages' => array('a' => 'new_a', 'c' => 'new_c'))) --- vendor/symfony/translation/Tests/LoggingTranslatorTest.php +++ PHP_CodeSniffer @@ -22,8 +22,7 @@ $logger = $this->getMock('Psr\Log\LoggerInterface'); $logger->expects($this->exactly(2)) ->method('warning') - ->with('Translation not found.') - ; + ->with('Translation not found.'); $translator = new Translator('ar'); $loggableTranslator = new LoggingTranslator($translator, $logger); @@ -36,8 +35,7 @@ $logger = $this->getMock('Psr\Log\LoggerInterface'); $logger->expects($this->once()) ->method('debug') - ->with('Translation use fallback catalogue.') - ; + ->with('Translation use fallback catalogue.'); $translator = new Translator('ar'); $translator->setFallbackLocales(array('en')); --- vendor/symfony/translation/Tests/TranslatorCacheTest.php +++ PHP_CodeSniffer @@ -94,13 +94,14 @@ $catalogue = new MessageCatalogue($locale, array()); $catalogue->addResource(new StaleResource()); // better use a helper class than a mock, because it gets serialized in the cache and re-loaded - /** @var LoaderInterface|\PHPUnit_Framework_MockObject_MockObject $loader */ + /** + * @var LoaderInterface|\PHPUnit_Framework_MockObject_MockObject $loader +*/ $loader = $this->getMock('Symfony\Component\Translation\Loader\LoaderInterface'); $loader ->expects($this->exactly(2)) ->method('load') - ->will($this->returnValue($catalogue)) - ; + ->will($this->returnValue($catalogue)); // 1st pass $translator = new Translator($locale, null, $this->tmpDir, true); --- vendor/symfony/translation/Loader/PhpFileLoader.php +++ PHP_CodeSniffer @@ -23,6 +23,6 @@ */ protected function loadResource($resource) { - return require $resource; + return include $resource; } } --- vendor/symfony/translation/Loader/JsonFileLoader.php +++ PHP_CodeSniffer @@ -47,18 +47,18 @@ private function getJSONErrorMessage($errorCode) { switch ($errorCode) { - case JSON_ERROR_DEPTH: - return 'Maximum stack depth exceeded'; - case JSON_ERROR_STATE_MISMATCH: - return 'Underflow or the modes mismatch'; - case JSON_ERROR_CTRL_CHAR: - return 'Unexpected control character found'; - case JSON_ERROR_SYNTAX: - return 'Syntax error, malformed JSON'; - case JSON_ERROR_UTF8: - return 'Malformed UTF-8 characters, possibly incorrectly encoded'; - default: - return 'Unknown error'; + case JSON_ERROR_DEPTH: + return 'Maximum stack depth exceeded'; + case JSON_ERROR_STATE_MISMATCH: + return 'Underflow or the modes mismatch'; + case JSON_ERROR_CTRL_CHAR: + return 'Unexpected control character found'; + case JSON_ERROR_SYNTAX: + return 'Syntax error, malformed JSON'; + case JSON_ERROR_UTF8: + return 'Malformed UTF-8 characters, possibly incorrectly encoded'; + default: + return 'Unknown error'; } } } --- vendor/symfony/translation/Loader/XliffFileLoader.php +++ PHP_CodeSniffer @@ -239,7 +239,8 @@ { $errors = array(); foreach (libxml_get_errors() as $error) { - $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', + $errors[] = sprintf( + '[%s %s] %s (in %s - line %d, column %d)', LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', $error->code, trim($error->message), @@ -267,7 +268,9 @@ */ private function getVersionNumber(\DOMDocument $dom) { - /** @var \DOMNode $xliff */ + /** + * @var \DOMNode $xliff +*/ foreach ($dom->getElementsByTagName('xliff') as $xliff) { $version = $xliff->attributes->getNamedItem('version'); if ($version) { --- vendor/symfony/translation/Interval.php +++ PHP_CodeSniffer @@ -29,7 +29,7 @@ * * @author Fabien Potencier * - * @see http://en.wikipedia.org/wiki/Interval_%28mathematics%29#The_ISO_notation + * @see http://en.wikipedia.org/wiki/Interval_%28mathematics%29#The_ISO_notation */ class Interval { --- vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ PHP_CodeSniffer @@ -74,10 +74,14 @@ } if (!isset($event['method'])) { - $event['method'] = 'on'.preg_replace_callback(array( + $event['method'] = 'on'.preg_replace_callback( + array( '/(?<=\b)[a-z]/i', '/[^a-z0-9]/i', - ), function ($matches) { return strtoupper($matches[0]); }, $event['event']); + ), function ($matches) { + return strtoupper($matches[0]); + }, $event['event'] + ); $event['method'] = preg_replace('/[^a-z0-9]/i', '', $event['method']); } --- vendor/symfony/event-dispatcher/Tests/ImmutableEventDispatcherTest.php +++ PHP_CodeSniffer @@ -72,7 +72,11 @@ */ public function testAddListenerDisallowed() { - $this->dispatcher->addListener('event', function () { return 'foo'; }); + $this->dispatcher->addListener( + 'event', function () { + return 'foo'; + } + ); } /** @@ -90,7 +94,11 @@ */ public function testRemoveListenerDisallowed() { - $this->dispatcher->removeListener('event', function () { return 'foo'; }); + $this->dispatcher->removeListener( + 'event', function () { + return 'foo'; + } + ); } /** --- vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php +++ PHP_CodeSniffer @@ -25,7 +25,10 @@ $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - $tdispatcher->addListener('foo', $listener = function () {}); + $tdispatcher->addListener( + 'foo', $listener = function () { + } + ); $listeners = $dispatcher->getListeners('foo'); $this->assertCount(1, $listeners); $this->assertSame($listener, $listeners[0]); @@ -39,7 +42,10 @@ $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - $tdispatcher->addListener('foo', $listener = function () {}); + $tdispatcher->addListener( + 'foo', $listener = function () { + } + ); $this->assertSame($dispatcher->getListeners('foo'), $tdispatcher->getListeners('foo')); } @@ -51,7 +57,10 @@ $this->assertFalse($dispatcher->hasListeners('foo')); $this->assertFalse($tdispatcher->hasListeners('foo')); - $tdispatcher->addListener('foo', $listener = function () {}); + $tdispatcher->addListener( + 'foo', $listener = function () { + } + ); $this->assertTrue($dispatcher->hasListeners('foo')); $this->assertTrue($tdispatcher->hasListeners('foo')); } @@ -61,7 +70,10 @@ $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - $tdispatcher->addListener('foo', function () {}, 123); + $tdispatcher->addListener( + 'foo', function () { + }, 123 + ); $listeners = $dispatcher->getListeners('foo'); $this->assertSame(123, $tdispatcher->getListenerPriority('foo', $listeners[0])); @@ -77,7 +89,10 @@ { $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); $traceableEventDispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - $traceableEventDispatcher->addListener('foo', function () {}, 123); + $traceableEventDispatcher->addListener( + 'foo', function () { + }, 123 + ); $listeners = $traceableEventDispatcher->getListeners('foo'); $this->assertSame(0, $traceableEventDispatcher->getListenerPriority('foo', $listeners[0])); @@ -103,7 +118,10 @@ { $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - $tdispatcher->addListener('foo', $listener = function () {}); + $tdispatcher->addListener( + 'foo', $listener = function () { + } + ); $this->assertEquals(array(), $tdispatcher->getCalledListeners()); $this->assertEquals(array('foo.closure' => array('event' => 'foo', 'type' => 'Closure', 'pretty' => 'closure', 'priority' => 0)), $tdispatcher->getNotCalledListeners()); @@ -118,11 +136,16 @@ { $tdispatcher = null; $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $dispatcher->addListener('foo', function (Event $event, $eventName, $dispatcher) use (&$tdispatcher) { - $tdispatcher = $dispatcher; - $dispatcher->dispatch('bar'); - }); - $dispatcher->addListener('bar', function (Event $event) {}); + $dispatcher->addListener( + 'foo', function (Event $event, $eventName, $dispatcher) use (&$tdispatcher) { + $tdispatcher = $dispatcher; + $dispatcher->dispatch('bar'); + } + ); + $dispatcher->addListener( + 'bar', function (Event $event) { + } + ); $dispatcher->dispatch('foo'); $this->assertSame($dispatcher, $tdispatcher); $this->assertCount(2, $dispatcher->getCalledListeners()); @@ -134,8 +157,14 @@ $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger); - $tdispatcher->addListener('foo', $listener1 = function () {}); - $tdispatcher->addListener('foo', $listener2 = function () {}); + $tdispatcher->addListener( + 'foo', $listener1 = function () { + } + ); + $tdispatcher->addListener( + 'foo', $listener2 = function () { + } + ); $logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".'); $logger->expects($this->at(1))->method('debug')->with('Notified event "foo" to listener "closure".'); @@ -149,8 +178,15 @@ $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch(), $logger); - $tdispatcher->addListener('foo', $listener1 = function (Event $event) { $event->stopPropagation(); }); - $tdispatcher->addListener('foo', $listener2 = function () {}); + $tdispatcher->addListener( + 'foo', $listener1 = function (Event $event) { + $event->stopPropagation(); + } + ); + $tdispatcher->addListener( + 'foo', $listener2 = function () { + } + ); $logger->expects($this->at(0))->method('debug')->with('Notified event "foo" to listener "closure".'); $logger->expects($this->at(1))->method('debug')->with('Listener "closure" stopped propagation of the event "foo".'); @@ -165,8 +201,16 @@ $dispatcher = new EventDispatcher(); $tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch()); - $tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo1'; }, 10); - $tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo2'; }, 20); + $tdispatcher->addListener( + 'foo', function () use (&$called) { + $called[] = 'foo1'; + }, 10 + ); + $tdispatcher->addListener( + 'foo', function () use (&$called) { + $called[] = 'foo2'; + }, 20 + ); $tdispatcher->dispatch('foo'); @@ -177,12 +221,14 @@ { $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); $loop = 1; - $dispatcher->addListener('foo', $listener1 = function () use ($dispatcher, &$loop) { - ++$loop; - if (2 == $loop) { - $dispatcher->dispatch('foo'); + $dispatcher->addListener( + 'foo', $listener1 = function () use ($dispatcher, &$loop) { + ++$loop; + if (2 == $loop) { + $dispatcher->dispatch('foo'); + } } - }); + ); $dispatcher->dispatch('foo'); } @@ -191,12 +237,16 @@ { $nestedCall = false; $dispatcher = new TraceableEventDispatcher(new EventDispatcher(), new Stopwatch()); - $dispatcher->addListener('foo', function (Event $e) use ($dispatcher) { - $dispatcher->dispatch('bar', $e); - }); - $dispatcher->addListener('bar', function (Event $e) use (&$nestedCall) { - $nestedCall = true; - }); + $dispatcher->addListener( + 'foo', function (Event $e) use ($dispatcher) { + $dispatcher->dispatch('bar', $e); + } + ); + $dispatcher->addListener( + 'bar', function (Event $e) use (&$nestedCall) { + $nestedCall = true; + } + ); $this->assertFalse($nestedCall); $dispatcher->dispatch('foo'); @@ -210,7 +260,10 @@ $dispatcher->removeListener('foo', $listener1); }; $eventDispatcher->addListener('foo', $listener1); - $eventDispatcher->addListener('foo', function () {}); + $eventDispatcher->addListener( + 'foo', function () { + } + ); $eventDispatcher->dispatch('foo'); $this->assertCount(1, $eventDispatcher->getListeners('foo'), 'expected listener1 to be removed'); --- vendor/symfony/event-dispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ PHP_CodeSniffer @@ -35,8 +35,7 @@ $service ->expects($this->once()) ->method('onEvent') - ->with($event) - ; + ->with($event); $container = new Container(); $container->set('service.listener', $service); @@ -56,20 +55,17 @@ $service ->expects($this->once()) ->method('onEvent') - ->with($event) - ; + ->with($event); $service ->expects($this->once()) ->method('onEventWithPriority') - ->with($event) - ; + ->with($event); $service ->expects($this->once()) ->method('onEventNested') - ->with($event) - ; + ->with($event); $container = new Container(); $container->set('service.subscriber', $service); @@ -91,8 +87,7 @@ $service ->expects($this->once()) ->method('onEvent') - ->with($event) - ; + ->with($event); $container = new Container(); $container->set('service.listener', $service); @@ -138,8 +133,7 @@ $service1 ->expects($this->exactly(2)) ->method('onEvent') - ->with($event) - ; + ->with($event); $scope = new Scope('scope'); $container = new Container(); @@ -157,8 +151,7 @@ $service2 ->expects($this->once()) ->method('onEvent') - ->with($event) - ; + ->with($event); $container->enterScope('scope'); $container->set('service.listener', $service2, 'scope'); @@ -188,8 +181,7 @@ $service ->expects($this->once()) ->method('onEvent') - ->with($event) - ; + ->with($event); $this->assertTrue($dispatcher->hasListeners()); --- vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php +++ PHP_CodeSniffer @@ -119,7 +119,12 @@ $this->assertSame(-10, $this->dispatcher->getListenerPriority('pre.foo', $listener1)); $this->assertSame(0, $this->dispatcher->getListenerPriority('pre.foo', $listener2)); $this->assertNull($this->dispatcher->getListenerPriority('pre.bar', $listener2)); - $this->assertNull($this->dispatcher->getListenerPriority('pre.foo', function () {})); + $this->assertNull( + $this->dispatcher->getListenerPriority( + 'pre.foo', function () { + } + ) + ); } public function testDispatch() @@ -269,9 +274,11 @@ public function testLegacyEventReceivesTheDispatcherInstance() { $dispatcher = null; - $this->dispatcher->addListener('test', function ($event) use (&$dispatcher) { - $dispatcher = $event->getDispatcher(); - }); + $this->dispatcher->addListener( + 'test', function ($event) use (&$dispatcher) { + $dispatcher = $event->getDispatcher(); + } + ); $this->dispatcher->dispatch('test'); $this->assertSame($this->dispatcher, $dispatcher); } @@ -299,13 +306,17 @@ { $dispatcher = $this->createEventDispatcher(); $dispatcher->addListener('bug.62976', new CallableClass()); - $dispatcher->removeListener('bug.62976', function () {}); + $dispatcher->removeListener( + 'bug.62976', function () { + } + ); $this->assertTrue($dispatcher->hasListeners('bug.62976')); } public function testHasListenersWhenAddedCallbackListenerIsRemoved() { - $listener = function () {}; + $listener = function () { + }; $this->dispatcher->addListener('foo', $listener); $this->dispatcher->removeListener('foo', $listener); $this->assertFalse($this->dispatcher->hasListeners()); @@ -313,7 +324,8 @@ public function testGetListenersWhenAddedCallbackListenerIsRemoved() { - $listener = function () {}; + $listener = function () { + }; $this->dispatcher->addListener('foo', $listener); $this->dispatcher->removeListener('foo', $listener); $this->assertSame(array(), $this->dispatcher->getListeners()); --- vendor/symfony/validator/PropertyMetadataInterface.php +++ PHP_CodeSniffer @@ -22,7 +22,7 @@ * * @author Bernhard Schussek * - * @see MetadataInterface + * @see MetadataInterface * @deprecated since version 2.5, to be removed in 3.0. * Use {@link Mapping\PropertyMetadataInterface} instead. */ --- vendor/symfony/validator/Context/ExecutionContextInterface.php +++ PHP_CodeSniffer @@ -56,7 +56,7 @@ * cannot store a context and expect that the methods still return the same * results later on. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ --- vendor/symfony/validator/Context/ExecutionContextFactoryInterface.php +++ PHP_CodeSniffer @@ -19,7 +19,7 @@ * You can use a custom factory if you want to customize the execution context * that is passed through the validation run. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ --- vendor/symfony/validator/Context/ExecutionContext.php +++ PHP_CodeSniffer @@ -27,7 +27,7 @@ /** * The context used and created by {@link ExecutionContextFactory}. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * @@ -196,23 +196,24 @@ ->setInvalidValue($invalidValue) ->setPlural($plural) ->setCode($code) - ->addViolation() - ; + ->addViolation(); return; } - $this->violations->add(new ConstraintViolation( - $this->translator->trans($message, $parameters, $this->translationDomain), - $message, - $parameters, - $this->root, - $this->propertyPath, - $this->value, - null, - null, - $this->constraint - )); + $this->violations->add( + new ConstraintViolation( + $this->translator->trans($message, $parameters, $this->translationDomain), + $message, + $parameters, + $this->root, + $this->propertyPath, + $this->value, + null, + null, + $this->constraint + ) + ); } /** @@ -327,8 +328,7 @@ ->setInvalidValue($invalidValue) ->setPlural($plural) ->setCode($code) - ->addViolation() - ; + ->addViolation(); return; } @@ -336,8 +336,7 @@ $this ->buildViolation($message, $parameters) ->atPath($subPath) - ->addViolation() - ; + ->addViolation(); } /** @@ -355,8 +354,7 @@ ->getValidator() ->inContext($this) ->atPath($subPath) - ->validate($value, $constraint, $groups) - ; + ->validate($value, $constraint, $groups); } if ($traverse && $value instanceof \Traversable) { @@ -366,16 +364,14 @@ ->getValidator() ->inContext($this) ->atPath($subPath) - ->validate($value, $constraint, $groups) - ; + ->validate($value, $constraint, $groups); } return $this ->getValidator() ->inContext($this) ->atPath($subPath) - ->validate($value, null, $groups) - ; + ->validate($value, null, $groups); } /** @@ -389,8 +385,7 @@ ->getValidator() ->inContext($this) ->atPath($subPath) - ->validate($value, $constraints, $groups) - ; + ->validate($value, $constraints, $groups); } /** --- vendor/symfony/validator/Context/ExecutionContextFactory.php +++ PHP_CodeSniffer @@ -17,7 +17,7 @@ /** * Creates new {@link ExecutionContext} instances. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * --- vendor/symfony/validator/Context/LegacyExecutionContextFactory.php +++ PHP_CodeSniffer @@ -22,7 +22,7 @@ * * Implemented for backward compatibility with Symfony < 2.5. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * --- vendor/symfony/validator/Context/LegacyExecutionContext.php +++ PHP_CodeSniffer @@ -20,7 +20,7 @@ /** * An execution context that is compatible with the legacy API (< 2.5). * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * --- vendor/symfony/validator/Violation/ConstraintViolationBuilder.php +++ PHP_CodeSniffer @@ -20,7 +20,7 @@ /** * Default implementation of {@link ConstraintViolationBuilderInterface}. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * @@ -199,7 +199,7 @@ $this->message, $this->plural, $this->parameters, - $this->translationDomain# + $this->translationDomain// ); } catch (\InvalidArgumentException $e) { $translatedMessage = $this->translator->trans( @@ -210,17 +210,19 @@ } } - $this->violations->add(new ConstraintViolation( - $translatedMessage, - $this->message, - $this->parameters, - $this->root, - $this->propertyPath, - $this->invalidValue, - $this->plural, - $this->code, - $this->constraint, - $this->cause - )); + $this->violations->add( + new ConstraintViolation( + $translatedMessage, + $this->message, + $this->parameters, + $this->root, + $this->propertyPath, + $this->invalidValue, + $this->plural, + $this->code, + $this->constraint, + $this->cause + ) + ); } } --- vendor/symfony/validator/Violation/ConstraintViolationBuilderInterface.php +++ PHP_CodeSniffer @@ -19,7 +19,7 @@ * Finally, call {@link addViolation()} to add the violation to the current * execution context. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ --- vendor/symfony/validator/Tests/ConstraintViolationListTest.php +++ PHP_CodeSniffer @@ -102,13 +102,15 @@ public function testToString() { - $this->list = new ConstraintViolationList(array( + $this->list = new ConstraintViolationList( + array( $this->getViolation('Error 1', 'Root'), $this->getViolation('Error 2', 'Root', 'foo.bar'), $this->getViolation('Error 3', 'Root', '[baz]'), $this->getViolation('Error 4', '', 'foo.bar'), $this->getViolation('Error 5', '', '[baz]'), - )); + ) + ); $expected = <<<'EOF' Root: --- vendor/symfony/validator/Tests/ConstraintTest.php +++ PHP_CodeSniffer @@ -23,10 +23,12 @@ { public function testSetProperties() { - $constraint = new ConstraintA(array( + $constraint = new ConstraintA( + array( 'property1' => 'foo', 'property2' => 'bar', - )); + ) + ); $this->assertEquals('foo', $constraint->property1); $this->assertEquals('bar', $constraint->property2); @@ -36,9 +38,11 @@ { $this->setExpectedException('Symfony\Component\Validator\Exception\InvalidOptionsException'); - new ConstraintA(array( + new ConstraintA( + array( 'foo' => 'bar', - )); + ) + ); } public function testMagicPropertiesAreNotAllowed() @@ -54,10 +58,12 @@ { $this->setExpectedException('Symfony\Component\Validator\Exception\InvalidOptionsException'); - new ConstraintC(array( + new ConstraintC( + array( 'option1' => 'default', 'foo' => 'bar', - )); + ) + ); } public function testSetDefaultProperty() @@ -158,10 +164,12 @@ public function testSerialize() { - $constraint = new ConstraintA(array( + $constraint = new ConstraintA( + array( 'property1' => 'foo', 'property2' => 'bar', - )); + ) + ); $restoredConstraint = unserialize(serialize($constraint)); @@ -170,29 +178,35 @@ public function testSerializeInitializesGroupsOptionToDefault() { - $constraint = new ConstraintA(array( + $constraint = new ConstraintA( + array( 'property1' => 'foo', 'property2' => 'bar', - )); + ) + ); $constraint = unserialize(serialize($constraint)); - $expected = new ConstraintA(array( + $expected = new ConstraintA( + array( 'property1' => 'foo', 'property2' => 'bar', 'groups' => 'Default', - )); + ) + ); $this->assertEquals($expected, $constraint); } public function testSerializeKeepsCustomGroups() { - $constraint = new ConstraintA(array( + $constraint = new ConstraintA( + array( 'property1' => 'foo', 'property2' => 'bar', 'groups' => 'MyGroup', - )); + ) + ); $constraint = unserialize(serialize($constraint)); --- vendor/symfony/validator/Tests/Constraints/TimeValidatorTest.php +++ PHP_CodeSniffer @@ -80,9 +80,11 @@ */ public function testInvalidTimes($time, $code) { - $constraint = new Time(array( + $constraint = new Time( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($time, $constraint); --- vendor/symfony/validator/Tests/Constraints/DateTimeValidatorTest.php +++ PHP_CodeSniffer @@ -80,9 +80,11 @@ */ public function testInvalidDateTimes($dateTime, $code) { - $constraint = new DateTime(array( + $constraint = new DateTime( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($dateTime, $constraint); --- vendor/symfony/validator/Tests/Constraints/CompositeTest.php +++ PHP_CodeSniffer @@ -40,10 +40,12 @@ { public function testMergeNestedGroupsIfNoExplicitParentGroup() { - $constraint = new ConcreteComposite(array( + $constraint = new ConcreteComposite( + array( new NotNull(array('groups' => 'Default')), new NotBlank(array('groups' => array('Default', 'Strict'))), - )); + ) + ); $this->assertEquals(array('Default', 'Strict'), $constraint->groups); $this->assertEquals(array('Default'), $constraint->constraints[0]->groups); @@ -52,13 +54,15 @@ public function testSetImplicitNestedGroupsIfExplicitParentGroup() { - $constraint = new ConcreteComposite(array( + $constraint = new ConcreteComposite( + array( 'constraints' => array( new NotNull(), new NotBlank(), ), 'groups' => array('Default', 'Strict'), - )); + ) + ); $this->assertEquals(array('Default', 'Strict'), $constraint->groups); $this->assertEquals(array('Default', 'Strict'), $constraint->constraints[0]->groups); @@ -67,13 +71,15 @@ public function testExplicitNestedGroupsMustBeSubsetOfExplicitParentGroups() { - $constraint = new ConcreteComposite(array( + $constraint = new ConcreteComposite( + array( 'constraints' => array( new NotNull(array('groups' => 'Default')), new NotBlank(array('groups' => 'Strict')), ), 'groups' => array('Default', 'Strict'), - )); + ) + ); $this->assertEquals(array('Default', 'Strict'), $constraint->groups); $this->assertEquals(array('Default'), $constraint->constraints[0]->groups); @@ -85,20 +91,24 @@ */ public function testFailIfExplicitNestedGroupsNotSubsetOfExplicitParentGroups() { - new ConcreteComposite(array( + new ConcreteComposite( + array( 'constraints' => array( new NotNull(array('groups' => array('Default', 'Foobar'))), ), 'groups' => array('Default', 'Strict'), - )); + ) + ); } public function testImplicitGroupNamesAreForwarded() { - $constraint = new ConcreteComposite(array( + $constraint = new ConcreteComposite( + array( new NotNull(array('groups' => 'Default')), new NotBlank(array('groups' => 'Strict')), - )); + ) + ); $constraint->addImplicitGroupName('ImplicitGroup'); @@ -120,10 +130,12 @@ */ public function testFailIfNoConstraint() { - new ConcreteComposite(array( + new ConcreteComposite( + array( new NotNull(array('groups' => 'Default')), 'NotBlank', - )); + ) + ); } /** @@ -131,8 +143,10 @@ */ public function testValidCantBeNested() { - new ConcreteComposite(array( + new ConcreteComposite( + array( new Valid(), - )); + ) + ); } } --- vendor/symfony/validator/Tests/Constraints/ImageValidatorTest.php +++ PHP_CodeSniffer @@ -77,9 +77,11 @@ public function testFileNotFound() { // Check that the logic from FileValidator still works - $constraint = new Image(array( + $constraint = new Image( + array( 'notFoundMessage' => 'myMessage', - )); + ) + ); $this->validator->validate('foobar', $constraint); @@ -91,12 +93,14 @@ public function testValidSize() { - $constraint = new Image(array( + $constraint = new Image( + array( 'minWidth' => 1, 'maxWidth' => 2, 'minHeight' => 1, 'maxHeight' => 2, - )); + ) + ); $this->validator->validate($this->image, $constraint); @@ -105,10 +109,12 @@ public function testWidthTooSmall() { - $constraint = new Image(array( + $constraint = new Image( + array( 'minWidth' => 3, 'minWidthMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->image, $constraint); @@ -121,10 +127,12 @@ public function testWidthTooBig() { - $constraint = new Image(array( + $constraint = new Image( + array( 'maxWidth' => 1, 'maxWidthMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->image, $constraint); @@ -137,10 +145,12 @@ public function testHeightTooSmall() { - $constraint = new Image(array( + $constraint = new Image( + array( 'minHeight' => 3, 'minHeightMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->image, $constraint); @@ -153,10 +163,12 @@ public function testHeightTooBig() { - $constraint = new Image(array( + $constraint = new Image( + array( 'maxHeight' => 1, 'maxHeightMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->image, $constraint); @@ -172,9 +184,11 @@ */ public function testInvalidMinWidth() { - $constraint = new Image(array( + $constraint = new Image( + array( 'minWidth' => '1abc', - )); + ) + ); $this->validator->validate($this->image, $constraint); } @@ -184,9 +198,11 @@ */ public function testInvalidMaxWidth() { - $constraint = new Image(array( + $constraint = new Image( + array( 'maxWidth' => '1abc', - )); + ) + ); $this->validator->validate($this->image, $constraint); } @@ -196,9 +212,11 @@ */ public function testInvalidMinHeight() { - $constraint = new Image(array( + $constraint = new Image( + array( 'minHeight' => '1abc', - )); + ) + ); $this->validator->validate($this->image, $constraint); } @@ -208,19 +226,23 @@ */ public function testInvalidMaxHeight() { - $constraint = new Image(array( + $constraint = new Image( + array( 'maxHeight' => '1abc', - )); + ) + ); $this->validator->validate($this->image, $constraint); } public function testRatioTooSmall() { - $constraint = new Image(array( + $constraint = new Image( + array( 'minRatio' => 2, 'minRatioMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->image, $constraint); @@ -233,10 +255,12 @@ public function testRatioTooBig() { - $constraint = new Image(array( + $constraint = new Image( + array( 'maxRatio' => 0.5, 'maxRatioMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->image, $constraint); @@ -249,9 +273,11 @@ public function testMaxRatioUsesTwoDecimalsOnly() { - $constraint = new Image(array( + $constraint = new Image( + array( 'maxRatio' => 1.33, - )); + ) + ); $this->validator->validate($this->image4By3, $constraint); @@ -263,9 +289,11 @@ */ public function testInvalidMinRatio() { - $constraint = new Image(array( + $constraint = new Image( + array( 'minRatio' => '1abc', - )); + ) + ); $this->validator->validate($this->image, $constraint); } @@ -275,19 +303,23 @@ */ public function testInvalidMaxRatio() { - $constraint = new Image(array( + $constraint = new Image( + array( 'maxRatio' => '1abc', - )); + ) + ); $this->validator->validate($this->image, $constraint); } public function testSquareNotAllowed() { - $constraint = new Image(array( + $constraint = new Image( + array( 'allowSquare' => false, 'allowSquareMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->image, $constraint); @@ -300,10 +332,12 @@ public function testLandscapeNotAllowed() { - $constraint = new Image(array( + $constraint = new Image( + array( 'allowLandscape' => false, 'allowLandscapeMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->imageLandscape, $constraint); @@ -316,10 +350,12 @@ public function testPortraitNotAllowed() { - $constraint = new Image(array( + $constraint = new Image( + array( 'allowPortrait' => false, 'allowPortraitMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->imagePortrait, $constraint); --- vendor/symfony/validator/Tests/Constraints/LengthValidatorTest.php +++ PHP_CodeSniffer @@ -135,10 +135,12 @@ */ public function testInvalidValuesMin($value) { - $constraint = new Length(array( + $constraint = new Length( + array( 'min' => 4, 'minMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -156,10 +158,12 @@ */ public function testInvalidValuesMax($value) { - $constraint = new Length(array( + $constraint = new Length( + array( 'max' => 4, 'maxMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -177,11 +181,13 @@ */ public function testInvalidValuesExactLessThanFour($value) { - $constraint = new Length(array( + $constraint = new Length( + array( 'min' => 4, 'max' => 4, 'exactMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -199,11 +205,13 @@ */ public function testInvalidValuesExactMoreThanFour($value) { - $constraint = new Length(array( + $constraint = new Length( + array( 'min' => 4, 'max' => 4, 'exactMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -221,12 +229,14 @@ */ public function testOneCharset($value, $charset, $isValid) { - $constraint = new Length(array( + $constraint = new Length( + array( 'min' => 1, 'max' => 1, 'charset' => $charset, 'charsetMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); --- vendor/symfony/validator/Tests/Constraints/AbstractConstraintValidatorTest.php +++ PHP_CodeSniffer @@ -101,24 +101,24 @@ $contextualValidator = $this->getMock('Symfony\Component\Validator\Validator\ContextualValidatorInterface'); switch ($this->getApiVersion()) { - case Validation::API_VERSION_2_5: - $context = new ExecutionContext( - $validator, - $this->root, - $translator - ); - break; - case Validation::API_VERSION_2_4: - case Validation::API_VERSION_2_5_BC: - $context = new LegacyExecutionContext( - $validator, - $this->root, - $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface'), - $translator - ); - break; - default: - throw new \RuntimeException('Invalid API version'); + case Validation::API_VERSION_2_5: + $context = new ExecutionContext( + $validator, + $this->root, + $translator + ); + break; + case Validation::API_VERSION_2_4: + case Validation::API_VERSION_2_5_BC: + $context = new LegacyExecutionContext( + $validator, + $this->root, + $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface'), + $translator + ); + break; + default: + throw new \RuntimeException('Invalid API version'); } $context->setGroup($this->group); --- vendor/symfony/validator/Tests/Constraints/NotNullValidatorTest.php +++ PHP_CodeSniffer @@ -49,9 +49,11 @@ public function testNullIsInvalid() { - $constraint = new NotNull(array( + $constraint = new NotNull( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate(null, $constraint); --- vendor/symfony/validator/Tests/Constraints/CollectionValidatorTest.php +++ PHP_CodeSniffer @@ -35,9 +35,13 @@ public function testNullIsValid() { - $this->validator->validate(null, new Collection(array('fields' => array( - 'foo' => new Range(array('min' => 4)), - )))); + $this->validator->validate( + null, new Collection( + array('fields' => array( + 'foo' => new Range(array('min' => 4)), + )) + ) + ); $this->assertNoViolation(); } @@ -50,9 +54,13 @@ $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); - $this->validator->validate($data, new Collection(array( - 'foo' => $constraint, - ))); + $this->validator->validate( + $data, new Collection( + array( + 'foo' => $constraint, + ) + ) + ); $this->assertNoViolation(); } @@ -62,9 +70,13 @@ */ public function testThrowsExceptionIfNotTraversable() { - $this->validator->validate('foobar', new Collection(array('fields' => array( - 'foo' => new Range(array('min' => 4)), - )))); + $this->validator->validate( + 'foobar', new Collection( + array('fields' => array( + 'foo' => new Range(array('min' => 4)), + )) + ) + ); } public function testWalkSingleConstraint() @@ -84,12 +96,16 @@ $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate( + $data, new Collection( + array( + 'fields' => array( 'foo' => $constraint, 'bar' => $constraint, - ), - ))); + ), + ) + ) + ); $this->assertNoViolation(); } @@ -114,12 +130,16 @@ $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate( + $data, new Collection( + array( + 'fields' => array( 'foo' => $constraints, 'bar' => $constraints, - ), - ))); + ), + ) + ) + ); $this->assertNoViolation(); } @@ -128,19 +148,25 @@ { $constraint = new Range(array('min' => 4)); - $data = $this->prepareTestData(array( + $data = $this->prepareTestData( + array( 'foo' => 5, 'baz' => 6, - )); + ) + ); $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate( + $data, new Collection( + array( + 'fields' => array( 'foo' => $constraint, - ), - 'extraFieldsMessage' => 'myMessage', - ))); + ), + 'extraFieldsMessage' => 'myMessage', + ) + ) + ); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"baz"') @@ -153,40 +179,52 @@ // bug fix public function testNullNotConsideredExtraField() { - $data = $this->prepareTestData(array( + $data = $this->prepareTestData( + array( 'foo' => null, - )); + ) + ); $constraint = new Range(array('min' => 4)); $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate( + $data, new Collection( + array( + 'fields' => array( 'foo' => $constraint, - ), - ))); + ), + ) + ) + ); $this->assertNoViolation(); } public function testExtraFieldsAllowed() { - $data = $this->prepareTestData(array( + $data = $this->prepareTestData( + array( 'foo' => 5, 'bar' => 6, - )); + ) + ); $constraint = new Range(array('min' => 4)); $this->expectValidateValueAt(0, '[foo]', $data['foo'], array($constraint)); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate( + $data, new Collection( + array( + 'fields' => array( 'foo' => $constraint, - ), - 'allowExtraFields' => true, - ))); + ), + 'allowExtraFields' => true, + ) + ) + ); $this->assertNoViolation(); } @@ -197,12 +235,16 @@ $constraint = new Range(array('min' => 4)); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate( + $data, new Collection( + array( + 'fields' => array( 'foo' => $constraint, - ), - 'missingFieldsMessage' => 'myMessage', - ))); + ), + 'missingFieldsMessage' => 'myMessage', + ) + ) + ); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"foo"') @@ -218,25 +260,35 @@ $constraint = new Range(array('min' => 4)); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate( + $data, new Collection( + array( + 'fields' => array( 'foo' => $constraint, - ), - 'allowMissingFields' => true, - ))); + ), + 'allowMissingFields' => true, + ) + ) + ); $this->assertNoViolation(); } public function testOptionalFieldPresent() { - $data = $this->prepareTestData(array( + $data = $this->prepareTestData( + array( 'foo' => null, - )); + ) + ); - $this->validator->validate($data, new Collection(array( - 'foo' => new Optional(), - ))); + $this->validator->validate( + $data, new Collection( + array( + 'foo' => new Optional(), + ) + ) + ); $this->assertNoViolation(); } @@ -245,9 +297,13 @@ { $data = $this->prepareTestData(array()); - $this->validator->validate($data, new Collection(array( - 'foo' => new Optional(), - ))); + $this->validator->validate( + $data, new Collection( + array( + 'foo' => new Optional(), + ) + ) + ); $this->assertNoViolation(); } @@ -264,9 +320,13 @@ $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( - 'foo' => new Optional($constraint), - ))); + $this->validator->validate( + $data, new Collection( + array( + 'foo' => new Optional($constraint), + ) + ) + ); $this->assertNoViolation(); } @@ -286,22 +346,32 @@ $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( - 'foo' => new Optional($constraints), - ))); + $this->validator->validate( + $data, new Collection( + array( + 'foo' => new Optional($constraints), + ) + ) + ); $this->assertNoViolation(); } public function testRequiredFieldPresent() { - $data = $this->prepareTestData(array( + $data = $this->prepareTestData( + array( 'foo' => null, - )); + ) + ); - $this->validator->validate($data, new Collection(array( - 'foo' => new Required(), - ))); + $this->validator->validate( + $data, new Collection( + array( + 'foo' => new Required(), + ) + ) + ); $this->assertNoViolation(); } @@ -310,12 +380,16 @@ { $data = $this->prepareTestData(array()); - $this->validator->validate($data, new Collection(array( - 'fields' => array( + $this->validator->validate( + $data, new Collection( + array( + 'fields' => array( 'foo' => new Required(), - ), - 'missingFieldsMessage' => 'myMessage', - ))); + ), + 'missingFieldsMessage' => 'myMessage', + ) + ) + ); $this->buildViolation('myMessage') ->setParameter('{{ field }}', '"foo"') @@ -337,9 +411,13 @@ $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( - 'foo' => new Required($constraint), - ))); + $this->validator->validate( + $data, new Collection( + array( + 'foo' => new Required($constraint), + ) + ) + ); $this->assertNoViolation(); } @@ -359,31 +437,43 @@ $data = $this->prepareTestData($array); - $this->validator->validate($data, new Collection(array( - 'foo' => new Required($constraints), - ))); + $this->validator->validate( + $data, new Collection( + array( + 'foo' => new Required($constraints), + ) + ) + ); $this->assertNoViolation(); } public function testObjectShouldBeLeftUnchanged() { - $value = new \ArrayObject(array( + $value = new \ArrayObject( + array( 'foo' => 3, - )); + ) + ); $constraint = new Range(array('min' => 2)); $this->expectValidateValueAt(0, '[foo]', $value['foo'], array($constraint)); - $this->validator->validate($value, new Collection(array( - 'fields' => array( + $this->validator->validate( + $value, new Collection( + array( + 'fields' => array( 'foo' => $constraint, - ), - ))); + ), + ) + ) + ); - $this->assertEquals(array( + $this->assertEquals( + array( 'foo' => 3, - ), (array) $value); + ), (array) $value + ); } } --- vendor/symfony/validator/Tests/Constraints/ChoiceValidatorTest.php +++ PHP_CodeSniffer @@ -42,10 +42,12 @@ */ public function testExpectArrayIfMultipleIsTrue() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array('foo', 'bar'), 'multiple' => true, - )); + ) + ); $this->validator->validate('asdf', $constraint); } @@ -93,9 +95,11 @@ public function testValidChoiceCallbackClosure() { - $constraint = new Choice(array('callback' => function () { - return array('foo', 'bar'); - })); + $constraint = new Choice( + array('callback' => function () { + return array('foo', 'bar'); + }) + ); $this->validator->validate('bar', $constraint); @@ -125,10 +129,12 @@ public function testMultipleChoices() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array('foo', 'bar', 'baz'), 'multiple' => true, - )); + ) + ); $this->validator->validate(array('baz', 'bar'), $constraint); @@ -137,10 +143,12 @@ public function testInvalidChoice() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array('foo', 'bar'), 'message' => 'myMessage', - )); + ) + ); $this->validator->validate('baz', $constraint); @@ -152,12 +160,14 @@ public function testInvalidChoiceEmptyChoices() { - $constraint = new Choice(array( + $constraint = new Choice( + array( // May happen when the choices are provided dynamically, e.g. from // the DB or the model 'choices' => array(), 'message' => 'myMessage', - )); + ) + ); $this->validator->validate('baz', $constraint); @@ -169,11 +179,13 @@ public function testInvalidChoiceMultiple() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array('foo', 'bar'), 'multipleMessage' => 'myMessage', 'multiple' => true, - )); + ) + ); $this->validator->validate(array('foo', 'baz'), $constraint); @@ -186,12 +198,14 @@ public function testTooFewChoices() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array('foo', 'bar', 'moo', 'maa'), 'multiple' => true, 'min' => 2, 'minMessage' => 'myMessage', - )); + ) + ); $value = array('foo'); @@ -209,12 +223,14 @@ public function testTooManyChoices() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array('foo', 'bar', 'moo', 'maa'), 'multiple' => true, 'max' => 2, 'maxMessage' => 'myMessage', - )); + ) + ); $value = array('foo', 'bar', 'moo'); @@ -232,10 +248,12 @@ public function testNonStrict() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array(1, 2), 'strict' => false, - )); + ) + ); $this->validator->validate('2', $constraint); $this->validator->validate(2, $constraint); @@ -245,10 +263,12 @@ public function testStrictAllowsExactValue() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array(1, 2), 'strict' => true, - )); + ) + ); $this->validator->validate(2, $constraint); @@ -257,11 +277,13 @@ public function testStrictDisallowsDifferentType() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array(1, 2), 'strict' => true, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate('2', $constraint); @@ -273,11 +295,13 @@ public function testNonStrictWithMultipleChoices() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array(1, 2, 3), 'multiple' => true, 'strict' => false, - )); + ) + ); $this->validator->validate(array('2', 3), $constraint); @@ -286,12 +310,14 @@ public function testStrictWithMultipleChoices() { - $constraint = new Choice(array( + $constraint = new Choice( + array( 'choices' => array(1, 2, 3), 'multiple' => true, 'strict' => true, 'multipleMessage' => 'myMessage', - )); + ) + ); $this->validator->validate(array(2, '3'), $constraint); --- vendor/symfony/validator/Tests/Constraints/CollectionTest.php +++ PHP_CodeSniffer @@ -27,9 +27,11 @@ */ public function testRejectInvalidFieldsOption() { - new Collection(array( + new Collection( + array( 'fields' => 'foo', - )); + ) + ); } /** @@ -37,9 +39,11 @@ */ public function testRejectNonConstraints() { - new Collection(array( + new Collection( + array( 'foo' => 'bar', - )); + ) + ); } /** @@ -47,9 +51,11 @@ */ public function testRejectValidConstraint() { - new Collection(array( + new Collection( + array( 'foo' => new Valid(), - )); + ) + ); } /** @@ -57,9 +63,11 @@ */ public function testRejectValidConstraintWithinOptional() { - new Collection(array( + new Collection( + array( 'foo' => new Optional(new Valid()), - )); + ) + ); } /** @@ -67,45 +75,55 @@ */ public function testRejectValidConstraintWithinRequired() { - new Collection(array( + new Collection( + array( 'foo' => new Required(new Valid()), - )); + ) + ); } public function testAcceptOptionalConstraintAsOneElementArray() { - $collection1 = new Collection(array( + $collection1 = new Collection( + array( 'fields' => array( 'alternate_email' => array( new Optional(new Email()), ), ), - )); + ) + ); - $collection2 = new Collection(array( + $collection2 = new Collection( + array( 'fields' => array( 'alternate_email' => new Optional(new Email()), ), - )); + ) + ); $this->assertEquals($collection1, $collection2); } public function testAcceptRequiredConstraintAsOneElementArray() { - $collection1 = new Collection(array( + $collection1 = new Collection( + array( 'fields' => array( 'alternate_email' => array( new Required(new Email()), ), ), - )); + ) + ); - $collection2 = new Collection(array( + $collection2 = new Collection( + array( 'fields' => array( 'alternate_email' => new Required(new Email()), ), - )); + ) + ); $this->assertEquals($collection1, $collection2); } --- vendor/symfony/validator/Tests/Constraints/CardSchemeValidatorTest.php +++ PHP_CodeSniffer @@ -56,10 +56,12 @@ */ public function testInvalidNumbers($scheme, $number, $code) { - $constraint = new CardScheme(array( + $constraint = new CardScheme( + array( 'schemes' => $scheme, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($number, $constraint); --- vendor/symfony/validator/Tests/Constraints/IsNullValidatorTest.php +++ PHP_CodeSniffer @@ -39,9 +39,11 @@ */ public function testInvalidValues($value, $valueAsString) { - $constraint = new IsNull(array( + $constraint = new IsNull( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); --- vendor/symfony/validator/Tests/Constraints/LuhnValidatorTest.php +++ PHP_CodeSniffer @@ -80,9 +80,11 @@ */ public function testInvalidNumbers($number, $code) { - $constraint = new Luhn(array( + $constraint = new Luhn( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($number, $constraint); --- vendor/symfony/validator/Tests/Constraints/IbanValidatorTest.php +++ PHP_CodeSniffer @@ -424,9 +424,11 @@ private function assertViolationRaised($iban, $code) { - $constraint = new Iban(array( + $constraint = new Iban( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($iban, $constraint); --- vendor/symfony/validator/Tests/Constraints/IsbnValidatorTest.php +++ PHP_CodeSniffer @@ -156,9 +156,11 @@ */ public function testValidIsbn10($isbn) { - $constraint = new Isbn(array( + $constraint = new Isbn( + array( 'type' => 'isbn10', - )); + ) + ); $this->validator->validate($isbn, $constraint); @@ -170,10 +172,12 @@ */ public function testInvalidIsbn10($isbn, $code) { - $constraint = new Isbn(array( + $constraint = new Isbn( + array( 'type' => 'isbn10', 'isbn10Message' => 'myMessage', - )); + ) + ); $this->validator->validate($isbn, $constraint); @@ -200,10 +204,12 @@ */ public function testInvalidIsbn13($isbn, $code) { - $constraint = new Isbn(array( + $constraint = new Isbn( + array( 'type' => 'isbn13', 'isbn13Message' => 'myMessage', - )); + ) + ); $this->validator->validate($isbn, $constraint); @@ -230,9 +236,11 @@ */ public function testInvalidIsbnAnyIsbn10($isbn, $code) { - $constraint = new Isbn(array( + $constraint = new Isbn( + array( 'bothIsbnMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($isbn, $constraint); @@ -252,9 +260,11 @@ */ public function testInvalidIsbnAnyIsbn13($isbn, $code) { - $constraint = new Isbn(array( + $constraint = new Isbn( + array( 'bothIsbnMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($isbn, $constraint); --- vendor/symfony/validator/Tests/Constraints/CallbackValidatorTest.php +++ PHP_CodeSniffer @@ -102,11 +102,13 @@ public function testClosure() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); + $constraint = new Callback( + function ($object, ExecutionContextInterface $context) { + $context->addViolation('My message', array('{{ value }}' => 'foobar')); - return false; - }); + return false; + } + ); $this->validator->validate($object, $constraint); @@ -117,11 +119,13 @@ public function testClosureNullObject() { - $constraint = new Callback(function ($object, ExecutionContextInterface $context) { - $context->addViolation('My message', array('{{ value }}' => 'foobar')); + $constraint = new Callback( + function ($object, ExecutionContextInterface $context) { + $context->addViolation('My message', array('{{ value }}' => 'foobar')); - return false; - }); + return false; + } + ); $this->validator->validate(null, $constraint); @@ -133,13 +137,15 @@ public function testClosureExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( + $constraint = new Callback( + array( 'callback' => function ($object, ExecutionContextInterface $context) { $context->addViolation('My message', array('{{ value }}' => 'foobar')); return false; }, - )); + ) + ); $this->validator->validate($object, $constraint); @@ -174,9 +180,11 @@ public function testArrayCallableExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( + $constraint = new Callback( + array( 'callback' => array(__CLASS__.'_Class', 'validateCallback'), - )); + ) + ); $this->validator->validate($object, $constraint); @@ -242,9 +250,11 @@ public function testLegacyMultipleMethodsBcExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( + $constraint = new Callback( + array( 'methods' => array('validate', 'validateStatic'), - )); + ) + ); $this->validator->validate($object, $constraint); @@ -262,9 +272,11 @@ public function testLegacySingleStaticMethodBc() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( + $constraint = new Callback( + array( array(__CLASS__.'_Class', 'validateCallback'), - )); + ) + ); $this->validator->validate($object, $constraint); @@ -280,9 +292,11 @@ public function testLegacySingleStaticMethodBcExplicitName() { $object = new CallbackValidatorTest_Object(); - $constraint = new Callback(array( + $constraint = new Callback( + array( 'methods' => array(array(__CLASS__.'_Class', 'validateCallback')), - )); + ) + ); $this->validator->validate($object, $constraint); @@ -319,10 +333,14 @@ { $object = new CallbackValidatorTest_Object(); - $this->validator->validate($object, new Callback(array( - 'callback' => 'validate', - 'methods' => array('validateStatic'), - ))); + $this->validator->validate( + $object, new Callback( + array( + 'callback' => 'validate', + 'methods' => array('validateStatic'), + ) + ) + ); } public function testConstraintGetTargets() --- vendor/symfony/validator/Tests/Constraints/RangeValidatorTest.php +++ PHP_CodeSniffer @@ -107,10 +107,12 @@ */ public function testInvalidValuesMin($value, $formattedValue) { - $constraint = new Range(array( + $constraint = new Range( + array( 'min' => 10, 'minMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -126,10 +128,12 @@ */ public function testInvalidValuesMax($value, $formattedValue) { - $constraint = new Range(array( + $constraint = new Range( + array( 'max' => 20, 'maxMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -145,12 +149,14 @@ */ public function testInvalidValuesCombinedMax($value, $formattedValue) { - $constraint = new Range(array( + $constraint = new Range( + array( 'min' => 10, 'max' => 20, 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -166,12 +172,14 @@ */ public function testInvalidValuesCombinedMin($value, $formattedValue) { - $constraint = new Range(array( + $constraint = new Range( + array( 'min' => 10, 'max' => 20, 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -289,10 +297,12 @@ // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this); - $constraint = new Range(array( + $constraint = new Range( + array( 'min' => 'March 10, 2014', 'minMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -312,10 +322,12 @@ // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this); - $constraint = new Range(array( + $constraint = new Range( + array( 'max' => 'March 20, 2014', 'maxMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -335,12 +347,14 @@ // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this); - $constraint = new Range(array( + $constraint = new Range( + array( 'min' => 'March 10, 2014', 'max' => 'March 20, 2014', 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -360,12 +374,14 @@ // Make sure we have the correct version loaded IntlTestHelper::requireIntl($this); - $constraint = new Range(array( + $constraint = new Range( + array( 'min' => 'March 10, 2014', 'max' => 'March 20, 2014', 'minMessage' => 'myMinMessage', 'maxMessage' => 'myMaxMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -389,11 +405,15 @@ public function testNonNumeric() { - $this->validator->validate('abcd', new Range(array( - 'min' => 10, - 'max' => 20, - 'invalidMessage' => 'myMessage', - ))); + $this->validator->validate( + 'abcd', new Range( + array( + 'min' => 10, + 'max' => 20, + 'invalidMessage' => 'myMessage', + ) + ) + ); $this->buildViolation('myMessage') ->setParameter('{{ value }}', '"abcd"') --- vendor/symfony/validator/Tests/Constraints/ExpressionValidatorTest.php +++ PHP_CodeSniffer @@ -31,10 +31,12 @@ public function testExpressionIsEvaluatedWithNullValue() { - $constraint = new Expression(array( + $constraint = new Expression( + array( 'expression' => 'false', 'message' => 'myMessage', - )); + ) + ); $this->validator->validate(null, $constraint); @@ -46,10 +48,12 @@ public function testExpressionIsEvaluatedWithEmptyStringValue() { - $constraint = new Expression(array( + $constraint = new Expression( + array( 'expression' => 'false', 'message' => 'myMessage', - )); + ) + ); $this->validator->validate('', $constraint); @@ -75,10 +79,12 @@ public function testFailingExpressionAtObjectLevel() { - $constraint = new Expression(array( + $constraint = new Expression( + array( 'expression' => 'this.data == 1', 'message' => 'myMessage', - )); + ) + ); $object = new Entity(); $object->data = '2'; @@ -111,10 +117,12 @@ public function testFailingExpressionAtPropertyLevel() { - $constraint = new Expression(array( + $constraint = new Expression( + array( 'expression' => 'value == this.data', 'message' => 'myMessage', - )); + ) + ); $object = new Entity(); $object->data = '1'; @@ -153,10 +161,12 @@ public function testFailingExpressionAtNestedPropertyLevel() { - $constraint = new Expression(array( + $constraint = new Expression( + array( 'expression' => 'value == this.data', 'message' => 'myMessage', - )); + ) + ); $object = new Entity(); $object->data = '1'; @@ -200,10 +210,12 @@ */ public function testFailingExpressionAtPropertyLevelWithoutRoot() { - $constraint = new Expression(array( + $constraint = new Expression( + array( 'expression' => 'value == "1"', 'message' => 'myMessage', - )); + ) + ); $this->setRoot('2'); $this->setPropertyPath(''); @@ -220,20 +232,26 @@ public function testExpressionLanguageUsage() { - $constraint = new Expression(array( + $constraint = new Expression( + array( 'expression' => 'false', - )); + ) + ); $expressionLanguage = $this->getMock('Symfony\Component\ExpressionLanguage\ExpressionLanguage'); $used = false; $expressionLanguage->method('evaluate') - ->will($this->returnCallback(function () use (&$used) { - $used = true; - - return true; - })); + ->will( + $this->returnCallback( + function () use (&$used) { + $used = true; + + return true; + } + ) + ); $validator = new ExpressionValidator(null, $expressionLanguage); $validator->initialize($this->createContext()); --- vendor/symfony/validator/Tests/Constraints/NotBlankValidatorTest.php +++ PHP_CodeSniffer @@ -50,9 +50,11 @@ public function testNullIsInvalid() { - $constraint = new NotBlank(array( + $constraint = new NotBlank( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate(null, $constraint); @@ -64,9 +66,11 @@ public function testBlankIsInvalid() { - $constraint = new NotBlank(array( + $constraint = new NotBlank( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate('', $constraint); @@ -78,9 +82,11 @@ public function testFalseIsInvalid() { - $constraint = new NotBlank(array( + $constraint = new NotBlank( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate(false, $constraint); @@ -92,9 +98,11 @@ public function testEmptyArrayIsInvalid() { - $constraint = new NotBlank(array( + $constraint = new NotBlank( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate(array(), $constraint); --- vendor/symfony/validator/Tests/Constraints/CountValidatorTest.php +++ PHP_CodeSniffer @@ -112,10 +112,12 @@ */ public function testTooManyValues($value) { - $constraint = new Count(array( + $constraint = new Count( + array( 'max' => 4, 'maxMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -133,10 +135,12 @@ */ public function testTooFewValues($value) { - $constraint = new Count(array( + $constraint = new Count( + array( 'min' => 4, 'minMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -154,11 +158,13 @@ */ public function testTooManyValuesExact($value) { - $constraint = new Count(array( + $constraint = new Count( + array( 'min' => 4, 'max' => 4, 'exactMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); @@ -176,11 +182,13 @@ */ public function testTooFewValuesExact($value) { - $constraint = new Count(array( + $constraint = new Count( + array( 'min' => 4, 'max' => 4, 'exactMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); --- vendor/symfony/validator/Tests/Constraints/EmailValidatorTest.php +++ PHP_CodeSniffer @@ -77,9 +77,11 @@ */ public function testInvalidEmails($email) { - $constraint = new Email(array( + $constraint = new Email( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($email, $constraint); @@ -116,10 +118,12 @@ { DnsMock::withMockedHosts(array('example.com' => array(array('type' => $violation ? false : $type)))); - $constraint = new Email(array( + $constraint = new Email( + array( 'message' => 'myMessage', 'MX' === $type ? 'checkMX' : 'checkHost' => true, - )); + ) + ); $this->validator->validate('foo@example.com', $constraint); --- vendor/symfony/validator/Tests/Constraints/CurrencyValidatorTest.php +++ PHP_CodeSniffer @@ -90,9 +90,11 @@ */ public function testInvalidCurrencies($currency) { - $constraint = new Currency(array( + $constraint = new Currency( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($currency, $constraint); --- vendor/symfony/validator/Tests/Constraints/TypeValidatorTest.php +++ PHP_CodeSniffer @@ -49,10 +49,12 @@ public function testEmptyIsInvalidIfNoString() { - $constraint = new Type(array( + $constraint = new Type( + array( 'type' => 'integer', 'message' => 'myMessage', - )); + ) + ); $this->validator->validate('', $constraint); @@ -117,10 +119,12 @@ */ public function testInvalidValues($value, $type, $valueAsString) { - $constraint = new Type(array( + $constraint = new Type( + array( 'type' => $type, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); --- vendor/symfony/validator/Tests/Constraints/DateValidatorTest.php +++ PHP_CodeSniffer @@ -80,9 +80,11 @@ */ public function testInvalidDates($date, $code) { - $constraint = new Date(array( + $constraint = new Date( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($date, $constraint); --- vendor/symfony/validator/Tests/Constraints/BicValidatorTest.php +++ PHP_CodeSniffer @@ -63,9 +63,11 @@ */ public function testInvalidBics($bic, $code) { - $constraint = new Bic(array( + $constraint = new Bic( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($bic, $constraint); --- vendor/symfony/validator/Tests/Constraints/FileValidatorTest.php +++ PHP_CodeSniffer @@ -169,10 +169,12 @@ fwrite($this->file, '0'); fclose($this->file); - $constraint = new File(array( + $constraint = new File( + array( 'maxSize' => $limit, 'maxSizeMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->getFile($this->path), $constraint); @@ -217,10 +219,12 @@ fwrite($this->file, '0'); fclose($this->file); - $constraint = new File(array( + $constraint = new File( + array( 'maxSize' => $limit, 'maxSizeMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->getFile($this->path), $constraint); @@ -232,9 +236,11 @@ */ public function testInvalidMaxSize() { - $constraint = new File(array( + $constraint = new File( + array( 'maxSize' => '1abc', - )); + ) + ); $this->validator->validate($this->path, $constraint); } @@ -270,11 +276,13 @@ fwrite($this->file, '0'); fclose($this->file); - $constraint = new File(array( + $constraint = new File( + array( 'maxSize' => $limit, 'binaryFormat' => $binaryFormat, 'maxSizeMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->getFile($this->path), $constraint); @@ -302,9 +310,11 @@ ->method('getMimeType') ->will($this->returnValue('image/jpg')); - $constraint = new File(array( + $constraint = new File( + array( 'mimeTypes' => array('image/png', 'image/jpg'), - )); + ) + ); $this->validator->validate($file, $constraint); @@ -326,9 +336,11 @@ ->method('getMimeType') ->will($this->returnValue('image/jpg')); - $constraint = new File(array( + $constraint = new File( + array( 'mimeTypes' => array('image/*'), - )); + ) + ); $this->validator->validate($file, $constraint); @@ -350,10 +362,12 @@ ->method('getMimeType') ->will($this->returnValue('application/pdf')); - $constraint = new File(array( + $constraint = new File( + array( 'mimeTypes' => array('image/png', 'image/jpg'), 'mimeTypesMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($file, $constraint); @@ -380,10 +394,12 @@ ->method('getMimeType') ->will($this->returnValue('application/pdf')); - $constraint = new File(array( + $constraint = new File( + array( 'mimeTypes' => array('image/*', 'image/jpg'), 'mimeTypesMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($file, $constraint); @@ -399,9 +415,11 @@ { ftruncate($this->file, 0); - $constraint = new File(array( + $constraint = new File( + array( 'disallowEmptyMessage' => 'myMessage', - )); + ) + ); $this->validator->validate($this->getFile($this->path), $constraint); @@ -418,10 +436,12 @@ { $file = new UploadedFile('/path/to/file', 'originalName', 'mime', 0, $error); - $constraint = new File(array( + $constraint = new File( + array( $message => 'myMessage', 'maxSize' => $maxSize, - )); + ) + ); $this->validator->validate($file, $constraint); --- vendor/symfony/validator/Tests/Constraints/BlankValidatorTest.php +++ PHP_CodeSniffer @@ -46,9 +46,11 @@ */ public function testInvalidValues($value, $valueAsString) { - $constraint = new Blank(array( + $constraint = new Blank( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); --- vendor/symfony/validator/Tests/Constraints/UrlValidatorTest.php +++ PHP_CodeSniffer @@ -135,9 +135,11 @@ */ public function testInvalidUrls($url) { - $constraint = new Url(array( + $constraint = new Url( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($url, $constraint); @@ -175,9 +177,11 @@ */ public function testCustomProtocolIsValid($url) { - $constraint = new Url(array( + $constraint = new Url( + array( 'protocols' => array('ftp', 'file', 'git'), - )); + ) + ); $this->validator->validate($url, $constraint); @@ -201,10 +205,12 @@ { DnsMock::withMockedHosts(array('example.com' => array(array('type' => $violation ? '' : 'A')))); - $constraint = new Url(array( + $constraint = new Url( + array( 'checkDNS' => true, 'dnsMessage' => 'myMessage', - )); + ) + ); $this->validator->validate('http://example.com', $constraint); --- vendor/symfony/validator/Tests/Constraints/RegexValidatorTest.php +++ PHP_CodeSniffer @@ -75,10 +75,12 @@ */ public function testInvalidValues($value) { - $constraint = new Regex(array( + $constraint = new Regex( + array( 'pattern' => '/^[0-9]+$/', 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($value, $constraint); --- vendor/symfony/validator/Tests/Constraints/CountryValidatorTest.php +++ PHP_CodeSniffer @@ -74,9 +74,11 @@ */ public function testInvalidCountries($country) { - $constraint = new Country(array( + $constraint = new Country( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($country, $constraint); --- vendor/symfony/validator/Tests/Constraints/AllTest.php +++ PHP_CodeSniffer @@ -24,9 +24,11 @@ */ public function testRejectNonConstraints() { - new All(array( + new All( + array( 'foo', - )); + ) + ); } /** @@ -34,8 +36,10 @@ */ public function testRejectValidConstraint() { - new All(array( + new All( + array( new Valid(), - )); + ) + ); } } --- vendor/symfony/validator/Tests/Constraints/UuidValidatorTest.php +++ PHP_CodeSniffer @@ -85,9 +85,11 @@ */ public function testInvalidStrictUuids($uuid, $code, $versions = null) { - $constraint = new Uuid(array( + $constraint = new Uuid( + array( 'message' => 'testMessage', - )); + ) + ); if (null !== $versions) { $constraint->versions = $versions; @@ -152,9 +154,11 @@ */ public function testValidNonStrictUuids($uuid) { - $constraint = new Uuid(array( + $constraint = new Uuid( + array( 'strict' => false, - )); + ) + ); $this->validator->validate($uuid, $constraint); @@ -183,10 +187,12 @@ */ public function testInvalidNonStrictUuids($uuid, $code) { - $constraint = new Uuid(array( + $constraint = new Uuid( + array( 'strict' => false, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($uuid, $constraint); --- vendor/symfony/validator/Tests/Constraints/LocaleValidatorTest.php +++ PHP_CodeSniffer @@ -76,9 +76,11 @@ */ public function testInvalidLocales($locale) { - $constraint = new Locale(array( + $constraint = new Locale( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($locale, $constraint); --- vendor/symfony/validator/Tests/Constraints/RegexTest.php +++ PHP_CodeSniffer @@ -65,10 +65,12 @@ */ public function testGetHtmlPattern($pattern, $htmlPattern, $match = true) { - $constraint = new Regex(array( + $constraint = new Regex( + array( 'pattern' => $pattern, 'match' => $match, - )); + ) + ); $this->assertSame($pattern, $constraint->pattern); $this->assertSame($htmlPattern, $constraint->getHtmlPattern()); @@ -76,10 +78,12 @@ public function testGetCustomHtmlPattern() { - $constraint = new Regex(array( + $constraint = new Regex( + array( 'pattern' => '((?![0-9]$|[a-z]+).)*', 'htmlPattern' => 'foobar', - )); + ) + ); $this->assertSame('((?![0-9]$|[a-z]+).)*', $constraint->pattern); $this->assertSame('foobar', $constraint->getHtmlPattern()); --- vendor/symfony/validator/Tests/Constraints/IpValidatorTest.php +++ PHP_CodeSniffer @@ -54,9 +54,11 @@ */ public function testInvalidValidatorVersion() { - new Ip(array( + new Ip( + array( 'version' => 666, - )); + ) + ); } /** @@ -64,9 +66,13 @@ */ public function testValidIpsV4($ip) { - $this->validator->validate($ip, new Ip(array( - 'version' => Ip::V4, - ))); + $this->validator->validate( + $ip, new Ip( + array( + 'version' => Ip::V4, + ) + ) + ); $this->assertNoViolation(); } @@ -90,9 +96,13 @@ */ public function testValidIpsV6($ip) { - $this->validator->validate($ip, new Ip(array( - 'version' => Ip::V6, - ))); + $this->validator->validate( + $ip, new Ip( + array( + 'version' => Ip::V6, + ) + ) + ); $this->assertNoViolation(); } @@ -127,9 +137,13 @@ */ public function testValidIpsAll($ip) { - $this->validator->validate($ip, new Ip(array( - 'version' => Ip::ALL, - ))); + $this->validator->validate( + $ip, new Ip( + array( + 'version' => Ip::ALL, + ) + ) + ); $this->assertNoViolation(); } @@ -144,10 +158,12 @@ */ public function testInvalidIpsV4($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::V4, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -177,10 +193,12 @@ */ public function testInvalidPrivateIpsV4($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::V4_NO_PRIV, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -204,10 +222,12 @@ */ public function testInvalidReservedIpsV4($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::V4_NO_RES, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -231,10 +251,12 @@ */ public function testInvalidPublicIpsV4($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::V4_ONLY_PUBLIC, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -254,10 +276,12 @@ */ public function testInvalidIpsV6($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::V6, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -291,10 +315,12 @@ */ public function testInvalidPrivateIpsV6($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::V6_NO_PRIV, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -318,10 +344,12 @@ */ public function testInvalidReservedIpsV6($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::V6_NO_RES, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -344,10 +372,12 @@ */ public function testInvalidPublicIpsV6($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::V6_ONLY_PUBLIC, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -367,10 +397,12 @@ */ public function testInvalidIpsAll($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::ALL, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -390,10 +422,12 @@ */ public function testInvalidPrivateIpsAll($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::ALL_NO_PRIV, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -413,10 +447,12 @@ */ public function testInvalidReservedIpsAll($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::ALL_NO_RES, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); @@ -436,10 +472,12 @@ */ public function testInvalidPublicIpsAll($ip) { - $constraint = new Ip(array( + $constraint = new Ip( + array( 'version' => Ip::ALL_ONLY_PUBLIC, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($ip, $constraint); --- vendor/symfony/validator/Tests/Constraints/IssnValidatorTest.php +++ PHP_CodeSniffer @@ -125,10 +125,12 @@ */ public function testCaseSensitiveIssns($issn) { - $constraint = new Issn(array( + $constraint = new Issn( + array( 'caseSensitive' => true, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($issn, $constraint); @@ -143,10 +145,12 @@ */ public function testRequireHyphenIssns($issn) { - $constraint = new Issn(array( + $constraint = new Issn( + array( 'requireHyphen' => true, 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($issn, $constraint); @@ -173,9 +177,11 @@ */ public function testInvalidIssn($issn, $code) { - $constraint = new Issn(array( + $constraint = new Issn( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($issn, $constraint); --- vendor/symfony/validator/Tests/Constraints/IsTrueValidatorTest.php +++ PHP_CodeSniffer @@ -43,9 +43,11 @@ public function testFalseIsInvalid() { - $constraint = new IsTrue(array( + $constraint = new IsTrue( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate(false, $constraint); --- vendor/symfony/validator/Tests/Constraints/LanguageValidatorTest.php +++ PHP_CodeSniffer @@ -74,9 +74,11 @@ */ public function testInvalidLanguages($language) { - $constraint = new Language(array( + $constraint = new Language( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate($language, $constraint); @@ -101,9 +103,13 @@ \Locale::setDefault('fr_FR'); $existingLanguage = 'en'; - $this->validator->validate($existingLanguage, new Language(array( - 'message' => 'aMessage', - ))); + $this->validator->validate( + $existingLanguage, new Language( + array( + 'message' => 'aMessage', + ) + ) + ); $this->assertNoViolation(); } --- vendor/symfony/validator/Tests/Constraints/IsFalseValidatorTest.php +++ PHP_CodeSniffer @@ -43,9 +43,11 @@ public function testTrueIsInvalid() { - $constraint = new IsFalse(array( + $constraint = new IsFalse( + array( 'message' => 'myMessage', - )); + ) + ); $this->validator->validate(true, $constraint); --- vendor/symfony/validator/Tests/Constraints/FileValidatorPathTest.php +++ PHP_CodeSniffer @@ -22,9 +22,11 @@ public function testFileNotFound() { - $constraint = new File(array( + $constraint = new File( + array( 'notFoundMessage' => 'myMessage', - )); + ) + ); $this->validator->validate('foobar', $constraint); --- vendor/symfony/validator/Tests/ValidatorBuilderTest.php +++ PHP_CodeSniffer @@ -33,9 +33,11 @@ public function testAddObjectInitializer() { - $this->assertSame($this->builder, $this->builder->addObjectInitializer( - $this->getMock('Symfony\Component\Validator\ObjectInitializerInterface') - )); + $this->assertSame( + $this->builder, $this->builder->addObjectInitializer( + $this->getMock('Symfony\Component\Validator\ObjectInitializerInterface') + ) + ); } public function testAddObjectInitializers() @@ -85,22 +87,28 @@ public function testSetMetadataCache() { - $this->assertSame($this->builder, $this->builder->setMetadataCache( - $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface')) + $this->assertSame( + $this->builder, $this->builder->setMetadataCache( + $this->getMock('Symfony\Component\Validator\Mapping\Cache\CacheInterface') + ) ); } public function testSetConstraintValidatorFactory() { - $this->assertSame($this->builder, $this->builder->setConstraintValidatorFactory( - $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface')) + $this->assertSame( + $this->builder, $this->builder->setConstraintValidatorFactory( + $this->getMock('Symfony\Component\Validator\ConstraintValidatorFactoryInterface') + ) ); } public function testSetTranslator() { - $this->assertSame($this->builder, $this->builder->setTranslator( - $this->getMock('Symfony\Component\Translation\TranslatorInterface')) + $this->assertSame( + $this->builder, $this->builder->setTranslator( + $this->getMock('Symfony\Component\Translation\TranslatorInterface') + ) ); } --- vendor/symfony/validator/Tests/LegacyExecutionContextTest.php +++ PHP_CodeSniffer @@ -98,16 +98,20 @@ $this->context->addViolation('Error', array('foo' => 'bar'), 'invalid'); - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array('foo' => 'bar'), - 'Root', - 'foo.bar', - 'invalid' - ), - )), $this->context->getViolations()); + $this->assertEquals( + new ConstraintViolationList( + array( + new ConstraintViolation( + 'Translated error', + 'Error', + array('foo' => 'bar'), + 'Root', + 'foo.bar', + 'invalid' + ), + ) + ), $this->context->getViolations() + ); } public function testAddViolationUsesPreconfiguredValueIfNotPassed() @@ -119,16 +123,20 @@ $this->context->addViolation('Error'); - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array(), - 'Root', - 'foo.bar', - 'currentValue' - ), - )), $this->context->getViolations()); + $this->assertEquals( + new ConstraintViolationList( + array( + new ConstraintViolation( + 'Translated error', + 'Error', + array(), + 'Root', + 'foo.bar', + 'currentValue' + ), + ) + ), $this->context->getViolations() + ); } public function testAddViolationUsesPassedNullValue() @@ -146,25 +154,29 @@ $this->context->addViolation('Error', array('foo1' => 'bar1'), null); $this->context->addViolation('Choice error', array('foo2' => 'bar2'), null, 1); - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array('foo1' => 'bar1'), - 'Root', - 'foo.bar', - null - ), - new ConstraintViolation( - 'Translated choice error', - 'Choice error', - array('foo2' => 'bar2'), - 'Root', - 'foo.bar', - null, - 1 - ), - )), $this->context->getViolations()); + $this->assertEquals( + new ConstraintViolationList( + array( + new ConstraintViolation( + 'Translated error', + 'Error', + array('foo1' => 'bar1'), + 'Root', + 'foo.bar', + null + ), + new ConstraintViolation( + 'Translated choice error', + 'Choice error', + array('foo2' => 'bar2'), + 'Root', + 'foo.bar', + null, + 1 + ), + ) + ), $this->context->getViolations() + ); } public function testAddViolationAt() @@ -177,16 +189,20 @@ // override preconfigured property path $this->context->addViolationAt('bam.baz', 'Error', array('foo' => 'bar'), 'invalid'); - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array('foo' => 'bar'), - 'Root', - 'foo.bar.bam.baz', - 'invalid' - ), - )), $this->context->getViolations()); + $this->assertEquals( + new ConstraintViolationList( + array( + new ConstraintViolation( + 'Translated error', + 'Error', + array('foo' => 'bar'), + 'Root', + 'foo.bar.bam.baz', + 'invalid' + ), + ) + ), $this->context->getViolations() + ); } public function testAddViolationAtUsesPreconfiguredValueIfNotPassed() @@ -198,16 +214,20 @@ $this->context->addViolationAt('bam.baz', 'Error'); - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array(), - 'Root', - 'foo.bar.bam.baz', - 'currentValue' - ), - )), $this->context->getViolations()); + $this->assertEquals( + new ConstraintViolationList( + array( + new ConstraintViolation( + 'Translated error', + 'Error', + array(), + 'Root', + 'foo.bar.bam.baz', + 'currentValue' + ), + ) + ), $this->context->getViolations() + ); } public function testAddViolationAtUsesPassedNullValue() @@ -225,25 +245,29 @@ $this->context->addViolationAt('bam.baz', 'Error', array('foo' => 'bar'), null); $this->context->addViolationAt('bam.baz', 'Choice error', array('foo' => 'bar'), null, 2); - $this->assertEquals(new ConstraintViolationList(array( - new ConstraintViolation( - 'Translated error', - 'Error', - array('foo' => 'bar'), - 'Root', - 'foo.bar.bam.baz', - null - ), - new ConstraintViolation( - 'Translated choice error', - 'Choice error', - array('foo' => 'bar'), - 'Root', - 'foo.bar.bam.baz', - null, - 2 - ), - )), $this->context->getViolations()); + $this->assertEquals( + new ConstraintViolationList( + array( + new ConstraintViolation( + 'Translated error', + 'Error', + array('foo' => 'bar'), + 'Root', + 'foo.bar.bam.baz', + null + ), + new ConstraintViolation( + 'Translated choice error', + 'Choice error', + array('foo' => 'bar'), + 'Root', + 'foo.bar.bam.baz', + null, + 2 + ), + ) + ), $this->context->getViolations() + ); } public function testAddViolationPluralTranslationError() @@ -283,17 +307,25 @@ public function testGetPropertyPathWithNestedCollectionsAndAllMixed() { - $constraints = new Collection(array( - 'shelves' => new All(array('constraints' => array( - new Collection(array( + $constraints = new Collection( + array( + 'shelves' => new All( + array('constraints' => array( + new Collection( + array( 'name' => new ConstraintA(), - 'books' => new All(array('constraints' => array( + 'books' => new All( + array('constraints' => array( new ConstraintA(), - ))), - )), - ))), + )) + ), + ) + ), + )) + ), 'name' => new ConstraintA(), - )); + ) + ); $data = array( 'shelves' => array( array( --- vendor/symfony/validator/Tests/Mapping/Loader/AnnotationLoaderTest.php +++ PHP_CodeSniffer @@ -59,14 +59,22 @@ $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => new Range(array('min' => 5)), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( - 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); + $expected->addPropertyConstraint( + 'firstName', new Collection( + array('fields' => array( + 'foo' => array(new NotNull(), new Range(array('min' => 3))), + 'bar' => new Range(array('min' => 5)), + )) + ) + ); + $expected->addPropertyConstraint( + 'firstName', new Choice( + array( + 'message' => 'Must be one of %choices%', + 'choices' => array('A', 'B'), + ) + ) + ); $expected->addGetterConstraint('lastName', new NotNull()); $expected->addGetterConstraint('valid', new IsTrue()); $expected->addGetterConstraint('permissions', new IsTrue()); @@ -129,14 +137,22 @@ $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => new Range(array('min' => 5)), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( - 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); + $expected->addPropertyConstraint( + 'firstName', new Collection( + array('fields' => array( + 'foo' => array(new NotNull(), new Range(array('min' => 3))), + 'bar' => new Range(array('min' => 5)), + )) + ) + ); + $expected->addPropertyConstraint( + 'firstName', new Choice( + array( + 'message' => 'Must be one of %choices%', + 'choices' => array('A', 'B'), + ) + ) + ); $expected->addGetterConstraint('lastName', new NotNull()); $expected->addGetterConstraint('valid', new IsTrue()); $expected->addGetterConstraint('permissions', new IsTrue()); --- vendor/symfony/validator/Tests/Mapping/Loader/YamlFileLoaderTest.php +++ PHP_CodeSniffer @@ -104,14 +104,22 @@ $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => array(new Range(array('min' => 5))), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( - 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); + $expected->addPropertyConstraint( + 'firstName', new Collection( + array('fields' => array( + 'foo' => array(new NotNull(), new Range(array('min' => 3))), + 'bar' => array(new Range(array('min' => 5))), + )) + ) + ); + $expected->addPropertyConstraint( + 'firstName', new Choice( + array( + 'message' => 'Must be one of %choices%', + 'choices' => array('A', 'B'), + ) + ) + ); $expected->addGetterConstraint('lastName', new NotNull()); $expected->addGetterConstraint('valid', new IsTrue()); $expected->addGetterConstraint('permissions', new IsTrue()); --- vendor/symfony/validator/Tests/Mapping/Loader/FilesLoaderTest.php +++ PHP_CodeSniffer @@ -33,12 +33,14 @@ public function getFilesLoader(LoaderInterface $loader) { - return $this->getMockForAbstractClass('Symfony\Component\Validator\Tests\Fixtures\FilesLoader', array(array( + return $this->getMockForAbstractClass( + 'Symfony\Component\Validator\Tests\Fixtures\FilesLoader', array(array( __DIR__.'/constraint-mapping.xml', __DIR__.'/constraint-mapping.yaml', __DIR__.'/constraint-mapping.test', __DIR__.'/constraint-mapping.txt', - ), $loader)); + ), $loader) + ); } public function getFileLoader() --- vendor/symfony/validator/Tests/Mapping/Loader/XmlFileLoaderTest.php +++ PHP_CodeSniffer @@ -62,14 +62,22 @@ $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); - $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( - 'foo' => array(new NotNull(), new Range(array('min' => 3))), - 'bar' => array(new Range(array('min' => 5))), - )))); - $expected->addPropertyConstraint('firstName', new Choice(array( - 'message' => 'Must be one of %choices%', - 'choices' => array('A', 'B'), - ))); + $expected->addPropertyConstraint( + 'firstName', new Collection( + array('fields' => array( + 'foo' => array(new NotNull(), new Range(array('min' => 3))), + 'bar' => array(new Range(array('min' => 5))), + )) + ) + ); + $expected->addPropertyConstraint( + 'firstName', new Choice( + array( + 'message' => 'Must be one of %choices%', + 'choices' => array('A', 'B'), + ) + ) + ); $expected->addGetterConstraint('lastName', new NotNull()); $expected->addGetterConstraint('valid', new IsTrue()); $expected->addGetterConstraint('permissions', new IsTrue()); --- vendor/symfony/validator/Tests/Mapping/Loader/LoaderChainTest.php +++ PHP_CodeSniffer @@ -22,18 +22,20 @@ $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); $loader1->expects($this->once()) - ->method('loadClassMetadata') - ->with($this->equalTo($metadata)); + ->method('loadClassMetadata') + ->with($this->equalTo($metadata)); $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); $loader2->expects($this->once()) - ->method('loadClassMetadata') - ->with($this->equalTo($metadata)); + ->method('loadClassMetadata') + ->with($this->equalTo($metadata)); - $chain = new LoaderChain(array( + $chain = new LoaderChain( + array( $loader1, $loader2, - )); + ) + ); $chain->loadClassMetadata($metadata); } @@ -44,18 +46,20 @@ $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); $loader1->expects($this->any()) - ->method('loadClassMetadata') - ->will($this->returnValue(true)); + ->method('loadClassMetadata') + ->will($this->returnValue(true)); $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); $loader2->expects($this->any()) - ->method('loadClassMetadata') - ->will($this->returnValue(false)); + ->method('loadClassMetadata') + ->will($this->returnValue(false)); - $chain = new LoaderChain(array( + $chain = new LoaderChain( + array( $loader1, $loader2, - )); + ) + ); $this->assertTrue($chain->loadClassMetadata($metadata)); } @@ -66,18 +70,20 @@ $loader1 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); $loader1->expects($this->any()) - ->method('loadClassMetadata') - ->will($this->returnValue(false)); + ->method('loadClassMetadata') + ->will($this->returnValue(false)); $loader2 = $this->getMock('Symfony\Component\Validator\Mapping\Loader\LoaderInterface'); $loader2->expects($this->any()) - ->method('loadClassMetadata') - ->will($this->returnValue(false)); + ->method('loadClassMetadata') + ->will($this->returnValue(false)); - $chain = new LoaderChain(array( + $chain = new LoaderChain( + array( $loader1, $loader2, - )); + ) + ); $this->assertFalse($chain->loadClassMetadata($metadata)); } --- vendor/symfony/validator/Tests/Mapping/Factory/LazyLoadingMetadataFactoryTest.php +++ PHP_CodeSniffer @@ -39,20 +39,26 @@ $metadata = $factory->getMetadataFor(self::CLASSNAME); $constraints = array( - new ConstraintA(array('groups' => array( + new ConstraintA( + array('groups' => array( 'Default', 'EntityParent', 'Entity', - ))), - new ConstraintA(array('groups' => array( + )) + ), + new ConstraintA( + array('groups' => array( 'Default', 'EntityInterface', 'Entity', - ))), - new ConstraintA(array('groups' => array( + )) + ), + new ConstraintA( + array('groups' => array( 'Default', 'Entity', - ))), + )) + ), ); $this->assertEquals($constraints, $metadata->getConstraints()); @@ -69,16 +75,20 @@ ); $cache->expects($this->never()) - ->method('has'); + ->method('has'); $cache->expects($this->once()) - ->method('read') - ->with($this->equalTo(self::PARENTCLASS)) - ->will($this->returnValue(false)); + ->method('read') + ->with($this->equalTo(self::PARENTCLASS)) + ->will($this->returnValue(false)); $cache->expects($this->once()) - ->method('write') - ->will($this->returnCallback(function ($metadata) use ($tester, $constraints) { - $tester->assertEquals($constraints, $metadata->getConstraints()); - })); + ->method('write') + ->will( + $this->returnCallback( + function ($metadata) use ($tester, $constraints) { + $tester->assertEquals($constraints, $metadata->getConstraints()); + } + ) + ); $metadata = $factory->getMetadataFor(self::PARENTCLASS); @@ -97,13 +107,13 @@ $metadata->addConstraint(new ConstraintA()); $loader->expects($this->never()) - ->method('loadClassMetadata'); + ->method('loadClassMetadata'); $cache->expects($this->never()) - ->method('has'); + ->method('has'); $cache->expects($this->once()) - ->method('read') - ->will($this->returnValue($metadata)); + ->method('read') + ->will($this->returnValue($metadata)); $this->assertEquals($metadata, $factory->getMetadataFor(self::PARENTCLASS)); } --- vendor/symfony/validator/Tests/Mapping/ClassMetadataTest.php +++ PHP_CodeSniffer @@ -116,15 +116,19 @@ $this->metadata->addConstraint(new ConstraintA()); $constraints = array( - new ConstraintA(array('groups' => array( + new ConstraintA( + array('groups' => array( 'Default', 'EntityParent', 'Entity', - ))), - new ConstraintA(array('groups' => array( + )) + ), + new ConstraintA( + array('groups' => array( 'Default', 'Entity', - ))), + )) + ), ); $this->assertEquals($constraints, $this->metadata->getConstraints()); @@ -139,15 +143,19 @@ $this->metadata->addPropertyConstraint('firstName', new ConstraintA()); $constraints = array( - new ConstraintA(array('groups' => array( + new ConstraintA( + array('groups' => array( 'Default', 'EntityParent', 'Entity', - ))), - new ConstraintA(array('groups' => array( + )) + ), + new ConstraintA( + array('groups' => array( 'Default', 'Entity', - ))), + )) + ), ); $members = $this->metadata->getPropertyMetadata('firstName'); @@ -174,17 +182,21 @@ $this->metadata->addPropertyConstraint('internal', new ConstraintA()); $parentConstraints = array( - new ConstraintA(array('groups' => array( + new ConstraintA( + array('groups' => array( 'Default', 'EntityParent', 'Entity', - ))), + )) + ), ); $constraints = array( - new ConstraintA(array('groups' => array( + new ConstraintA( + array('groups' => array( 'Default', 'Entity', - ))), + )) + ), ); $members = $this->metadata->getPropertyMetadata('internal'); --- vendor/symfony/validator/Tests/Resources/TranslationFilesTest.php +++ PHP_CodeSniffer @@ -24,7 +24,9 @@ public function provideTranslationFiles() { return array_map( - function ($filePath) { return (array) $filePath; }, + function ($filePath) { + return (array) $filePath; + }, glob(dirname(dirname(__DIR__)).'/Resources/translations/*.xlf') ); } --- vendor/symfony/validator/Tests/Fixtures/ConstraintA.php +++ PHP_CodeSniffer @@ -13,7 +13,9 @@ use Symfony\Component\Validator\Constraint; -/** @Annotation */ +/** + * @Annotation +*/ class ConstraintA extends Constraint { public $property1; --- vendor/symfony/validator/Tests/Fixtures/ConstraintB.php +++ PHP_CodeSniffer @@ -13,7 +13,9 @@ use Symfony\Component\Validator\Constraint; -/** @Annotation */ +/** + * @Annotation +*/ class ConstraintB extends Constraint { public function getTargets() --- vendor/symfony/validator/Tests/Fixtures/ConstraintWithValue.php +++ PHP_CodeSniffer @@ -13,7 +13,9 @@ use Symfony\Component\Validator\Constraint; -/** @Annotation */ +/** + * @Annotation +*/ class ConstraintWithValue extends Constraint { public $property; --- vendor/symfony/validator/Tests/Fixtures/ConstraintWithValueAsDefault.php +++ PHP_CodeSniffer @@ -13,7 +13,9 @@ use Symfony\Component\Validator\Constraint; -/** @Annotation */ +/** + * @Annotation +*/ class ConstraintWithValueAsDefault extends Constraint { public $property; --- vendor/symfony/validator/Tests/Fixtures/ConstraintC.php +++ PHP_CodeSniffer @@ -13,7 +13,9 @@ use Symfony\Component\Validator\Constraint; -/** @Annotation */ +/** + * @Annotation +*/ class ConstraintC extends Constraint { public $option1; --- vendor/symfony/validator/Tests/Validator/Abstract2Dot5ApiTest.php +++ PHP_CodeSniffer @@ -29,7 +29,7 @@ /** * Verifies that a validator satisfies the API of Symfony 2.5+. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ @@ -93,18 +93,31 @@ $context->addViolation('Message 2'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => function () { + }, + 'groups' => 'Group 1', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ) + ) + ); $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3')); $violations = $this->validator->validate($entity, new Valid(), $sequence); @@ -127,14 +140,22 @@ }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 1', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 2', - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group 1', + ) + ) + ); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group 2', + ) + ) + ); $sequence = new GroupSequence(array('Group 1', 'Entity')); $violations = $this->validator->validate($entity, new Valid(), $sequence); @@ -155,8 +176,7 @@ ->getValidator() // Since the validator is not context aware, the group must // be passed explicitly - ->validate($value->reference, new Valid(), 'Group') - ; + ->validate($value->reference, new Valid(), 'Group'); /* @var ConstraintViolationInterface[] $violations */ $test->assertCount(1, $violations); @@ -187,14 +207,22 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group', + ) + ) + ); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -220,8 +248,7 @@ ->getValidator() ->inContext($context) ->atPath('subpath') - ->validate($value->reference) - ; + ->validate($value->reference); // context changes shouldn't leak out of the validate() call $test->assertSame($previousValue, $context->getValue()); @@ -244,14 +271,22 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group', + ) + ) + ); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -284,8 +319,7 @@ ->getValidator() ->inContext($context) ->atPath('subpath') - ->validate(array('key' => $value->reference)) - ; + ->validate(array('key' => $value->reference)); // context changes shouldn't leak out of the validate() call $test->assertSame($previousValue, $context->getValue()); @@ -308,14 +342,22 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group', + ) + ) + ); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validator->validate($entity, new Valid(), 'Group'); @@ -351,10 +393,14 @@ }; $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -383,10 +429,14 @@ $traversableMetadata->addConstraint(new Traverse(true)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -408,10 +458,14 @@ $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($traversable, new Valid(), 'Group'); @@ -445,10 +499,14 @@ $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $this->metadata->addPropertyConstraint('reference', new Valid()); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -471,13 +529,21 @@ $traversableMetadata->addConstraint(new Traverse(false)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => true, - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); + $this->metadata->addPropertyConstraint( + 'reference', new Valid( + array( + 'traverse' => true, + ) + ) + ); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -499,13 +565,21 @@ $traversableMetadata->addConstraint(new Traverse(true)); $this->metadataFactory->addMetadata($traversableMetadata); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); + $this->metadata->addPropertyConstraint( + 'reference', new Valid( + array( + 'traverse' => false, + ) + ) + ); $violations = $this->validate($entity, new Valid(), 'Group'); @@ -607,10 +681,14 @@ $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => array('Group 1', 'Group 2'), - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => array('Group 1', 'Group 2'), + ) + ) + ); $violations = $this->validator->validate($entity, new Valid(), array('Group 1', 'Group 2')); @@ -626,10 +704,14 @@ $context->addViolation('Message'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback, - 'groups' => array('Group 1', 'Group 2'), - ))); + $this->metadata->addPropertyConstraint( + 'firstName', new Callback( + array( + 'callback' => $callback, + 'groups' => array('Group 1', 'Group 2'), + ) + ) + ); $violations = $this->validator->validate($entity, new Valid(), array('Group 1', 'Group 2')); @@ -678,18 +760,24 @@ $initializer1->expects($this->once()) ->method('initialize') ->with($entity) - ->will($this->returnCallback(function ($object) { - $object->initialized = true; - })); + ->will( + $this->returnCallback( + function ($object) { + $object->initialized = true; + } + ) + ); $initializer2->expects($this->once()) ->method('initialize') ->with($entity); - $this->validator = $this->createValidator($this->metadataFactory, array( + $this->validator = $this->createValidator( + $this->metadataFactory, array( $initializer1, $initializer2, - )); + ) + ); // prepare constraint which // * checks that "initialized" is set to true --- vendor/symfony/validator/Tests/Validator/AbstractLegacyApiTest.php +++ PHP_CodeSniffer @@ -23,10 +23,10 @@ /** * Verifies that a validator satisfies the API of Symfony < 2.5. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek - * @group legacy + * @group legacy */ abstract class AbstractLegacyApiTest extends AbstractValidatorTest { @@ -85,10 +85,14 @@ $test->fail('Should not be called'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $this->validator->validate($traversable, 'Group'); } @@ -100,18 +104,24 @@ { $test = $this; $entity = new Entity(); - $traversable = new \ArrayIterator(array( + $traversable = new \ArrayIterator( + array( 2 => new \ArrayIterator(array('key' => $entity)), - )); + ) + ); $callback = function () use ($test) { $test->fail('Should not be called'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $this->validator->validate($traversable, 'Group'); } @@ -151,14 +161,22 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group', + ) + ) + ); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validator->validate($entity, 'Group'); @@ -209,14 +227,22 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group', + ) + ) + ); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validator->validate($entity, 'Group'); @@ -275,18 +301,24 @@ $initializer1->expects($this->once()) ->method('initialize') ->with($entity) - ->will($this->returnCallback(function ($object) { - $object->initialized = true; - })); + ->will( + $this->returnCallback( + function ($object) { + $object->initialized = true; + } + ) + ); $initializer2->expects($this->once()) ->method('initialize') ->with($entity); - $this->validator = $this->createValidator($this->metadataFactory, array( + $this->validator = $this->createValidator( + $this->metadataFactory, array( $initializer1, $initializer2, - )); + ) + ); // prepare constraint which // * checks that "initialized" is set to true --- vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php +++ PHP_CodeSniffer @@ -86,10 +86,12 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $constraint = new Callback(array( + $constraint = new Callback( + array( 'callback' => $callback, 'groups' => 'Group', - )); + ) + ); $violations = $this->validate('Bernhard', $constraint, 'Group'); @@ -123,10 +125,14 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -163,10 +169,14 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addPropertyConstraint( + 'firstName', new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -203,10 +213,14 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addGetterConstraint('lastName', new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addGetterConstraint( + 'lastName', new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -241,10 +255,14 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($array, null, 'Group'); @@ -279,10 +297,14 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($array, null, 'Group'); @@ -317,10 +339,14 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($traversable, null, 'Group'); @@ -340,9 +366,11 @@ { $test = $this; $entity = new Entity(); - $traversable = new \ArrayIterator(array( + $traversable = new \ArrayIterator( + array( 2 => new \ArrayIterator(array('key' => $entity)), - )); + ) + ); $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity, $traversable) { $test->assertSame($test::ENTITY_CLASS, $context->getClassName()); @@ -357,10 +385,14 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($traversable, null, 'Group'); @@ -396,10 +428,14 @@ }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -438,10 +474,14 @@ }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addPropertyConstraint('value', new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->referenceMetadata->addPropertyConstraint( + 'value', new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -480,10 +520,14 @@ }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addPropertyConstraint('privateValue', new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->referenceMetadata->addPropertyConstraint( + 'privateValue', new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -545,10 +589,14 @@ }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -585,10 +633,14 @@ }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -613,9 +665,13 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); + $this->metadata->addPropertyConstraint( + 'reference', new Valid( + array( + 'traverse' => false, + ) + ) + ); $this->referenceMetadata->addConstraint(new Callback($callback)); $violations = $this->validate($entity); @@ -633,9 +689,13 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); + $this->metadata->addPropertyConstraint( + 'reference', new Valid( + array( + 'traverse' => false, + ) + ) + ); $this->referenceMetadata->addConstraint(new Callback($callback)); $violations = $this->validate($entity); @@ -690,10 +750,14 @@ }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -719,9 +783,13 @@ }; $this->metadataFactory->addMetadata(new ClassMetadata('ArrayIterator')); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); + $this->metadata->addPropertyConstraint( + 'reference', new Valid( + array( + 'traverse' => false, + ) + ) + ); $this->referenceMetadata->addConstraint(new Callback($callback)); $violations = $this->validate($entity); @@ -738,9 +806,13 @@ $entity = new Entity(); $entity->reference = new \ArrayIterator(); - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => false, - ))); + $this->metadata->addPropertyConstraint( + 'reference', new Valid( + array( + 'traverse' => false, + ) + ) + ); $this->validate($entity); } @@ -749,9 +821,11 @@ { $test = $this; $entity = new Entity(); - $entity->reference = new \ArrayIterator(array( + $entity->reference = new \ArrayIterator( + array( 2 => new \ArrayIterator(array('key' => new Reference())), - )); + ) + ); $callback = function ($value, ExecutionContextInterface $context) use ($test, $entity) { $test->assertSame($test::REFERENCE_CLASS, $context->getClassName()); @@ -766,13 +840,21 @@ $context->addViolation('Message %param%', array('%param%' => 'value')); }; - $this->metadata->addPropertyConstraint('reference', new Valid(array( - 'traverse' => true, - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group', - ))); + $this->metadata->addPropertyConstraint( + 'reference', new Valid( + array( + 'traverse' => true, + ) + ) + ); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validate($entity, null, 'Group'); @@ -814,14 +896,22 @@ $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); + $this->metadata->addPropertyConstraint( + 'firstName', new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group', + ) + ) + ); + $this->metadata->addPropertyConstraint( + 'lastName', new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validateProperty($entity, 'firstName', 'Group'); @@ -841,7 +931,7 @@ * Cannot be UnsupportedMetadataException for BC with Symfony < 2.5. * * @expectedException \Symfony\Component\Validator\Exception\ValidatorException - * @group legacy + * @group legacy */ public function testLegacyValidatePropertyFailsIfPropertiesNotSupported() { @@ -889,14 +979,22 @@ $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); + $this->metadata->addPropertyConstraint( + 'firstName', new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group', + ) + ) + ); + $this->metadata->addPropertyConstraint( + 'lastName', new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validatePropertyValue( $entity, @@ -940,14 +1038,22 @@ $context->addViolation('Other violation'); }; - $this->metadata->addPropertyConstraint('firstName', new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group', - ))); - $this->metadata->addPropertyConstraint('lastName', new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group', - ))); + $this->metadata->addPropertyConstraint( + 'firstName', new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group', + ) + ) + ); + $this->metadata->addPropertyConstraint( + 'lastName', new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group', + ) + ) + ); $violations = $this->validatePropertyValue( self::ENTITY_CLASS, @@ -972,7 +1078,7 @@ * Cannot be UnsupportedMetadataException for BC with Symfony < 2.5. * * @expectedException \Symfony\Component\Validator\Exception\ValidatorException - * @group legacy + * @group legacy */ public function testLegacyValidatePropertyValueFailsIfPropertiesNotSupported() { @@ -1043,14 +1149,22 @@ $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group 2', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group 1', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group 2', + ) + ) + ); $violations = $this->validate($entity, null, 'Group 2'); @@ -1066,14 +1180,22 @@ $context->addViolation('Message'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback, - 'groups' => 'Group 2', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group 1', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback, + 'groups' => 'Group 2', + ) + ) + ); $violations = $this->validate($entity, null, array('Group 1', 'Group 2')); @@ -1092,18 +1214,31 @@ $context->addViolation('Violation in Group 3'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => function () { + }, + 'groups' => 'Group 1', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ) + ) + ); $sequence = new GroupSequence(array('Group 1', 'Group 2', 'Group 3', 'Entity')); $this->metadata->setGroupSequence($sequence); @@ -1126,18 +1261,31 @@ $context->addViolation('Violation in Group 3'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => function () { + }, + 'groups' => 'Group 1', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ) + ) + ); $sequence = array('Group 1', 'Group 2', 'Group 3', 'Entity'); $this->metadata->setGroupSequence($sequence); @@ -1162,14 +1310,22 @@ }; $this->metadata->addPropertyConstraint('reference', new Valid()); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Default', - ))); - $this->referenceMetadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 1', - ))); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Default', + ) + ) + ); + $this->referenceMetadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group 1', + ) + ) + ); $sequence = new GroupSequence(array('Group 1', 'Entity')); $this->metadata->setGroupSequence($sequence); @@ -1192,14 +1348,22 @@ $context->addViolation('Violation in group sequence'); }; - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Other Group', - ))); - $this->metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 1', - ))); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Other Group', + ) + ) + ); + $this->metadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group 1', + ) + ) + ); $sequence = new GroupSequence(array('Group 1', 'Entity')); $this->metadata->setGroupSequence($sequence); @@ -1224,18 +1388,31 @@ }; $metadata = new ClassMetadata(get_class($entity)); - $metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); + $metadata->addConstraint( + new Callback( + array( + 'callback' => function () { + }, + 'groups' => 'Group 1', + ) + ) + ); + $metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ) + ) + ); + $metadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ) + ) + ); $metadata->setGroupSequenceProvider(true); $this->metadataFactory->addMetadata($metadata); @@ -1260,18 +1437,31 @@ }; $metadata = new ClassMetadata(get_class($entity)); - $metadata->addConstraint(new Callback(array( - 'callback' => function () {}, - 'groups' => 'Group 1', - ))); - $metadata->addConstraint(new Callback(array( - 'callback' => $callback1, - 'groups' => 'Group 2', - ))); - $metadata->addConstraint(new Callback(array( - 'callback' => $callback2, - 'groups' => 'Group 3', - ))); + $metadata->addConstraint( + new Callback( + array( + 'callback' => function () { + }, + 'groups' => 'Group 1', + ) + ) + ); + $metadata->addConstraint( + new Callback( + array( + 'callback' => $callback1, + 'groups' => 'Group 2', + ) + ) + ); + $metadata->addConstraint( + new Callback( + array( + 'callback' => $callback2, + 'groups' => 'Group 3', + ) + ) + ); $metadata->setGroupSequenceProvider(true); $this->metadataFactory->addMetadata($metadata); --- vendor/symfony/validator/Constraints/Iban.php +++ PHP_CodeSniffer @@ -23,11 +23,15 @@ */ class Iban extends Constraint { - /** @deprecated, to be removed in 3.0. */ + /** + * @deprecated, to be removed in 3.0. +*/ const TOO_SHORT_ERROR = '88e5e319-0aeb-4979-a27e-3d9ce0c16166'; const INVALID_COUNTRY_CODE_ERROR = 'de78ee2c-bd50-44e2-aec8-3d8228aeadb9'; const INVALID_CHARACTERS_ERROR = '8d3d85e4-784f-4719-a5bc-d9e40d45a3a5'; - /** @deprecated, to be removed in 3.0. */ + /** + * @deprecated, to be removed in 3.0. +*/ const INVALID_CASE_ERROR = 'f4bf62fe-03ec-42af-a53b-68e21b1e7274'; const CHECKSUM_FAILED_ERROR = 'b9401321-f9bf-4dcb-83c1-f31094440795'; const INVALID_FORMAT_ERROR = 'c8d318f1-2ecc-41ba-b983-df70d225cf5a'; --- vendor/symfony/validator/Constraints/IpValidator.php +++ PHP_CodeSniffer @@ -44,53 +44,53 @@ $value = (string) $value; switch ($constraint->version) { - case Ip::V4: - $flag = FILTER_FLAG_IPV4; - break; - - case Ip::V6: - $flag = FILTER_FLAG_IPV6; - break; - - case Ip::V4_NO_PRIV: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE; - break; - - case Ip::V6_NO_PRIV: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE; - break; - - case Ip::ALL_NO_PRIV: - $flag = FILTER_FLAG_NO_PRIV_RANGE; - break; - - case Ip::V4_NO_RES: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::V6_NO_RES: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::ALL_NO_RES: - $flag = FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::V4_ONLY_PUBLIC: - $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::V6_ONLY_PUBLIC: - $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; - break; - - case Ip::ALL_ONLY_PUBLIC: - $flag = FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; - break; - - default: - $flag = null; - break; + case Ip::V4: + $flag = FILTER_FLAG_IPV4; + break; + + case Ip::V6: + $flag = FILTER_FLAG_IPV6; + break; + + case Ip::V4_NO_PRIV: + $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::V6_NO_PRIV: + $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::ALL_NO_PRIV: + $flag = FILTER_FLAG_NO_PRIV_RANGE; + break; + + case Ip::V4_NO_RES: + $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V6_NO_RES: + $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::ALL_NO_RES: + $flag = FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V4_ONLY_PUBLIC: + $flag = FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::V6_ONLY_PUBLIC: + $flag = FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + break; + + case Ip::ALL_ONLY_PUBLIC: + $flag = FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE; + break; + + default: + $flag = null; + break; } if (!filter_var($value, FILTER_VALIDATE_IP, $flag)) { --- vendor/symfony/validator/Constraints/Valid.php +++ PHP_CodeSniffer @@ -32,10 +32,12 @@ public function __construct($options = null) { if (is_array($options) && array_key_exists('groups', $options)) { - throw new ConstraintDefinitionException(sprintf( - 'The option "groups" is not supported by the constraint %s', - __CLASS__ - )); + throw new ConstraintDefinitionException( + sprintf( + 'The option "groups" is not supported by the constraint %s', + __CLASS__ + ) + ); } if (is_array($options) && array_key_exists('deep', $options)) { --- vendor/symfony/validator/Constraints/FileValidator.php +++ PHP_CodeSniffer @@ -51,116 +51,116 @@ if ($value instanceof UploadedFile && !$value->isValid()) { switch ($value->getError()) { - case UPLOAD_ERR_INI_SIZE: - $iniLimitSize = UploadedFile::getMaxFilesize(); - if ($constraint->maxSize && $constraint->maxSize < $iniLimitSize) { - $limitInBytes = $constraint->maxSize; - $binaryFormat = $constraint->binaryFormat; - } else { - $limitInBytes = $iniLimitSize; - $binaryFormat = true; - } + case UPLOAD_ERR_INI_SIZE: + $iniLimitSize = UploadedFile::getMaxFilesize(); + if ($constraint->maxSize && $constraint->maxSize < $iniLimitSize) { + $limitInBytes = $constraint->maxSize; + $binaryFormat = $constraint->binaryFormat; + } else { + $limitInBytes = $iniLimitSize; + $binaryFormat = true; + } - list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->uploadIniSizeErrorMessage) - ->setParameter('{{ limit }}', $limitAsString) - ->setParameter('{{ suffix }}', $suffix) - ->setCode(UPLOAD_ERR_INI_SIZE) - ->addViolation(); - } else { - $this->buildViolation($constraint->uploadIniSizeErrorMessage) - ->setParameter('{{ limit }}', $limitAsString) - ->setParameter('{{ suffix }}', $suffix) - ->setCode(UPLOAD_ERR_INI_SIZE) - ->addViolation(); - } + list($sizeAsString, $limitAsString, $suffix) = $this->factorizeSizes(0, $limitInBytes, $binaryFormat); + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadIniSizeErrorMessage) + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setCode(UPLOAD_ERR_INI_SIZE) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadIniSizeErrorMessage) + ->setParameter('{{ limit }}', $limitAsString) + ->setParameter('{{ suffix }}', $suffix) + ->setCode(UPLOAD_ERR_INI_SIZE) + ->addViolation(); + } - return; - case UPLOAD_ERR_FORM_SIZE: - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->uploadFormSizeErrorMessage) - ->setCode(UPLOAD_ERR_FORM_SIZE) - ->addViolation(); - } else { - $this->buildViolation($constraint->uploadFormSizeErrorMessage) - ->setCode(UPLOAD_ERR_FORM_SIZE) - ->addViolation(); - } + return; + case UPLOAD_ERR_FORM_SIZE: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadFormSizeErrorMessage) + ->setCode(UPLOAD_ERR_FORM_SIZE) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadFormSizeErrorMessage) + ->setCode(UPLOAD_ERR_FORM_SIZE) + ->addViolation(); + } - return; - case UPLOAD_ERR_PARTIAL: - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->uploadPartialErrorMessage) - ->setCode(UPLOAD_ERR_PARTIAL) - ->addViolation(); - } else { - $this->buildViolation($constraint->uploadPartialErrorMessage) - ->setCode(UPLOAD_ERR_PARTIAL) - ->addViolation(); - } + return; + case UPLOAD_ERR_PARTIAL: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadPartialErrorMessage) + ->setCode(UPLOAD_ERR_PARTIAL) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadPartialErrorMessage) + ->setCode(UPLOAD_ERR_PARTIAL) + ->addViolation(); + } - return; - case UPLOAD_ERR_NO_FILE: - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->uploadNoFileErrorMessage) - ->setCode(UPLOAD_ERR_NO_FILE) - ->addViolation(); - } else { - $this->buildViolation($constraint->uploadNoFileErrorMessage) - ->setCode(UPLOAD_ERR_NO_FILE) - ->addViolation(); - } + return; + case UPLOAD_ERR_NO_FILE: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadNoFileErrorMessage) + ->setCode(UPLOAD_ERR_NO_FILE) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadNoFileErrorMessage) + ->setCode(UPLOAD_ERR_NO_FILE) + ->addViolation(); + } - return; - case UPLOAD_ERR_NO_TMP_DIR: - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->uploadNoTmpDirErrorMessage) - ->setCode(UPLOAD_ERR_NO_TMP_DIR) - ->addViolation(); - } else { - $this->buildViolation($constraint->uploadNoTmpDirErrorMessage) - ->setCode(UPLOAD_ERR_NO_TMP_DIR) - ->addViolation(); - } + return; + case UPLOAD_ERR_NO_TMP_DIR: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadNoTmpDirErrorMessage) + ->setCode(UPLOAD_ERR_NO_TMP_DIR) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadNoTmpDirErrorMessage) + ->setCode(UPLOAD_ERR_NO_TMP_DIR) + ->addViolation(); + } - return; - case UPLOAD_ERR_CANT_WRITE: - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->uploadCantWriteErrorMessage) - ->setCode(UPLOAD_ERR_CANT_WRITE) - ->addViolation(); - } else { - $this->buildViolation($constraint->uploadCantWriteErrorMessage) - ->setCode(UPLOAD_ERR_CANT_WRITE) - ->addViolation(); - } + return; + case UPLOAD_ERR_CANT_WRITE: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadCantWriteErrorMessage) + ->setCode(UPLOAD_ERR_CANT_WRITE) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadCantWriteErrorMessage) + ->setCode(UPLOAD_ERR_CANT_WRITE) + ->addViolation(); + } - return; - case UPLOAD_ERR_EXTENSION: - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->uploadExtensionErrorMessage) - ->setCode(UPLOAD_ERR_EXTENSION) - ->addViolation(); - } else { - $this->buildViolation($constraint->uploadExtensionErrorMessage) - ->setCode(UPLOAD_ERR_EXTENSION) - ->addViolation(); - } + return; + case UPLOAD_ERR_EXTENSION: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadExtensionErrorMessage) + ->setCode(UPLOAD_ERR_EXTENSION) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadExtensionErrorMessage) + ->setCode(UPLOAD_ERR_EXTENSION) + ->addViolation(); + } - return; - default: - if ($this->context instanceof ExecutionContextInterface) { - $this->context->buildViolation($constraint->uploadErrorMessage) - ->setCode($value->getError()) - ->addViolation(); - } else { - $this->buildViolation($constraint->uploadErrorMessage) - ->setCode($value->getError()) - ->addViolation(); - } + return; + default: + if ($this->context instanceof ExecutionContextInterface) { + $this->context->buildViolation($constraint->uploadErrorMessage) + ->setCode($value->getError()) + ->addViolation(); + } else { + $this->buildViolation($constraint->uploadErrorMessage) + ->setCode($value->getError()) + ->addViolation(); + } - return; + return; } } --- vendor/symfony/validator/Constraints/ImageValidator.php +++ PHP_CodeSniffer @@ -47,7 +47,8 @@ if (null === $constraint->minWidth && null === $constraint->maxWidth && null === $constraint->minHeight && null === $constraint->maxHeight && null === $constraint->minRatio && null === $constraint->maxRatio - && $constraint->allowSquare && $constraint->allowLandscape && $constraint->allowPortrait) { + && $constraint->allowSquare && $constraint->allowLandscape && $constraint->allowPortrait + ) { return; } --- vendor/symfony/validator/Constraints/LuhnValidator.php +++ PHP_CodeSniffer @@ -22,7 +22,7 @@ * For a list of example card numbers that are used to test this * class, please see the LuhnValidatorTest class. * - * @see http://en.wikipedia.org/wiki/Luhn_algorithm + * @see http://en.wikipedia.org/wiki/Luhn_algorithm * * @author Tim Nagel * @author Greg Knapp http://gregk.me/2011/php-implementation-of-bank-card-luhn-algorithm/ --- vendor/symfony/validator/Constraints/Collection.php +++ PHP_CodeSniffer @@ -42,7 +42,8 @@ { // no known options set? $options is the fields array if (is_array($options) - && !array_intersect(array_keys($options), array('groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage'))) { + && !array_intersect(array_keys($options), array('groups', 'fields', 'allowExtraFields', 'allowMissingFields', 'extraFieldsMessage', 'missingFieldsMessage')) + ) { $options = array('fields' => $options); } --- vendor/symfony/validator/Constraints/AbstractComparison.php +++ PHP_CodeSniffer @@ -31,10 +31,12 @@ public function __construct($options = null) { if (is_array($options) && !isset($options['value'])) { - throw new ConstraintDefinitionException(sprintf( - 'The %s constraint requires the "value" option to be set.', - get_class($this) - )); + throw new ConstraintDefinitionException( + sprintf( + 'The %s constraint requires the "value" option to be set.', + get_class($this) + ) + ); } parent::__construct($options); --- vendor/symfony/validator/Constraints/GroupSequence.php +++ PHP_CodeSniffer @@ -99,7 +99,7 @@ * * @return \Traversable The iterator * - * @see \IteratorAggregate::getIterator() + * @see \IteratorAggregate::getIterator() * @deprecated since version 2.5, to be removed in 3.0. */ public function getIterator() @@ -145,10 +145,12 @@ @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); if (!isset($this->groups[$offset])) { - throw new OutOfBoundsException(sprintf( - 'The offset "%s" does not exist.', - $offset - )); + throw new OutOfBoundsException( + sprintf( + 'The offset "%s" does not exist.', + $offset + ) + ); } return $this->groups[$offset]; --- vendor/symfony/validator/Constraints/Traverse.php +++ PHP_CodeSniffer @@ -28,10 +28,12 @@ public function __construct($options = null) { if (is_array($options) && array_key_exists('groups', $options)) { - throw new ConstraintDefinitionException(sprintf( - 'The option "groups" is not supported by the constraint %s', - __CLASS__ - )); + throw new ConstraintDefinitionException( + sprintf( + 'The option "groups" is not supported by the constraint %s', + __CLASS__ + ) + ); } parent::__construct($options); --- vendor/symfony/validator/Constraints/UuidValidator.php +++ PHP_CodeSniffer @@ -232,20 +232,20 @@ if ($i !== $h) { if ($this->context instanceof ExecutionContextInterface) { $this->context->buildViolation($constraint->message) - ->setParameter( - '{{ value }}', - $this->formatValue($value) - ) - ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) - ->addViolation(); + ->setParameter( + '{{ value }}', + $this->formatValue($value) + ) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); } else { $this->buildViolation($constraint->message) - ->setParameter( - '{{ value }}', - $this->formatValue($value) - ) - ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) - ->addViolation(); + ->setParameter( + '{{ value }}', + $this->formatValue($value) + ) + ->setCode(Uuid::INVALID_HYPHEN_PLACEMENT_ERROR) + ->addViolation(); } return; --- vendor/symfony/validator/Constraints/Composite.php +++ PHP_CodeSniffer @@ -24,7 +24,7 @@ * let {@link getCompositeOption()} return the name of the property which * contains the nested constraints. * - * @since 2.6 + * @since 2.6 * * @author Bernhard Schussek */ @@ -97,13 +97,15 @@ $excessGroups = array_diff($constraint->groups, $this->groups); if (count($excessGroups) > 0) { - throw new ConstraintDefinitionException(sprintf( - 'The group(s) "%s" passed to the constraint %s '. - 'should also be passed to its containing constraint %s', - implode('", "', $excessGroups), - get_class($constraint), - get_class($this) - )); + throw new ConstraintDefinitionException( + sprintf( + 'The group(s) "%s" passed to the constraint %s '. + 'should also be passed to its containing constraint %s', + implode('", "', $excessGroups), + get_class($constraint), + get_class($this) + ) + ); } } else { $constraint->groups = $this->groups; @@ -124,7 +126,9 @@ { parent::addImplicitGroupName($group); - /** @var Constraint[] $nestedConstraints */ + /** + * @var Constraint[] $nestedConstraints +*/ $nestedConstraints = $this->{$this->getCompositeOption()}; foreach ($nestedConstraints as $constraint) { --- vendor/symfony/validator/Constraint.php +++ PHP_CodeSniffer @@ -78,11 +78,13 @@ public static function getErrorName($errorCode) { if (!isset(static::$errorNames[$errorCode])) { - throw new InvalidArgumentException(sprintf( - 'The error code "%s" does not exist for constraint of type "%s".', - $errorCode, - get_called_class() - )); + throw new InvalidArgumentException( + sprintf( + 'The error code "%s" does not exist for constraint of type "%s".', + $errorCode, + get_called_class() + ) + ); } return static::$errorNames[$errorCode]; --- vendor/symfony/validator/Mapping/ClassMetadataInterface.php +++ PHP_CodeSniffer @@ -24,7 +24,7 @@ * by a group sequence for that class and whether instances of that class * should be traversed or not. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * --- vendor/symfony/validator/Mapping/TraversalStrategy.php +++ PHP_CodeSniffer @@ -23,7 +23,7 @@ * * The traversal strategy is ignored for arrays. Arrays are always iterated. * - * @since 2.1 + * @since 2.1 * * @author Bernhard Schussek * --- vendor/symfony/validator/Mapping/PropertyMetadataInterface.php +++ PHP_CodeSniffer @@ -24,7 +24,7 @@ * should be validated against their class' metadata and whether traversable * objects should be traversed or not. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * --- vendor/symfony/validator/Mapping/GenericMetadata.php +++ PHP_CodeSniffer @@ -23,7 +23,7 @@ * * This class supports serialization and cloning. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ @@ -131,11 +131,13 @@ public function addConstraint(Constraint $constraint) { if ($constraint instanceof Traverse) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" can only be put on classes. Please use '. - '"Symfony\Component\Validator\Constraints\Valid" instead.', - get_class($constraint) - )); + throw new ConstraintDefinitionException( + sprintf( + 'The constraint "%s" can only be put on classes. Please use '. + '"Symfony\Component\Validator\Constraints\Valid" instead.', + get_class($constraint) + ) + ); } if ($constraint instanceof Valid) { --- vendor/symfony/validator/Mapping/MemberMetadata.php +++ PHP_CodeSniffer @@ -97,10 +97,12 @@ public function addConstraint(Constraint $constraint) { if (!in_array(Constraint::PROPERTY_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint %s cannot be put on properties or getters', - get_class($constraint) - )); + throw new ConstraintDefinitionException( + sprintf( + 'The constraint %s cannot be put on properties or getters', + get_class($constraint) + ) + ); } parent::addConstraint($constraint); @@ -113,11 +115,13 @@ */ public function __sleep() { - return array_merge(parent::__sleep(), array( + return array_merge( + parent::__sleep(), array( 'class', 'name', 'property', - )); + ) + ); } /** --- vendor/symfony/validator/Mapping/Loader/StaticMethodLoader.php +++ PHP_CodeSniffer @@ -43,7 +43,9 @@ */ public function loadClassMetadata(ClassMetadata $metadata) { - /** @var \ReflectionClass $reflClass */ + /** + * @var \ReflectionClass $reflClass +*/ $reflClass = $metadata->getReflectionClass(); if (!$reflClass->isInterface() && $reflClass->hasMethod($this->methodName)) { --- vendor/symfony/validator/Mapping/MetadataInterface.php +++ PHP_CodeSniffer @@ -24,7 +24,7 @@ * against their class' metadata and whether traversable objects should be * traversed or not. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * --- vendor/symfony/validator/Mapping/ClassMetadata.php +++ PHP_CodeSniffer @@ -136,7 +136,8 @@ @trigger_error('The '.__METHOD__.' method is deprecated since version 2.5 and will be removed in 3.0.', E_USER_DEPRECATED); if (null === $propagatedGroup && Constraint::DEFAULT_GROUP === $group - && ($this->hasGroupSequence() || $this->isGroupSequenceProvider())) { + && ($this->hasGroupSequence() || $this->isGroupSequenceProvider()) + ) { if ($this->hasGroupSequence()) { $groups = $this->getGroupSequence()->groups; } else { @@ -177,7 +178,8 @@ // Don't store the cascading strategy. Classes never cascade. unset($parentProperties[array_search('cascadingStrategy', $parentProperties)]); - return array_merge($parentProperties, array( + return array_merge( + $parentProperties, array( 'getters', 'groupSequence', 'groupSequenceProvider', @@ -185,7 +187,8 @@ 'name', 'properties', 'defaultGroup', - )); + ) + ); } /** @@ -222,17 +225,21 @@ public function addConstraint(Constraint $constraint) { if (!in_array(Constraint::CLASS_CONSTRAINT, (array) $constraint->getTargets())) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" cannot be put on classes.', - get_class($constraint) - )); + throw new ConstraintDefinitionException( + sprintf( + 'The constraint "%s" cannot be put on classes.', + get_class($constraint) + ) + ); } if ($constraint instanceof Valid) { - throw new ConstraintDefinitionException(sprintf( - 'The constraint "%s" cannot be put on classes.', - get_class($constraint) - )); + throw new ConstraintDefinitionException( + sprintf( + 'The constraint "%s" cannot be put on classes.', + get_class($constraint) + ) + ); } if ($constraint instanceof Traverse) { --- vendor/symfony/validator/Mapping/CascadingStrategy.php +++ PHP_CodeSniffer @@ -27,7 +27,7 @@ * Although the constants currently represent a boolean switch, they are * implemented as bit mask in order to allow future extensions. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * --- vendor/symfony/validator/Mapping/Factory/MetadataFactoryInterface.php +++ PHP_CodeSniffer @@ -16,7 +16,7 @@ /** * Returns {@link \Symfony\Component\Validator\Mapping\MetadataInterface} instances for values. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ --- vendor/symfony/validator/ValidatorBuilderInterface.php +++ PHP_CodeSniffer @@ -178,8 +178,8 @@ * * @return ValidatorBuilderInterface The builder object * - * @see Validation::API_VERSION_2_5 - * @see Validation::API_VERSION_2_5_BC + * @see Validation::API_VERSION_2_5 + * @see Validation::API_VERSION_2_5_BC * @deprecated since version 2.7, to be removed in 3.0. */ public function setApiVersion($apiVersion); --- vendor/symfony/validator/Util/PropertyPath.php +++ PHP_CodeSniffer @@ -16,7 +16,7 @@ * * For more extensive functionality, use Symfony's PropertyAccess component. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ --- vendor/symfony/validator/ExecutionContext.php +++ PHP_CodeSniffer @@ -104,17 +104,19 @@ } } - $this->globalContext->getViolations()->add(new ConstraintViolation( - $translatedMessage, - $message, - $params, - $this->globalContext->getRoot(), - $this->propertyPath, - // check using func_num_args() to allow passing null values - func_num_args() >= 3 ? $invalidValue : $this->value, - $plural, - $code - )); + $this->globalContext->getViolations()->add( + new ConstraintViolation( + $translatedMessage, + $message, + $params, + $this->globalContext->getRoot(), + $this->propertyPath, + // check using func_num_args() to allow passing null values + func_num_args() >= 3 ? $invalidValue : $this->value, + $plural, + $code + ) + ); } /** @@ -122,19 +124,21 @@ */ public function addViolationAt($subPath, $message, array $parameters = array(), $invalidValue = null, $plural = null, $code = null) { - $this->globalContext->getViolations()->add(new ConstraintViolation( - null === $plural + $this->globalContext->getViolations()->add( + new ConstraintViolation( + null === $plural ? $this->translator->trans($message, $parameters, $this->translationDomain) : $this->translator->transChoice($message, $plural, $parameters, $this->translationDomain), - $message, - $parameters, - $this->globalContext->getRoot(), - $this->getPropertyPath($subPath), - // check using func_num_args() to allow passing null values - func_num_args() >= 4 ? $invalidValue : $this->value, - $plural, - $code - )); + $message, + $parameters, + $this->globalContext->getRoot(), + $this->getPropertyPath($subPath), + // check using func_num_args() to allow passing null values + func_num_args() >= 4 ? $invalidValue : $this->value, + $plural, + $code + ) + ); } /** --- vendor/symfony/validator/ConstraintViolationInterface.php +++ PHP_CodeSniffer @@ -59,7 +59,7 @@ * @return array A possibly empty list of parameters indexed by the names * that appear in the message template. * - * @see getMessageTemplate() + * @see getMessageTemplate() * @deprecated since version 2.7, to be replaced by getParameters() in 3.0. */ public function getMessageParameters(); --- vendor/symfony/validator/Validator/LegacyValidator.php +++ PHP_CodeSniffer @@ -16,12 +16,12 @@ /** * A validator that supports both the API of Symfony < 2.5 and Symfony 2.5+. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek * - * @see \Symfony\Component\Validator\ValidatorInterface - * @see \Symfony\Component\Validator\Validator\ValidatorInterface + * @see \Symfony\Component\Validator\ValidatorInterface + * @see \Symfony\Component\Validator\Validator\ValidatorInterface * @deprecated since version 2.5, to be removed in 3.0. */ class LegacyValidator extends RecursiveValidator --- vendor/symfony/validator/Validator/ContextualValidatorInterface.php +++ PHP_CodeSniffer @@ -17,7 +17,7 @@ /** * A validator in a specific execution context. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ --- vendor/symfony/validator/Validator/RecursiveContextualValidator.php +++ PHP_CodeSniffer @@ -33,7 +33,7 @@ /** * Recursive implementation of {@link ContextualValidatorInterface}. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ @@ -177,11 +177,13 @@ return $this; } - throw new RuntimeException(sprintf( - 'Cannot validate values of type "%s" automatically. Please '. - 'provide a constraint.', - gettype($value) - )); + throw new RuntimeException( + sprintf( + 'Cannot validate values of type "%s" automatically. Please '. + 'provide a constraint.', + gettype($value) + ) + ); } /** @@ -194,12 +196,14 @@ if (!$classMetadata instanceof ClassMetadataInterface) { // Cannot be UnsupportedMetadataException because of BC with // Symfony < 2.5 - throw new ValidatorException(sprintf( - 'The metadata factory should return instances of '. - '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) - )); + throw new ValidatorException( + sprintf( + 'The metadata factory should return instances of '. + '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. + 'got: "%s".', + is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) + ) + ); } $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); @@ -245,12 +249,14 @@ if (!$classMetadata instanceof ClassMetadataInterface) { // Cannot be UnsupportedMetadataException because of BC with // Symfony < 2.5 - throw new ValidatorException(sprintf( - 'The metadata factory should return instances of '. - '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) - )); + throw new ValidatorException( + sprintf( + 'The metadata factory should return instances of '. + '"\Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. + 'got: "%s".', + is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) + ) + ); } $propertyMetadatas = $classMetadata->getPropertyMetadata($propertyName); @@ -345,12 +351,14 @@ $classMetadata = $this->metadataFactory->getMetadataFor($object); if (!$classMetadata instanceof ClassMetadataInterface) { - throw new UnsupportedMetadataException(sprintf( - 'The metadata factory should return instances of '. - '"Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. - 'got: "%s".', - is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) - )); + throw new UnsupportedMetadataException( + sprintf( + 'The metadata factory should return instances of '. + '"Symfony\Component\Validator\Mapping\ClassMetadataInterface", '. + 'got: "%s".', + is_object($classMetadata) ? get_class($classMetadata) : gettype($classMetadata) + ) + ); } $this->validateClassNode( @@ -552,15 +560,15 @@ // group sequence and abort if necessary (G1, G2) if ($group instanceof GroupSequence) { $this->stepThroughGroupSequence( - $object, - $object, - $cacheKey, - $metadata, - $propertyPath, - $traversalStrategy, - $group, - $defaultOverridden ? Constraint::DEFAULT_GROUP : null, - $context + $object, + $object, + $cacheKey, + $metadata, + $propertyPath, + $traversalStrategy, + $group, + $defaultOverridden ? Constraint::DEFAULT_GROUP : null, + $context ); // Skip the group sequence when validating properties, because @@ -586,12 +594,14 @@ // returns two metadata objects, not just one foreach ($metadata->getPropertyMetadata($propertyName) as $propertyMetadata) { if (!$propertyMetadata instanceof PropertyMetadataInterface) { - throw new UnsupportedMetadataException(sprintf( - 'The property metadata instances should implement '. - '"Symfony\Component\Validator\Mapping\PropertyMetadataInterface", '. - 'got: "%s".', - is_object($propertyMetadata) ? get_class($propertyMetadata) : gettype($propertyMetadata) - )); + throw new UnsupportedMetadataException( + sprintf( + 'The property metadata instances should implement '. + '"Symfony\Component\Validator\Mapping\PropertyMetadataInterface", '. + 'got: "%s".', + is_object($propertyMetadata) ? get_class($propertyMetadata) : gettype($propertyMetadata) + ) + ); } $propertyValue = $propertyMetadata->getPropertyValue($object); @@ -632,11 +642,13 @@ if (!$object instanceof \Traversable) { // Must throw a ConstraintDefinitionException for backwards // compatibility reasons with Symfony < 2.5 - throw new ConstraintDefinitionException(sprintf( - 'Traversal was enabled for "%s", but this class '. - 'does not implement "\Traversable".', - get_class($object) - )); + throw new ConstraintDefinitionException( + sprintf( + 'Traversal was enabled for "%s", but this class '. + 'does not implement "\Traversable".', + get_class($object) + ) + ); } $this->validateEachObjectIn( @@ -690,15 +702,15 @@ foreach ($groups as $key => $group) { if ($group instanceof GroupSequence) { $this->stepThroughGroupSequence( - $value, - $object, - $cacheKey, - $metadata, - $propertyPath, - $traversalStrategy, - $group, - null, - $context + $value, + $object, + $cacheKey, + $metadata, + $propertyPath, + $traversalStrategy, + $group, + null, + $context ); // Skip the group sequence when cascading, as the cascading @@ -808,26 +820,26 @@ if ($metadata instanceof ClassMetadataInterface) { $this->validateClassNode( - $value, - $cacheKey, - $metadata, - $propertyPath, - $groups, - $cascadedGroups, - $traversalStrategy, - $context + $value, + $cacheKey, + $metadata, + $propertyPath, + $groups, + $cascadedGroups, + $traversalStrategy, + $context ); } else { $this->validateGenericNode( - $value, - $object, - $cacheKey, - $metadata, - $propertyPath, - $groups, - $cascadedGroups, - $traversalStrategy, - $context + $value, + $object, + $cacheKey, + $metadata, + $propertyPath, + $groups, + $cascadedGroups, + $traversalStrategy, + $context ); } --- vendor/symfony/validator/Validator/ValidatorInterface.php +++ PHP_CodeSniffer @@ -19,7 +19,7 @@ /** * Validates PHP values against constraints. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ --- vendor/symfony/validator/Validator/RecursiveValidator.php +++ PHP_CodeSniffer @@ -24,7 +24,7 @@ /** * Recursive implementation of {@link ValidatorInterface}. * - * @since 2.5 + * @since 2.5 * * @author Bernhard Schussek */ --- vendor/symfony/stopwatch/Tests/StopwatchTest.php +++ PHP_CodeSniffer @@ -62,8 +62,7 @@ $stopwatchMockEvent = $this->getMockBuilder('Symfony\Component\Stopwatch\StopwatchEvent') ->setConstructorArgs(array(microtime(true) * 1000)) - ->getMock() - ; + ->getMock(); $events->setValue(end($section), array('foo' => $stopwatchMockEvent)); --- vendor/symfony/yaml/Dumper.php +++ PHP_CodeSniffer @@ -100,7 +100,8 @@ $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value); - $output .= sprintf('%s%s%s%s', + $output .= sprintf( + '%s%s%s%s', $prefix, $isAHash ? Inline::dump($key, $flags).':' : '-', $willBeInlined ? ' ' : "\n", --- vendor/symfony/yaml/Tests/ParserTest.php +++ PHP_CodeSniffer @@ -637,7 +637,8 @@ */ public function testMultipleDocumentsNotSupportedException() { - Yaml::parse(<<<'EOL' + Yaml::parse( + <<<'EOL' # Ranking of 1998 home runs --- - Mark McGwire @@ -657,7 +658,8 @@ */ public function testSequenceInAMapping() { - Yaml::parse(<<<'EOF' + Yaml::parse( + <<<'EOF' yaml: hash: me - array stuff @@ -717,7 +719,8 @@ */ public function testMappingInASequence() { - Yaml::parse(<<<'EOF' + Yaml::parse( + <<<'EOF' yaml: - array stuff hash: me @@ -731,7 +734,8 @@ */ public function testScalarInSequence() { - Yaml::parse(<<assertEquals(array( + $this->assertEquals( + array( 'services' => array( 'app.foo_service' => array( 'class' => 'Foo', @@ -802,7 +807,8 @@ 'class' => 'Bar', ), ), - ), Yaml::parse(<<<'EOF' + ), Yaml::parse( + <<<'EOF' # comment 1 services: # comment 2 @@ -814,12 +820,14 @@ app/bar_service: class: Bar EOF - )); + ) + ); } public function testStringBlockWithComments() { - $this->assertEquals(array('content' => <<<'EOT' + $this->assertEquals( + array('content' => <<<'EOT' # comment 1 header @@ -830,7 +838,8 @@ footer # comment3 EOT - ), Yaml::parse(<<<'EOF' + ), Yaml::parse( + <<<'EOF' content: | # comment 1 header @@ -842,12 +851,14 @@ footer # comment3 EOF - )); + ) + ); } public function testFoldedStringBlockWithComments() { - $this->assertEquals(array(array('content' => <<<'EOT' + $this->assertEquals( + array(array('content' => <<<'EOT' # comment 1 header @@ -858,7 +869,8 @@ footer # comment3 EOT - )), Yaml::parse(<<<'EOF' + )), Yaml::parse( + <<<'EOF' - content: | # comment 1 @@ -871,12 +883,14 @@ footer # comment3 EOF - )); + ) + ); } public function testNestedFoldedStringBlockWithComments() { - $this->assertEquals(array(array( + $this->assertEquals( + array(array( 'title' => 'some title', 'content' => <<<'EOT' # comment 1 @@ -889,7 +903,8 @@ footer # comment3 EOT - )), Yaml::parse(<<<'EOF' + )), Yaml::parse( + <<<'EOF' - title: some title content: | @@ -903,12 +918,14 @@ footer # comment3 EOF - )); + ) + ); } public function testReferenceResolvingInInlineStrings() { - $this->assertEquals(array( + $this->assertEquals( + array( 'var' => 'var-value', 'scalar' => 'var-value', 'list' => array('var-value'), @@ -918,7 +935,8 @@ 'map' => array('key' => 'var-value'), 'list_in_map' => array('key' => array('var-value')), 'map_in_map' => array('foo' => array('bar' => 'var-value')), - ), Yaml::parse(<<<'EOF' + ), Yaml::parse( + <<<'EOF' var: &var var-value scalar: *var list: [ *var ] @@ -929,7 +947,8 @@ list_in_map: { key: [*var] } map_in_map: { foo: { bar: *var } } EOF - )); + ) + ); } public function testYamlDirective() @@ -1188,13 +1207,13 @@ data: !!binary | SGVsbG8gd29ybGQ= EOT - ), + ), 'containing spaces in block scalar' => array( <<