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

Added revokable trait for entities #13

Merged
merged 7 commits into from Feb 26, 2018
Merged

Added revokable trait for entities #13

merged 7 commits into from Feb 26, 2018

Conversation

jguittard
Copy link
Contributor

@jguittard jguittard commented Feb 21, 2018

revoked being a field of all tables, it should be available as a property for bound entities.
This PR adds a trait with getter and setter in every entity, allowing objects to reflect their DB entry.

/**
* @var bool
*/
protected $revoked;
Copy link
Member

Choose a reason for hiding this comment

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

private

Copy link
Contributor Author

Choose a reason for hiding this comment

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

protected has been preferred in order to remain consistent with League's traits implementation.
Furthermore, I don't see why inheritance of those properties would not be allowed.

Copy link
Member

Choose a reason for hiding this comment

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

I think consistency with the upstream implementation makes sense here.


/**
*
*/
Copy link
Member

Choose a reason for hiding this comment

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

Remove empty doc-block, please

if (! $this->createdAt) {
$this->createdAt = new DateTime();
if (method_exists($this, 'getTimezone')) {
$this->createdAt->setTimezone(new \DateTimeZone(($this->getTimezone()->getValue())));
Copy link
Member

Choose a reason for hiding this comment

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

Please import DateTimeZone.

Copy link
Member

Choose a reason for hiding this comment

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

Hm... There is a lot of parenthesis and it looks like you can remove one pair.

/**
* @param DateTime $updatedAt
*/
public function setUpdatedAt(DateTime $updatedAt): void
Copy link
Member

Choose a reason for hiding this comment

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

Consistency fix: everywhere we are using single space before colon in return type declaration.

}

/**
* @param DateTime $updatedAt
Copy link
Member

Choose a reason for hiding this comment

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

Consistency fix: we don't need that doc-block as it not gives us any more information than we have in function signature. So basically you can remove PHPDocs on all methods

{
protected $createdAt;

protected $updatedAt;
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, maybe I wasn't clear in my previous comment, but it's good to keep PHPDocs here (on class properties) because we don't know what is the type - in methods we know if from method signature.

@michalbundyra
Copy link
Member

@jguittard the same - about doc-comment we should do in other classes/traits you've added.

BTW Why build is failing with latests deps?

@jguittard
Copy link
Contributor Author

@webimpress All right, it's getting funny and annoying! :) What is it with 'doc-comment'?
I'll check travis logs, I don't know yet why it's failing

@michalbundyra
Copy link
Member

@jguittard these PHPDocs without any extra information: https://github.com/zendframework/zend-expressive-authentication-oauth2/pull/13/files#diff-56840550916e42595221de7dd214d849R52

If all is defined in method signature we don't need to duplicate these information in PHPDocs.
You can check other classes we have done the same way in all expressive modules already.

@jguittard
Copy link
Contributor Author

@geerteltink
Copy link
Member

It's probably failing because of #15 not being merged yet. I can't / am not allowed to merge it until the release-1.0.0 branch is created.

@jguittard
Copy link
Contributor Author

@weierophinney weierophinney dismissed Ocramius’s stale review February 26, 2018 17:41

Explanation from author makes sense.

@weierophinney weierophinney merged commit b8e0915 into zendframework:release-1.0.0 Feb 26, 2018
weierophinney added a commit that referenced this pull request Feb 26, 2018
weierophinney added a commit that referenced this pull request Feb 26, 2018
@weierophinney
Copy link
Member

Thanks, @jguittard!

@jguittard jguittard deleted the feature/revokable-entities branch February 27, 2018 09:47
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.

None yet

5 participants