Skip to content

Commit

Permalink
Restore error messages on callable assertions
Browse files Browse the repository at this point in the history
Commit 21b789b switched the isCallable assertions from a custom
implementation to the one from the beberlei assert library. It did not
take into account the signature change of the method.

The signature was: callable value, property path, error message
The signature changed to: callable value, error message, property path

This commit updates all uses of isCallable to the new
signature. Without this fix, all error messages are 'predicate'
instead of the default error message.
  • Loading branch information
Joris Steyn committed Jan 22, 2018
1 parent 896986f commit 7081249
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function get($index)
*/
public function find($predicate)
{
Assertion::isCallable($predicate, 'predicate');
Assertion::isCallable($predicate, null, 'predicate');

foreach ($this->emailAddresses as $emailAddress) {
if (call_user_func($predicate, $emailAddress) === true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function get($index)
*/
public function find($predicate)
{
Assertion::isCallable($predicate, 'predicate');
Assertion::isCallable($predicate, null, 'predicate');

foreach ($this->telephoneNumbers as $telephoneNumber) {
if (call_user_func($predicate, $telephoneNumber) === true) {
Expand Down
2 changes: 1 addition & 1 deletion src/OpenConext/Value/Saml/Metadata/ContactPersonList.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function get($index)
*/
public function find($predicate)
{
Assertion::isCallable($predicate, 'predicate');
Assertion::isCallable($predicate, null, 'predicate');

foreach ($this->contactPersons as $contactPerson) {
if (call_user_func($predicate, $contactPerson) === true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function equals(OrganizationDisplayNameList $other)
*/
public function find($predicate)
{
Assertion::isCallable($predicate, 'predicate');
Assertion::isCallable($predicate, null, 'predicate');

foreach ($this->organizationDisplayNames as $organizationDisplayName) {
if (call_user_func($predicate, $organizationDisplayName) === true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function get($index)
*/
public function find($predicate)
{
Assertion::isCallable($predicate, 'predicate');
Assertion::isCallable($predicate, null, 'predicate');

foreach ($this->organizationNames as $organizationName) {
if (call_user_func($predicate, $organizationName) === true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function get($index)
*/
public function find($predicate)
{
Assertion::isCallable($predicate, 'predicate');
Assertion::isCallable($predicate, null, 'predicate');

foreach ($this->organizationUrls as $organizationUrl) {
if (call_user_func($predicate, $organizationUrl) === true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function get($index)
*/
public function find($predicate)
{
Assertion::isCallable($predicate, 'predicate');
Assertion::isCallable($predicate, null, 'predicate');

foreach ($this->scopes as $shibbolethMetadataScope) {
if (call_user_func($predicate, $shibbolethMetadataScope) === true) {
Expand Down
2 changes: 1 addition & 1 deletion src/OpenConext/Value/Saml/NameIdFormatList.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function get($index)
*/
public function find($predicate)
{
Assertion::isCallable($predicate, 'predicate');
Assertion::isCallable($predicate, null, 'predicate');

foreach ($this->nameIdFormats as $nameIdFormat) {
if (call_user_func($predicate, $nameIdFormat) === true) {
Expand Down

0 comments on commit 7081249

Please sign in to comment.