-
Notifications
You must be signed in to change notification settings - Fork 111
Conversation
no sure why this PR also show commits already pulled into develop. review request is from commit e7fd215 and forward |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'm not sure why unrelated changes were added for example CS check and Travis config to this PR. Also maybe we can require php7.1 and we could use void
return type as we now use it. I don't know why so many unrelated changes are in this PR maybe that's what you said that some commits from develop
branch is here. but then maybe rebase is required?
* @return AuthorizationService | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
public function createService(ServiceLocatorInterface $serviceLocator): AuthorizationService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for ServiceManager v2 and we no longer support it so can be removed
* @return ModuleOptions | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
public function createService(ServiceLocatorInterface $serviceLocator): ModuleOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also not used anymore and in other factories also...
@@ -40,15 +42,15 @@ class ObjectRepositoryRoleProviderFactory implements FactoryInterface | |||
protected $options = []; | |||
|
|||
/** | |||
* {@inheritDoc} | |||
* {@inheritdoc} | |||
*/ | |||
public function __construct(array $options = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this constructor?
*/ | ||
public function __construct(array $options = []) | ||
{ | ||
$this->setCreationOptions($options); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
* {@inheritdoc} | ||
*/ | ||
public function setCreationOptions(array $options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$options from __invoke(ContainerInterface $container, $requestedName, array $options = null)
method can be used instead this method also from SM v2
src/Container/RoleServiceFactory.php
Outdated
* @return RoleService | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
public function createService(ServiceLocatorInterface $serviceLocator): RoleService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same
@@ -1,4 +1,6 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that git show that this file was renamed test/Asset/Permission.php → src/Role/Role.php
but not sure if that's important :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember there is some git plugin that fixes that, but I forgot the name.
/** | ||
* @var array | ||
*/ | ||
protected $invokableClasses = [ | ||
InMemoryRoleProvider::class => InMemoryRoleProvider::class | ||
protected $aliases = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we really need those aliases? I think FCQN is what everyone uses.
{ | ||
return 'role-with-permission-method'; | ||
} | ||
public function hasPermission($permission) | ||
|
||
public function hasPermission(string $permission): bool | ||
{ | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be something like return in_array($permission, $this->getPermissions(), true);
? This may is test asset but can lead to problems later if someone will assume that this is valid role
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone has a problem when using a MockRole from TestAsset in production, he deserves this problem :)
test/Options/ModuleOptionsTest.php
Outdated
@@ -36,10 +40,10 @@ public function testAssertModuleDefaultOptions() | |||
public function testSettersAndGetters() | |||
{ | |||
$moduleOptions = new ModuleOptions([ | |||
'guest_role' => 'unknown', | |||
'role_provider' => [], | |||
'guest_role' => 'unknown', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like those spaces but i guess that's not for me to decide :D
/** | ||
* Simple implementation for a hierarchical role | ||
*/ | ||
final class HierarchicalRole extends Role implements HierarchicalRoleInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe if we use final
then add to others also?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, when it's implementing an interface and has no additional public methods, let's mark as final
Looks great!! |
29dc027
to
8c3d6a4
Compare
I now figured out what goed wrong. this PR #366 isn't merged into develop yet. Guess I should fix that one first and then rebase this one. |
"squizlabs/php_codesniffer": "^2.0", | ||
"doctrine/common": "~2.4" | ||
"malukenho/docheader": "^0.1", | ||
"phpunit/phpunit": "^6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use v7
use ZfcRbac\Exception; | ||
use ZfcRbac\Identity\IdentityInterface; | ||
|
||
class AssertionSet implements AssertionInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's implementing an interface, mark as final
/** | ||
* Simple implementation for a hierarchical role | ||
*/ | ||
final class HierarchicalRole extends Role implements HierarchicalRoleInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, when it's implementing an interface and has no additional public methods, let's mark as final
@@ -1,4 +1,6 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember there is some git plugin that fixes that, but I forgot the name.
*/ | ||
class Permission implements PermissionInterface | ||
class Role implements RoleInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above, if it's implementing an interface, mark as final
*/ | ||
class AssertionSetTest extends TestCase | ||
{ | ||
public function testImplementsAssertionInterface() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we require php 7.1 now? if so, let's add : void
{ | ||
return 'role-with-permission-method'; | ||
} | ||
public function hasPermission($permission) | ||
|
||
public function hasPermission(string $permission): bool | ||
{ | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone has a problem when using a MockRole from TestAsset in production, he deserves this problem :)
Looks good so far, just some minor notes |
8c3d6a4
to
81178b8
Compare
Implements #320 for develop branch
documentation forthcoming