Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim 4 support route params #56

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

M-Shahbaz
Copy link

No description provided.

Please update for slim 4 support and also respect version to 2
Thanks,
@M-Shahbaz M-Shahbaz changed the title Pr/55 Slim 4 support route params Nov 24, 2020
@M-Shahbaz
Copy link
Author

Need to update php unit tests

@DavidePastore DavidePastore added this to the 4.0.0 milestone Mar 1, 2021
@DavidePastore DavidePastore added 4.* Slim 4.* release help wanted labels Mar 1, 2021
@DavidePastore
Copy link
Owner

Hi @M-Shahbaz. Are you still working on this PR?

@M-Shahbaz
Copy link
Author

@DavidePastore updated and All checks have passed.
Please review

Copy link
Owner

@DavidePastore DavidePastore left a comment

Choose a reason for hiding this comment

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

Hi @M-Shahbaz, thanks for your effort on this PR. I reviewed it. Please, let me know if you need further explanations.

src/Validation.php Outdated Show resolved Hide resolved
];

/**
* The translator to use for the exception message.
*
* @var callable
* @var array
Copy link
Owner

Choose a reason for hiding this comment

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

Why is $translator defined as an array?

Copy link
Author

Choose a reason for hiding this comment

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

$exception->setParam('translator', $this->translator); callable setParam not available in v2.0+ of Respect/Validation

Converted to custom messages using array: https://github.com/Respect/Validation/blob/master/docs/feature-guide.md#custom-messages

@@ -70,7 +75,7 @@ class Validation
* Create new Validator service provider.
*
* @param null|array|ArrayAccess $validators
* @param null|callable $translator
* @param null|array $translator
Copy link
Owner

Choose a reason for hiding this comment

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

Why is $translator defined as an array?

Copy link
Author

Choose a reason for hiding this comment

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

$exception->setParam('translator', $this->translator); callable setParam not available in v2.0+ of Respect/Validation

Converted to custom messages using array: https://github.com/Respect/Validation/blob/master/docs/feature-guide.md#custom-messages

Copy link
Owner

Choose a reason for hiding this comment

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

You can now translate messages using the withTranslator method.

src/Validation.php Outdated Show resolved Hide resolved
use Respect\Validation\Validator as v;

class ValidationTest extends \PHPUnit_Framework_TestCase
class ValidationTest extends TestCase
Copy link
Owner

Choose a reason for hiding this comment

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

This file is missing a lot of tests that was previously available. Why were they removed?

Copy link
Author

Choose a reason for hiding this comment

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

I was only able to make these tests work with Slim 4. Maybe you can add more tests as we now have Slim 4 bootstrap.

Copy link
Owner

Choose a reason for hiding this comment

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

Unfortunately these tests are important and should be part of the middleware.

Copy link
Owner

@DavidePastore DavidePastore left a comment

Choose a reason for hiding this comment

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

Please, fix the conflicts of composer.lock file.

@DavidePastore DavidePastore modified the milestones: v4.0.0, future-4.0 Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.* Slim 4.* release help wanted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants