Fix/remove PHP 8.2 depreciation messages#397
Fix/remove PHP 8.2 depreciation messages#397krytenuk wants to merge 14 commits intoShardj:masterfrom
Conversation
Fixed doc-block typo and corrected some doc-block property types Added method return types Added int type cast
Added empty array default values
Updated doc-blocks General code tidy
|
Type hints are breaking changes, not? |
|
As failing tests are suggesting, these are breaking changes, not really backward compatible. Therefore I'm against this PR to be merged. |
|
Changed the default delimiters to null. Hopefully fixed phpunit errors. |
# Conflicts: # library/Zend/Controller/Action.php # library/Zend/Session/SaveHandler/DbTable.php
| * Retrieve session lifetime | ||
| * | ||
| * @return int | ||
| * @return bool|int |
There was a problem hiding this comment.
| * @return bool|int | |
| * @return int|false |
for consistency with the property.
Added return to render method Updated method return types
|
Well, we still have tons of hints, forcing some type. Like: Why exactly we are trying to be more typed here pls? Wgat are those deprecation messages about? |
|
My guess is this is about PHP adding "tentative return types" to built-in classes, and giving (non-error) messages like this:
As the message says, the backward-compatible way of acknowledging but silencing the notice is to add a See this Stack Overflow reference question for a deeper explanation. |
| * @throws Zend_Controller_Exception if base view directory does not exist | ||
| */ | ||
| public function initView() | ||
| public function initView(): Zend_View_Interface |
There was a problem hiding this comment.
| public function initView(): Zend_View_Interface | |
| public function initView() |
| * @see Zend_Controller_Response_Abstract::appendBody() | ||
| */ | ||
| public function render($action = null, $name = null, $noController = false) | ||
| public function render(?string $action = null, ?string $name = null, bool $noController = false): void |
There was a problem hiding this comment.
| public function render(?string $action = null, ?string $name = null, bool $noController = false): void | |
| public function render($action = null, $name = null, $noController = false) |
| * @throws Zend_Controller_Exception | ||
| */ | ||
| public function renderScript($script, $name = null) | ||
| public function renderScript(string $script, string $name = null): void |
There was a problem hiding this comment.
| public function renderScript(string $script, string $name = null): void | |
| public function renderScript($script, $name = null) |
| * @throws Zend_Controller_Exception with bad $action | ||
| */ | ||
| public function getViewScript($action = null, $noController = null) | ||
| public function getViewScript(?string $action = null, ?bool $noController = null): string |
There was a problem hiding this comment.
| public function getViewScript(?string $action = null, ?bool $noController = null): string | |
| public function getViewScript($action = null, $noController = null) |
| * @return Zend_Controller_Request_Abstract|null | ||
| */ | ||
| public function getRequest() | ||
| public function getRequest(): ?Zend_Controller_Request_Abstract |
There was a problem hiding this comment.
| public function getRequest(): ?Zend_Controller_Request_Abstract | |
| public function getRequest() |
| * @return $this | ||
| */ | ||
| public function setRequest(Zend_Controller_Request_Abstract $request) | ||
| public function setRequest(Zend_Controller_Request_Abstract $request): Zend_Controller_Action |
There was a problem hiding this comment.
| public function setRequest(Zend_Controller_Request_Abstract $request): Zend_Controller_Action | |
| public function setRequest(Zend_Controller_Request_Abstract $request) |
There was a problem hiding this comment.
... please remove added type tints. Thats a breaking change and not required to fix deprecation issues ...
I was getting deprecation notices after updating a project to PHP 8.2.
Have added type hints and property defaults along with a general code tidy on the worked files.