Skip to content
This repository was archived by the owner on Jan 11, 2022. It is now read-only.

Fixed bug getter reflection logic not being used to find property #4

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

Fixed bug getter reflection logic not being used to find property #4

wants to merge 2 commits into from

Conversation

MrDienns
Copy link

The getter reflection logic was not used to fetch properties, meaning the script would only work if the classes had setters, even though that's by all means not always the case for simple models. This pull request fixes that and now uses the getter reflection logic.

@pimjansen
Copy link

Nice find!

@marcofranssen
Copy link

Awesome now it also works for immutable models without setters 👍


if (null === $writable || false === $writable) {
if ((null === $writable || false === $writable) && null === $readable || false === $readable) {
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add parenthesis on the right expression for clarity?

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@dunglas
Copy link
Owner

dunglas commented Jul 26, 2018

Can you also add a non regression test? Before merging, I need to check why the tests are red. It will not be before September unfortunately (I’m in vacation).

@MrDienns
Copy link
Author

MrDienns commented Jul 26, 2018

Can you also add a non regression test? Before merging, I need to check why the tests are red. It will not be before September unfortunately (I’m in vacation).

I will look into added some test cases. It seems like the build is due to some PHP version mismatches. Travis CI:

This version of PHPUnit is supported on PHP 7.1 and PHP 7.2.
You are using PHP 7.0.31 (/home/travis/.phpenv/versions/7.0.31/bin/php).

Edit: I've updated the PHP versions, but there are more errors in the (already existing) test cases.

@@ -5,7 +5,7 @@ cache:
- "$HOME/.composer/cache"

php:
- 7
- 7.2

Choose a reason for hiding this comment

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

When using the php-7.2 test in Travis CI build, the PHPUnit will use the latest stable version.

The PHPUnit namespace changes into PHPUnit\Framework\TestCase.

It should be fixed and the Travis CI build will be successful.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants