<?php declare(strict_types=1); class Foo { public function out(string $msg) { print __CLASS__ . ': ' . $msg . PHP_EOL; } } class Msg { public function __toString() { return "world"; } } class Bar extends Foo { public function out($msg) { print __CLASS__ . ': ' . $msg . PHP_EOL; } } $f = new Foo(); try { $f->out('hello'); } catch (TypeError $e) { print $e->getMessage() . PHP_EOL; } try { $f->out(new Msg()); } catch (TypeError $e) { print $e->getMessage() . PHP_EOL; } $b = new Bar(); try { $b->out('hello'); } catch (TypeError $e) { print $e->getMessage() . PHP_EOL; } try { $b->out(new Msg()); } catch (TypeError $e) { print $e->getMessage() . PHP_EOL; }
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`