-
-
Notifications
You must be signed in to change notification settings - Fork 91
Open
Description
PSR says:
But the following code raises no issue:
$x = match (1) {
1,2,3 => 'asdas',
default => 5
};Demonstrated by:
[root@b8a7f7560dfb html]# ./vendor/bin/phpcs sniff_match.php
FILE: /var/www/html/sniff_match.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
8 | ERROR | [x] Expected at least 1 space before "."; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Time: 46ms; Memory: 4MB
[root@b8a7f7560dfb html]# cat sniff_match.php
<?php
$x = match (1) {
1,2,3 => 'asdas',
default => 5
};
$a = '1'. '2';
[root@b8a7f7560dfb html]# ./vendor/bin/phpcs --version
PHP_CodeSniffer version 4.0.1 (stable) by Squiz and PHPCSStandards
[root@b8a7f7560dfb html]# php --version
PHP 8.3.30 (cli) (built: Jan 13 2026 22:36:55) (NTS gcc aarch64)
Copyright (c) The PHP Group
Zend Engine v4.3.30, Copyright (c) Zend Technologies
with Zend OPcache v8.3.30, Copyright (c), by Zend Technologies
with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans
Reactions are currently unavailable