jjdunn commented on issue #7766:
URL: https://github.com/apache/netbeans/issues/7766#issuecomment-2365204322
here's some code extracted from our application, which is based on Yii 1.1
framework:
```
<?php
class CException extends Exception
{
}
class CHttpException extends CException
{
/**
* @var integer HTTP status code, such as 403, 404, 500, etc.
*/
public $statusCode;
/**
* Constructor.
* @param integer $status HTTP status code, such as 404, 500, etc.
* @param string $message error message
* @param integer $code error code
*/
//#[\Override] // causes PHP runtime error
public function __construct($status,$message=null,$code=0)
{
$this->statusCode=$status;
parent::__construct((string)$message,$code);
}
}
class ConfirmAccessException extends CHttpException {
/**
* Constructor.
* @param string $message error message
* @param integer $code error code
*/
//#[\Override] // causes PHP runtime error
public function __construct($message = null, $code = 0) {
parent::__construct(403, $message, $code);
}
}
// test
throw new ConfirmAccessException;
```
save the above code to a file, then open in NB 22.
NB offers the "Add #[\Override]...." hint on the __construct() method of
CHttpException, in this example
In the original code, the three classes are in separate files: NB offers the
"Add #[\Override]..." hint on the __construct() method of
ConfirmAccessException too.
adding the #[\Override] attribute in the constructor of either class results
in the PHP runtime error as mentioned in the ticket description
```
[21-Sep-2024 10:06:32 America/New_York] PHP Fatal error:
CHttpException::__construct() has #[\Override] attribute, but no matching
parent method exists in C:\temp\test2.php on line 21
```
Product Version: Apache NetBeans IDE 22
Java: 20.0.2; Java HotSpot(TM) 64-Bit Server VM 20.0.2+9-78
Runtime: Java(TM) SE Runtime Environment 20.0.2+9-78
System: Windows 10 version 10.0 running on amd64; UTF-8; en_US (nb)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists