Add missing type hints to newer classes. #585

Merged
merged 1 commit into from Dec 3, 2011
@@ -297,7 +297,7 @@ public function registerEvent($event, $handler)
*
* @since 11.1
*/
- public function triggerEvent($event, $args = null)
+ public function triggerEvent($event, array $args = null)
{
if ($this->dispatcher instanceof JDispatcher)
{
@@ -64,7 +64,7 @@ class JInput
*
* @since 11.1
*/
- public function __construct($source = null, $options = array())
+ public function __construct($source = null, array $options = array())
{
if (isset($options['filter']))
{
@@ -152,7 +152,7 @@ public function get($name, $default = null, $filter = 'cmd')
*
* @since 11.1
*/
- public function getArray($vars, $datasource = null)
+ public function getArray(array $vars, $datasource = null)
{
$results = array();
@@ -45,7 +45,7 @@ class JInputCLI extends JInput
*
* @since 11.1
*/
- public function __construct($source = null, $options = array ())
+ public function __construct(array $source = null, array $options = array())
{
if (isset($options['filter']))
{
@@ -28,7 +28,7 @@ class JInputCookie extends JInput
*
* @since 11.1
*/
- public function __construct($source = null, $options = array())
+ public function __construct(array $source = null, array $options = array())
@robschley

robschley Dec 3, 2011

Contributor

If $source needs to be an array, null should not be the default value.

@realityking

realityking Dec 3, 2011

Member

As far as PHP is concerned that's absolutely fine. http://php.net/manual/en/language.oop5.typehinting.php

@robschley

robschley Dec 3, 2011

Contributor

You're right. I'm not thinking today... we do this all the time.

{
if (isset($options['filter']))
{
@@ -62,7 +62,7 @@ public function get($name, $default = null, $filter = 'cmd')
*
* @since 11.1
*/
- protected function decodeData($data)
+ protected function decodeData(array $data)
{
$result = array();
@@ -666,7 +666,7 @@ public function registerEvent($event, $handler)
*
* @since 11.3
*/
- public function triggerEvent($event, $args = null)
+ public function triggerEvent($event, array $args = null)
{
if ($this->dispatcher instanceof JDispatcher)
{
@@ -147,7 +147,7 @@ public function request($method, JUri $uri, $data = null, array $headers = null,
* @since 11.3
* @throws UnexpectedValueException
*/
- protected function getResponse($headers, $body)
+ protected function getResponse(array $headers, $body)
{
// Create the response object.
$return = new JHttpResponse;
@@ -228,7 +228,7 @@ public function crop($width, $height, $left, $top, $createNew = true)
* @throws LogicException
* @throws RuntimeException
*/
- public function filter($type, $options = array())
+ public function filter($type, array $options = array())
{
// Make sure the resource handle is valid.
if (!$this->isLoaded())
@@ -571,7 +571,7 @@ public function rotate($angle, $background = -1, $createNew = true)
* @since 11.3
* @throws LogicException
*/
- public function toFile($path, $type = IMAGETYPE_JPEG, $options = array())
+ public function toFile($path, $type = IMAGETYPE_JPEG, array $options = array())
{
// Make sure the resource handle is valid.
if (!$this->isLoaded())