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 |
||
78 | public function testNamedAssertionsWithAllow(): void |
||
79 | { |
||
80 | $this->acl->allow('member', 'user', 'read', new IsMyself()); |
||
81 | $this->acl->allow('admin', 'user', 'read', $this->adminAssertion); |
||
82 | |||
83 | self::assertSame( |
||
84 | [ |
||
85 | 'privilege' => 'read', |
||
86 | 'allowed' => false, |
||
87 | 'allowIf' => ["c'est moi-même"], |
||
88 | 'denyIf' => [], |
||
89 | ], |
||
90 | $this->acl->show('member', 'user', 'read') |
||
91 | ); |
||
92 | |||
93 | self::assertSame( |
||
94 | [ |
||
95 | 'privilege' => 'read', |
||
96 | 'allowed' => false, |
||
97 | 'allowIf' => ['admin assertion'], |
||
98 | 'denyIf' => [], |
||
99 | ], |
||
100 | $this->acl->show('admin', 'user', 'read') |
||
101 | ); |
||
102 | |||
103 | self::assertSame( |
||
104 | [ |
||
105 | 'privilege' => 'read', |
||
106 | 'allowed' => false, |
||
107 | 'allowIf' => ['admin assertion', "c'est moi-même"], |
||
108 | 'denyIf' => [], |
||
109 | ], |
||
110 | $this->acl->show(new MultipleRoles(['member', 'admin']), 'user', 'read') |
||
111 | ); |
||
112 | |||
113 | self::assertSame( |
||
114 | [ |
||
115 | 'privilege' => 'non-existing-privilege', |
||
116 | 'allowed' => false, |
||
117 | 'allowIf' => [], |
||
118 | 'denyIf' => [], |
||
119 | ], |
||
120 | $this->acl->show('member', 'user', 'non-existing-privilege') |
||
121 | ); |
||
122 | |||
123 | self::assertSame( |
||
124 | [ |
||
125 | 'privilege' => null, |
||
126 | 'allowed' => false, |
||
127 | 'allowIf' => ["c'est moi-même"], |
||
128 | 'denyIf' => [], |
||
129 | ], |
||
130 | $this->acl->show('member', 'user', null) |
||
131 | ); |
||
182 |
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