silviofs Posted September 20 Report Share Posted September 20 (edited) Já tentei de tudo ao executar o programa aparece o seguinte: syntax erro, unexpected ':', expecting ')' o script e o seguinte: $exception = new Exception( $throwable - > getMessage(), $throwable - > getCode(), $throwable ); Edited September 20 by silviofs Quote Link to comment Share on other sites More sharing options...
0 Frank K Hosaka Posted September 20 Report Share Posted September 20 Você não pode usar espaço entre a classe e o método: o correto é <?php use PHPUnit\Framework\TestCase; class ExceptionTest extends TestCase { public function testCreateException() { $throwable = new Exception('Test exception', 123); $exception = new Exception( $throwable->getMessage(), $throwable->getCode(), $throwable ); $this->assertEquals('Test exception', $exception->getMessage()); $this->assertEquals(123, $exception->getCode()); $this->assertSame($throwable, $exception->getPrevious()); } } Quote Link to comment Share on other sites More sharing options...
0 silviofs Posted September 23 Author Report Share Posted September 23 (edited) Obrigado, Frank. Mas não resolveu. Então Vou por o script completo, so coloquei onde estava dando problema abaixo: Edited September 23 by silviofs Quote Link to comment Share on other sites More sharing options...
0 Frank K Hosaka Posted September 24 Report Share Posted September 24 Você esqueceu de colocar o script completo. Aqui um exemplo de como você pode expor o problema: Parse error: syntax error, unexpected token "?" in C:\wamp64\www\Astudy\index.php on line 28 File: index.php 01: <?php 02: class Teste 03: { 04: function comecarDeNovo() 05: { 06: ?> 07: <p> 08: <form method=post action=index.php> 09: <input type=submit value='Começar de novo'> 10: </form> 11: <?php 12: exit; 13: } 14: function inicio() 15: { 16: ?> 17: conteúdo do $_GET : 18: <?=var_dump($_GET)?> 19: conteúdo do $_POST : 20: <?=var_dump($_POST)?> 21: <?php 22: return $this->comecarDeNovo(); 23: } 24: 25: function mensagem($problema) 26: { 27: 28: Rota <?=json_encode($problema)?> inválida! 29: <?php 30: return $this->comecarDeNovo(); 31: } 32: function naoFazerNada() 33: { 34: 35: } 36: 37: } 38: spl_autoload_register(fn ($class) => 39: require str_replace('\\', DIRECTORY_SEPARATOR, strtolower($class)) . '.php'); 40: $rota='Teste_naoFazerNada'; 41: if($_GET) 42: { 43: if(strpos(key($_GET),"_")==0) 44: { 45: return (new Teste)->mensagem($_GET); 46: } 47: $rota=isset($_GET) ? key($_GET) : $rota; 48: } 49: $segmentos=explode('_',$rota); 50: $nomeControle=$segmentos[0]; 51: $metodo=$segmentos[1]; 52: $parametro=$segmentos[2] ?? null; 53: $controle=new $nomeControle(); 54: $controle->$metodo($parametro); 55: ?> 56: <form method=post action=?teste.inicio> 57: <input type=submit name=bacalhau value=Teste> 58: <input type=hidden name=sardinha value=nenhum> 59: </form> Quote Link to comment Share on other sites More sharing options...
Question
silviofs
Já tentei de tudo ao executar o programa aparece o seguinte:
syntax erro, unexpected ':', expecting ')'
o script e o seguinte:
$exception = new Exception(
$throwable - > getMessage(),
$throwable - > getCode(),
$throwable
);
Edited by silviofsLink to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.