-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MethodExtensions class-name is case-insensitive #2562
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Bug9714; | ||
|
||
use function PHPStan\Testing\assertType; | ||
|
||
class ExampleClass | ||
{ | ||
public function exampleFunction(): void | ||
{ | ||
$xml = new \SimpleXmlElement(''); | ||
$elements = $xml->xpath('//data'); | ||
assertType('array<SimpleXmlElement>', $elements); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,6 @@ | |
|
||
$returnType = $closure->call($newThis, new class {}); | ||
assertType('true', $returnType); | ||
|
||
$staticallyBoundClosureCaseInsensitive = \closure::bind($closure, $newThis); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test DynamicStaticMethodReturnTypeExtension |
||
assertType('Closure(object): true', $staticallyBoundClosureCaseInsensitive); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,4 +95,9 @@ public function dateTimeZoneDoesThrows(string $tz): void | |
new \DateTimeZone($tz); | ||
} | ||
|
||
public function dateTimeZoneDoesNotThrowCaseInsensitive(): void | ||
{ | ||
new \DaTetImezOnE('UTC'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test DynamicStaticMethodThrowTypeExtension |
||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -544,3 +544,35 @@ public function doBar(string $s) | |
} | ||
|
||
} | ||
|
||
class TestCaseInsensitiveClassNames | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there was no exisiting bug to fix for the throw-type-extension case.. but adding test coverage can not hurt tests DynamicMethodThrowTypeExtension |
||
{ | ||
|
||
public function doFoo(): void | ||
{ | ||
try { | ||
new \SimpleXmlElement('<?xml version="1.0" encoding="UTF-8"?><root></root>'); | ||
} catch (\Exception $e) { | ||
|
||
} | ||
} | ||
|
||
public function doBar(): void | ||
{ | ||
try { | ||
new \SimpleXmlElement('foo'); | ||
} catch (\Exception $e) { | ||
|
||
} | ||
} | ||
|
||
public function doBaz(string $string): void | ||
{ | ||
try { | ||
new \SimpleXmlElement($string); | ||
} catch (\Exception $e) { | ||
|
||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test DynamicMethodReturnTypeExtension-case