diff --git a/tests/AttributesCoercionModeTest.php b/tests/AttributesCoercionModeTest.php index c80ad17a..013dfaf8 100644 --- a/tests/AttributesCoercionModeTest.php +++ b/tests/AttributesCoercionModeTest.php @@ -61,6 +61,7 @@ public function testIntishStringAsInt(): void { expect(() ==> { XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION); /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -69,6 +70,7 @@ public function testFloatAsInt(): void { expect(() ==> { XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION); /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -77,6 +79,7 @@ public function testIntAsFloat(): void { expect(() ==> { XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION); /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -85,6 +88,7 @@ public function testIntAsString(): void { expect(() ==> { XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION); /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -93,6 +97,7 @@ public function testIntAsBool(): void { expect(() ==> { XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION); /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -101,6 +106,7 @@ public function testStringAsBool(): void { expect(() ==> { XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::THROW_EXCEPTION); /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -109,6 +115,7 @@ public function testSilentCoercion(): void { error_reporting(E_ALL); XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::SILENT); /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; expect($x->:mystring)->toBeSame('2'); } @@ -120,6 +127,7 @@ public function testLoggingDeprecationCoercion(): void { XHPAttributeCoercion::SetMode(XHPAttributeCoercionMode::LOG_DEPRECATION); try { /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; } catch (Exception $e) { $exception = $e; @@ -128,6 +136,7 @@ public function testLoggingDeprecationCoercion(): void { error_reporting(E_ALL & ~E_USER_DEPRECATED); /* HH_IGNORE_ERROR[4110] testing behavior for incorrect types */ + /* HH_IGNORE_ERROR[4343] testing behavior for incorrect types */ $x = ; expect($x->:mystring)->toBeSame('2'); } diff --git a/tests/AttributesTest.php b/tests/AttributesTest.php index 7e502c08..6faa3aae 100644 --- a/tests/AttributesTest.php +++ b/tests/AttributesTest.php @@ -98,6 +98,7 @@ public function testShapeWithExtraKey(): void { $x = 'herp', 'bar' => 'derp', 'baz' => 'extra')} />; @@ -130,7 +131,7 @@ public function testValidArrayKeys(): void { public function testInvalidArrayKeys(): void { expect(() ==> { - $x = ; + $x = ; $x->toString(); })->toThrow(XHPInvalidAttributeException::class); } @@ -144,7 +145,7 @@ public function testValidNum(): void { public function testInvalidNum(): void { expect(() ==> { - $x = ; + $x = ; $x->toString(); })->toThrow(XHPInvalidAttributeException::class); } @@ -155,12 +156,14 @@ public function testNoAttributes(): void { public function testStringableObjectAsString(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:mystring)->toBeSame('StringableTestClass'); } public function testIntegerAsString(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:mystring)->toBeSame('123'); } @@ -169,31 +172,34 @@ public function testUnstringableObjectAsString(): void { expect(() ==> { $x = ; })->toThrow(XHPInvalidAttributeException::class); } public function testArrayAsString(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); } public function testIntishStringAsInt(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:myint)->toBeSame(123); } public function testFloatAsInt(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:myint)->toBeSame(1); } public function testFloatishStringAsInt(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:myint)->toBeSame(1); } @@ -202,45 +208,47 @@ public function testObjectAsInt(): void { expect(() ==> { $x = ; })->toThrow(XHPInvalidAttributeException::class); } public function testArrayAsInt(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); } public function testNumericPrefixStringAsInt(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); } public function testTrueStringAsBool(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:mybool)->toBeSame(true); } public function testFalseStringAsBool(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:mybool)->toBeSame(false); } public function testMixedCaseFalseStringAsBool(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); // 'False' is actually truthy } public function testNoStringAsBool(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); // 'No' is actually truthy } @@ -248,6 +256,7 @@ public function testNoStringAsBool(): void { public function testAttrNameAsBool(): void { // idiomatic - eg checked="checked" /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:mybool)->toBeSame(true); } @@ -260,28 +269,31 @@ public function testInvalidEnumValue(): void { public function testIntAsFloat(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:myfloat)->toBeSame(123.0); } public function testNumericStringsAsFloats(): void { /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:myfloat)->toBeSame(123.0); /* HH_IGNORE_ERROR[4110] */ + /* HH_IGNORE_ERROR[4343] */ $x = ; expect($x->:myfloat)->toBeSame(1.23); } public function testNonNumericStringAsFloat(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); } public function testNumericPrefixStringAsFloat(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -289,7 +301,7 @@ public function testNotAContainerAsArray(): void { expect(() ==> { $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -298,7 +310,7 @@ public function testHackContainerAsArray(): void { expect(() ==> { $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -307,14 +319,14 @@ public function testIncompatibleObjectAsObject(): void { expect(() ==> { $x = ; })->toThrow(XHPInvalidAttributeException::class); } public function testPassingArrayAsVector(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); } @@ -380,6 +392,7 @@ public function testRenderCallableAttribute(): void { $x = ; diff --git a/tests/HackEnumAttributesTest.php b/tests/HackEnumAttributesTest.php index 7893cb9a..35ffe0c0 100644 --- a/tests/HackEnumAttributesTest.php +++ b/tests/HackEnumAttributesTest.php @@ -41,15 +41,15 @@ public function testValidValues(): void { public function testValidRawValues(): void { // UNSAFE - $x = ; + $x = ; expect($x->toString())->toBeSame('
HERP
'); - $x = ; + $x = ; expect($x->toString())->toBeSame('
DERP
'); } public function testInvalidValue(): void { expect(() ==> { - $x = ; + $x = ; })->toThrow(XHPInvalidAttributeException::class); } }