diff --git a/Library/Stubs/Generator.php b/Library/Stubs/Generator.php index 2719b3ebe9..c7c08b2e34 100644 --- a/Library/Stubs/Generator.php +++ b/Library/Stubs/Generator.php @@ -348,7 +348,10 @@ protected function buildMethod(ClassMethod $method, bool $isInterface, string $i if ($supported > 1) { $return = ''; } + } elseif (version_compare(PHP_VERSION, '7.1.0', '>=') && $method->isVoid()) { + $return = 'void'; } + if (!empty($return)) { $return = ': '.$return; } diff --git a/tests/fixtures/stubs/issues/expected/Issue_1900.zep.php b/tests/fixtures/stubs/issues/expected/Issue_1900.zep.php index e3ef77abe2..16fbb38605 100644 --- a/tests/fixtures/stubs/issues/expected/Issue_1900.zep.php +++ b/tests/fixtures/stubs/issues/expected/Issue_1900.zep.php @@ -49,7 +49,7 @@ public function test01(): \StdClass * @param int $priority * @return void */ - public function attach(string $eventType, $handler, int $priority = 1) + public function attach(string $eventType, $handler, int $priority = 1): void { } @@ -71,7 +71,7 @@ public function arePrioritiesEnabled(): bool * @param mixed $handler * @return void */ - public function collectResponses(bool $collect, string $eventType, $handler) + public function collectResponses(bool $collect, string $eventType, $handler): void { } diff --git a/tests/fixtures/stubs/issues/expected/Issue_1900_PHP70.zep.php b/tests/fixtures/stubs/issues/expected/Issue_1900_PHP70.zep.php new file mode 100644 index 0000000000..e3ef77abe2 --- /dev/null +++ b/tests/fixtures/stubs/issues/expected/Issue_1900_PHP70.zep.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class Issue_1900 implements AliasedManagerInterface +{ + + public $eventsManager; + + /** + * @var array $collect - descr for collect var. + */ + private $collect; + + + static protected $uniqueId = 0; + + + /** + * @return AliasedManagerInterface + */ + public function getEventsManager(): AliasedManagerInterface + { + } + + /** + * @return \StdClass + */ + public function test01(): \StdClass + { + } + + /** + * Attach a listener to the events manager + * + * @param object|callable $handler + * @param string $eventType + * @param int $priority + * @return void + */ + public function attach(string $eventType, $handler, int $priority = 1) + { + } + + /** + * Returns if priorities are enabled + * + * @return bool + */ + public function arePrioritiesEnabled(): bool + { + } + + /** + * Tells the event manager if it needs to collect all the responses returned + * by every registered listener in a single fire + * + * @param bool $collect + * @param string $eventType + * @param mixed $handler + * @return void + */ + public function collectResponses(bool $collect, string $eventType, $handler) + { + } + + /** + * Fires an event in the events manager causing the active listeners to be + * notified about it + * + * ```php + * $eventsManager->fire("db", $connection); + * ``` + * + * @param object $source + * @param mixed $data + * @return mixed + * @param string $eventType + * @param bool $cancelable + */ + public function fire(string $eventType, $source, $data = null, bool $cancelable = true) + { + } + + /** + * Internal handler to call a queue of events + * + * @return mixed + * @param SplPriorityQueue $queue + * @param \Psr\Http\Message\RequestInterface $event + */ + final public function fireQueue(SplPriorityQueue $queue, \Psr\Http\Message\RequestInterface $event): AliasedManagerInterface + { + } + + /** + * Returns all the attached listeners of a certain type + * + * @param string $type + * @return array + */ + public function getListeners(string $type): array + { + } + + /** + * @return resource + */ + public function getResources() + { + } + + /** + * Check whether certain type of event has listeners + * + * @param string $type + * @return AliasedManagerInterface + */ + public function hasListeners(string $type): AliasedManagerInterface + { + } + +} diff --git a/tests/fixtures/stubs/issues/expected/Issue_1986.zep.php b/tests/fixtures/stubs/issues/expected/Issue_1986.zep.php index 052dd6bb9a..ec985bae58 100644 --- a/tests/fixtures/stubs/issues/expected/Issue_1986.zep.php +++ b/tests/fixtures/stubs/issues/expected/Issue_1986.zep.php @@ -24,7 +24,7 @@ public function getEventsManager(): EventsManagerInterface * @param string $eventType * @return void */ - public function attach(string $eventType, $handler) + public function attach(string $eventType, $handler): void { } diff --git a/tests/fixtures/stubs/issues/expected/Issue_1986_PHP70.zep.php b/tests/fixtures/stubs/issues/expected/Issue_1986_PHP70.zep.php new file mode 100644 index 0000000000..052dd6bb9a --- /dev/null +++ b/tests/fixtures/stubs/issues/expected/Issue_1986_PHP70.zep.php @@ -0,0 +1,31 @@ +