Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/__tests__/xhpast/tostring-exception.lint-test
<?php | <?php | ||||
class MyClass { | class MyClass { | ||||
public function __toString() { | public function __toString() { | ||||
if (some_function()) { | if (some_function()) { | ||||
throw new Exception('Oops'); | throw new Exception('Oops'); | ||||
} | } | ||||
return __CLASS__; | return __CLASS__; | ||||
} | } | ||||
} | } | ||||
class MyOtherClass { | class MyOtherClass { | ||||
public function __toString() { | public function __toString() { | ||||
return 'Success'; | return 'Success'; | ||||
} | } | ||||
} | } | ||||
interface SomeInterface { | interface SomeInterface { | ||||
public function __toString(); | public function __toString(); | ||||
} | } | ||||
abstract class SomeAbstractClass { | abstract class SomeAbstractClass { | ||||
abstract public function __toString(); | abstract public function __toString(); | ||||
} | } | ||||
~~~~~~~~~~ | ~~~~~~~~~~ | ||||
error:5:7 | error:6:7 |