Conditions | 1 |
Total Lines | 53 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
74 | public function testNamedAssertionsWithAllow(): void |
||
75 | { |
||
76 | $this->acl->allow('member', 'user', 'read', new IsMyself()); |
||
77 | $this->acl->allow('admin', 'user', 'read', $this->adminAssertion); |
||
78 | |||
79 | self::assertSame( |
||
80 | [ |
||
81 | 'privilege' => 'read', |
||
82 | 'allowed' => false, |
||
83 | 'allowIf' => ["c'est moi-même"], |
||
84 | 'denyIf' => [], |
||
85 | ], |
||
86 | $this->acl->show('member', 'user', 'read') |
||
87 | ); |
||
88 | |||
89 | self::assertSame( |
||
90 | [ |
||
91 | 'privilege' => 'read', |
||
92 | 'allowed' => false, |
||
93 | 'allowIf' => ['admin assertion'], |
||
94 | 'denyIf' => [], |
||
95 | ], |
||
96 | $this->acl->show('admin', 'user', 'read') |
||
97 | ); |
||
98 | |||
99 | self::assertSame( |
||
100 | [ |
||
101 | 'privilege' => 'read', |
||
102 | 'allowed' => false, |
||
103 | 'allowIf' => ['admin assertion', "c'est moi-même"], |
||
104 | 'denyIf' => [], |
||
105 | ], |
||
106 | $this->acl->show(new MultipleRoles(['member', 'admin']), 'user', 'read') |
||
107 | ); |
||
108 | |||
109 | self::assertSame( |
||
110 | [ |
||
111 | 'privilege' => 'non-existing-privilege', |
||
112 | 'allowed' => false, |
||
113 | 'allowIf' => [], |
||
114 | 'denyIf' => [], |
||
115 | ], |
||
116 | $this->acl->show('member', 'user', 'non-existing-privilege') |
||
117 | ); |
||
118 | |||
119 | self::assertSame( |
||
120 | [ |
||
121 | 'privilege' => null, |
||
122 | 'allowed' => false, |
||
123 | 'allowIf' => ["c'est moi-même"], |
||
124 | 'denyIf' => [], |
||
125 | ], |
||
126 | $this->acl->show('member', 'user', null) |
||
127 | ); |
||
178 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths