Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

NumberOfParameterFilter correctly handles argument count greater than 0. #6083

Closed

Conversation

danfinnie
Copy link
Contributor

The NumberOfParameterFilter used to have a constructor argument for the number of parameters to filter by, but this was ignored and always set to 0. Luckily, the use case for the filter was restricting the getter, is, has, etc. filters to 0-arity functions so this was OK. This pull request fixes the class to handle any number of arguments as shown in testArityOne().

@@ -26,7 +26,7 @@ class NumberOfParameterFilter implements FilterInterface
*/
public function __construct($numberOfParameters = 0)
{
$this->numberOfParameters = 0;
$this->numberOfParameters = $numberOfParameters;
Copy link
Member

Choose a reason for hiding this comment

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

Cast to (int) here

@danfinnie
Copy link
Contributor Author

@Ocramius Thanks for the fast reply, I just added the typecast.

@Ocramius Ocramius self-assigned this Apr 6, 2014
@Ocramius Ocramius added this to the 2.3.1 milestone Apr 6, 2014
Ocramius added a commit that referenced this pull request Apr 6, 2014
Ocramius added a commit that referenced this pull request Apr 6, 2014
@Ocramius Ocramius closed this in 618760e Apr 6, 2014
@Ocramius
Copy link
Member

Ocramius commented Apr 6, 2014

@danfinnie thanks!

gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
gianarb pushed a commit to zendframework/zend-stdlib that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants