xref: /PHP-8.1/ext/opcache/tests/bug73746.phpt (revision e9f783fc)
1--TEST--
2Bug #73746 (Method that returns string returns UNKNOWN:0 instead)
3--EXTENSIONS--
4opcache
5--FILE--
6<?php
7namespace Core\Bundle\Service\Property\Room\Rooms;
8
9class CountryMapping
10{
11    const CZ = 'CZ';
12    const EN = 'EN';
13
14    public function get(string $countryIsoCode = null) : string // Works correctly if return type is removed
15    {
16        switch (strtoupper($countryIsoCode)) {
17        case 'CZ':
18        case 'SK':
19            return self::CZ; // Works correctly if changed to CountryMapping::CZ
20        default:
21            return self::EN; // Works correctly if changed to CountryMapping::EN
22        }
23    }
24}
25
26$mapping = new CountryMapping();
27var_dump($mapping->get('CZ'));
28?>
29--EXPECT--
30string(2) "CZ"
31