Skip to content

Conversation

Danack
Copy link
Collaborator

@Danack Danack commented Nov 30, 2015

I keep herp-derping while writing code, with typos in function names. This PR adds a human readable string of the callable in the cases where the 'invalid invokable' exception occurs.

It also fixes an issue where a bare ReflectionException escapes from the library without having been caught and turned into an Auryn specific exception.

@@ -15,6 +15,51 @@ public function __construct(array $inProgressMakes, $message = "", $code = 0, \E
}

/**
* Add a human readable version of the invalid callable to the standard 'invalid invokable' message.
* @param array $inProgressMakes
* @param $callableOrMethodStr
Copy link
Contributor

Choose a reason for hiding this comment

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

string|callable

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's actually not string|callable....It also includes ['classname', 'methodName'] and Auryn interprets this as "create an instance of that class and then call the method on it. That does not fit into string|callable.

Copy link
Collaborator

Choose a reason for hiding this comment

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

string|array|callable then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kelunik Do you really think that a docblock thing like that would actually add any value?

Regardless, I've updated the code to be consistent with how the rest of the library documents params.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably not, as many values are accepted, but int for example is not.

rdlowrey added a commit that referenced this pull request Dec 9, 2015
Improve exception messages for invalid callables
@rdlowrey rdlowrey merged commit d6e03a7 into rdlowrey:master Dec 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants