[php-src] Issue #13278: Void can only be used as a standalone
| From: | SVGAnimate | Date: | Tue, 30 Jan 2024 17:53:32 +0000 |
| Subject: | [php-src] Issue #13278: Void can only be used as a standalone | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246367@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13278
Author: SVGAnimate
### Description
The following code is valid:
```php
<?php
function zoo() {}
function foo():void {}
```
The same behavior exists for `
never`
The following code:
```php
<?php
function foo(void) {}
foo();
```
Resulted in this output:
```
Parse error: syntax error, unexpected token ")", expecting variable
```
But I expected this output instead:
```
```
Since this code is valide in c :
```c
void foo(void *a) {}
```
I expecte this code is valide :
```PHP
function foo(void $a) {}// Fatal error: void cannot be used as a parameter type
```
Also :
```php
<?php
function foo(int|void $a) {}// Fatal error: Void can only be used as a standalone type
```
Is there an RFC about parameters who accept a mixed value or an optional value ?
### PHP Version
PHP 8.1.12
### Operating System
_No response_