This repository was archived by the owner on Jul 8, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +28
-10
lines changed Expand file tree Collapse file tree 4 files changed +28
-10
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,6 @@ matrix:
3131 group : edge
3232 fast_finish : true
3333 allow_failures :
34- - php : 7.1
3534 - php : nightly
3635 - php : hhvm-nightly
3736
Original file line number Diff line number Diff line change 11# Phony changelog
22
3+ ## Next release
4+
5+ - ** [ FIXED] ** Fixed nullable return type support for newer PHP 7.1 release
6+ candidates ([ #206 ] ).
7+
8+ [ #206 ] : https://github.com/eloquent/phony/issues/206
9+
310## 0.14.1 (2016-11-04)
411
512- ** [ FIXED] ** Checking for nullable type support no longer causes fatal errors
Original file line number Diff line number Diff line change @@ -289,7 +289,11 @@ public static function ${returnsReference}__callStatic(
289289 $ isBuiltin = $ isBuiltin && false === strpos ($ typeString , '\\' );
290290 // @codeCoverageIgnoreEnd
291291 } else {
292- $ typeString = (string ) $ type ;
292+ if ($ type ->allowsNull ()) {
293+ $ typeString = '? ' . $ type ; // @codeCoverageIgnore
294+ } else {
295+ $ typeString = (string ) $ type ;
296+ }
293297 }
294298
295299 if ($ isBuiltin ) {
@@ -488,7 +492,11 @@ private function generateMethods($methods)
488492 $ isBuiltin && false === strpos ($ typeString , '\\' );
489493 // @codeCoverageIgnoreEnd
490494 } else {
491- $ typeString = (string ) $ type ;
495+ if ($ type ->allowsNull ()) {
496+ $ typeString = '? ' . $ type ; // @codeCoverageIgnore
497+ } else {
498+ $ typeString = (string ) $ type ;
499+ }
492500 }
493501
494502 if ($ isBuiltin ) {
@@ -681,7 +689,11 @@ public function ${returnsReference}__call(
681689 $ isBuiltin = $ isBuiltin && false === strpos ($ typeString , '\\' );
682690 // @codeCoverageIgnoreEnd
683691 } else {
684- $ typeString = (string ) $ type ;
692+ if ($ type ->allowsNull ()) {
693+ $ typeString = '? ' . $ type ; // @codeCoverageIgnore
694+ } else {
695+ $ typeString = (string ) $ type ;
696+ }
685697 }
686698
687699 if ($ isBuiltin ) {
Original file line number Diff line number Diff line change 1515
1616interface TestInterfaceWithNullableTypes
1717{
18- public function staticMethodA (? string $ string , ?stdClass $ object ) : ?TestClassA ;
19- public function staticMethodB () : ?int ;
20- public function methodA (? string $ string , ?stdClass $ object ) : ?TestClassA ;
21- public function methodB () : ?int ;
18+ public function staticMethodA ( ? string $ string , ? stdClass $ object ) : ? TestClassA ;
19+ public function staticMethodB () : ? int ;
20+ public function methodA ( ? string $ string , ? stdClass $ object ) : ? TestClassA ;
21+ public function methodB () : ? int ;
2222
23- public function __call ($ name , array $ arguments ) : ?int ;
24- public static function __callStatic ($ name , array $ arguments ) : ?int ;
23+ public function __call ($ name , array $ arguments ) : ? int ;
24+ public static function __callStatic ($ name , array $ arguments ) : ? int ;
2525}
You can’t perform that action at this time.
0 commit comments