1

I have an error when define PHP version in 5.6 on settings.

PhpStorm, in 2018.1.6 version, use Core with PHP 7 and logically use PHP 7 implementations. By example for extends Exception, PhpStorm create an constructor with a third parameter has an instance of Throwable.

It's very problematic, do you have an idea for solve this problem?

Following the answers, for reproduce, please follow this steps :

  • using PHPStorm 2018.1.6
  • create an TestException extends \Exception
  • create a constructor with autocompletion

PHPStorm extends a PHP 7 version of \Exception and not a PHP 5.6 version of Exception, PHP 7 version integration Throwable interface for previous exception but not PHP 5.6 version.

Use autocomplete function to create constructor:

Use autocomplete function to create constructor

Constructor implements throwable interface for previous exception:

Constructor implements throwable interface for previous exception

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
  • 2
    *I have an error* - what error? – barbsan Feb 28 '19 at 11:01
  • Can you please edit the question and include a short code sample and the exact steps to reproduce the issue? PhpStorm automates code generation in several different places and it's unclear which one you mean (or at least I can't figure it out). – Álvaro González Mar 01 '19 at 15:50
  • I modify my question for integrate a steps for reproduce – Jérémy Gaultier Mar 04 '19 at 16:56
  • I guess you mean that you already have the class and then use the "Generate constructor" feature. I'm sorry, I cannot reproduce it. [This is what I get](https://i.imgur.com/t0zYjbF.png). – Álvaro González Mar 04 '19 at 18:28
  • I update my initial message with two screenshoots – Jérémy Gaultier Mar 05 '19 at 13:20
  • There is nothing wrong with having `Throwable` type hint for `$previous` at third argument of `Exception` constructor. This is the correct signature for PHP 7 code. What is your problem with `Throwable` there? – edigu Mar 10 '19 at 22:10

0 Answers0