Skip to content

Conversation

@pcmad
Copy link

@pcmad pcmad commented Sep 6, 2023

…mic property

file change see attached Zend_Controller_Action

example of code below for controller for ajax json output
class TestController extends Zend_Controller_Action
{
public function init ()
{
$contextSwitch = $this->_helper->getHelper('contextSwitch');

	$contextSwitch->addActionContext('ajax-attribute-checker', 'json')->initContext('json');

}
public function ajaxAttributeCheckerAction ()
{

		$this->view->return = array('yay'=>true);
	}
}

}

…mic property $contextSwitch = $this->_helper->getHelper('contextSwitch');

		$contextSwitch->addActionContext('ajax-attribute-checker', 'json')->initContext('json');
@develart-projects develart-projects added bug Something isn't working to be released PR exists or in master, but not released yet labels Sep 7, 2023
@develart-projects develart-projects added this to the 1.24.0 milestone Sep 7, 2023
@develart-projects develart-projects merged commit fd95045 into Shardj:master Sep 7, 2023
@holtkamp
Copy link

holtkamp commented Nov 7, 2023

@develart-projects why not use a typed property like:

public array $contexts;

?

* compataibility for php 8.2 to stop error Deprecated: Creation of dynamic property
* @var object
*/
public $contexts = null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use a typed property?

Copy link
Collaborator

@develart-projects develart-projects Feb 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's PHP and we don't really need that.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PHPDoc @var object now suggests it is an object, which it is not, it is an array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working to be released PR exists or in master, but not released yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants