File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,8 +47,14 @@ public function getType(): Type
4747 {
4848 if ($ this ->type === null ) {
4949 $ phpDocType = $ this ->phpDocType ;
50- if ($ phpDocType !== null && $ this ->reflection ->isDefaultValueAvailable () && $ this ->reflection ->getDefaultValue () === null ) {
51- $ phpDocType = \PHPStan \Type \TypeCombinator::addNull ($ phpDocType );
50+ if ($ phpDocType !== null ) {
51+ try {
52+ if ($ this ->reflection ->isDefaultValueAvailable () && $ this ->reflection ->getDefaultValue () === null ) {
53+ $ phpDocType = \PHPStan \Type \TypeCombinator::addNull ($ phpDocType );
54+ }
55+ } catch (\Throwable $ e ) {
56+ // pass
57+ }
5258 }
5359
5460 $ this ->type = TypehintHelper::decideTypeFromReflection (
@@ -99,14 +105,13 @@ public function getNativeType(): Type
99105
100106 public function getDefaultValue (): ?Type
101107 {
102- if ( $ this -> reflection -> isDefaultValueAvailable ()) {
103- try {
108+ try {
109+ if ( $ this -> reflection -> isDefaultValueAvailable ()) {
104110 $ defaultValue = $ this ->reflection ->getDefaultValue ();
105- } catch (\Throwable $ e ) {
106- return null ;
111+ return ConstantTypeHelper::getTypeFromValue ($ defaultValue );
107112 }
108-
109- return ConstantTypeHelper:: getTypeFromValue ( $ defaultValue ) ;
113+ } catch ( \ Throwable $ e ) {
114+ return null ;
110115 }
111116
112117 return null ;
You can’t perform that action at this time.
0 commit comments