bug73746.phpt 722 B

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