-
Notifications
You must be signed in to change notification settings - Fork 203
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
Add missing read only properties to role structs #2
Conversation
One minor mistake with the protected stuff I have been made aware of during the conference is that you can not change the array, as it is returned by value and not by reference. Code: class Test
{
protected $test = array( 'one' );
function __get( $name ){ return $this->$name; }
function __set( $name, $value ){ $this->$name = $value; }
}
$obj = new Test();
var_dump( $obj->test );
$obj->test[] = 'two';
var_dump( $obj->test );
$obj->test[0] = 'oneTwo';
var_dump( $obj->test ); Output:
If this is annoying enough to need methods, I don't know. As they are readonly they are not supposed to be manipulated like this anyway. |
Sounds good to me. I'll make another commit to add methods. But, how should we stop exposing arrays? Throwing exceptions in __get in case is_array returns true? |
No, I think the possible outcome is to either remove all magic and instead have clear methods in the interface for readonly properties. Or let it be like it is. |
It seems kinda too much to have methods for each and every readonly property, some value objects have 5 and more of those. |
Yes, and that is why we ended up with these magic methods instead. |
The diff looks good now, so good that I can start to nitpick :)
|
:))
Removed the lines in PHPDoc comments.
I wrote those exactly as existing methods addLimitation / addPolicy :) |
Rebased the pull request with current master for "abstract public" |
Add missing read only properties to role structs
Fixed a Typo in RoleService
* Added class constants in SudoMainLocationLoaderTest * getMock to createMock and class constants in ArrayTranslatorFieldsGroupsListTest * getMock to createMock and class constants in RepositoryConfigFieldsGroupsListFactoryTest * getMock to createMock and class constants in ContentPreviewHelperTest * getMock to createMock and class constants in FieldHelperTest * getMock to createMock and class constants in PreviewLocationProviderTest * getMock to createMock and class constants in TranslationHelperTest * getMock to createMock and class constants in AssignedLocationsListenerTest * getMock to createMock and class constants in ParentLocationsListenerTest * getMock to createMock and class constants in RelatedLocationsListenerTest * MVC/Symfony/Cache/Tests/Http/SignalSlot tests added class constants * Class constants and createMock added to POSPurgeClientTest * Class constants and createMock in InstantCachePurgerTest, LocalPurgeClientTest and LocationAwareStoreTest * Class constants and createMock added to Core/MVC/Symfony/Controller/Tests * Class constants and createMock added to Core/MVC/Symfony/Event/Tests * Class constants and createMock added to Core/MVC/Symfony/EventListener/Tests * Removed mock of unexistent methods, added class constants and createMock to Core/MVC/Symfony/FieldType/Tests * Added class constants and createMock to Core/MVC/Symfony/Locale/Tests * Added class constants and createMock to Core/MVC/Symfony/Matcher/Tests * Added class constants and createMock to Core/MVC/Symfony/Routing/Tests * Added class constants and createMock to Core/MVC/Symfony/Security/Tests * Added class constants and createMock to Core/MVC/Symfony/SiteAccess/Tests * Added class constants and createMock to Core/MVC/Symfony/Templating/Tests * Added class constants and createMock to Core/MVC/Symfony/View/Tests * Class constants and createMock added to Core/Limitation/Tests * Class constants and createMock added to Core/Pagination/Tests * Class constants added to Core/Base/Tests * Class constants and createMock added to Core/FieldType/Tests part #1 * Class constants and createMock added to Core/FieldType/Tests part #2 * Class constants and createMock added to Core/IO/Tests * Class constants and createMock added to Core/SignalSlot/Tests * Class constants and createMock added to Core/Search/Tests * Fixed CS issue * Class constants and createMock in Core/Persistence/Tests * Class constants and createMock in Core/REST/Tests * Use PHPUnit v57 * Remove mockery * Added createMock() to Core/Repository/Tests * Now we can use symfony-dependency-injection-test v1 * Added createMock() to SPI * Updated Bundle tests * Use namespaced TestCase * Hopefully fixed CS * Now I really think that CS if fixed * Trigger travis build * This was removed in rebase
These should be readable. As far as I can see, there's no way to access limitations and policies once added to structs, there's no abstract methods to implement like, for example, eZ\Publish\API\Repository\Values\User\Role::getPolicies