1
0
mirror of https://github.com/jupeter/clean-code-php.git synced 2025-09-25 13:39:04 +02:00

add default value for User::$access

This commit is contained in:
Peter Gribanov
2019-01-29 10:28:12 +03:00
parent 810f537ab2
commit 6be37a0971

View File

@@ -124,6 +124,12 @@ $json = $serializer->serialize($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT
**Bad:**
```php
class User
{
// What the heck is 7 for?
public $access = 7;
}
// What the heck is 4 for?
if ($user->access & 4) {
// ...
@@ -139,6 +145,8 @@ class User
const ACCESS_CREATE = 2;
const ACCESS_UPDATE = 4;
const ACCESS_DELETE = 8;
public $access = self::ACCESS_READ | self::ACCESS_CREATE | self::ACCESS_UPDATE;
}
if ($user->access & User::ACCESS_UPDATE) {