| Conditions | 1 | 
| Total Lines | 70 | 
| 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 dataValidationPassed(): array  | 
            ||
| 75 |     { | 
            ||
| 76 | return [  | 
            ||
| 77 | [  | 
            ||
| 78 |                 new class () { | 
            ||
| 79 | public $attr1 = 1;  | 
            ||
| 80 | public $attr2 = null;  | 
            ||
| 81 | },  | 
            ||
| 82 | [new OneOf(['attr1', 'attr2'])],  | 
            ||
| 83 | ],  | 
            ||
| 84 | [  | 
            ||
| 85 |                 new class () { | 
            ||
| 86 | public $attr1 = null;  | 
            ||
| 87 | public $attr2 = 1;  | 
            ||
| 88 | },  | 
            ||
| 89 | [new OneOf(['attr1', 'attr2'])],  | 
            ||
| 90 | ],  | 
            ||
| 91 | [  | 
            ||
| 92 |                 new class () { | 
            ||
| 93 | private int $attr1 = 1;  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 94 | private $attr2 = null;  | 
            ||
| 95 | },  | 
            ||
| 96 | [new OneOf(['attr1', 'attr2'])],  | 
            ||
| 97 | ],  | 
            ||
| 98 | [  | 
            ||
| 99 | ['attr1' => 1, 'attr2' => null],  | 
            ||
| 100 | [new OneOf(['attr1', 'attr2'])],  | 
            ||
| 101 | ],  | 
            ||
| 102 | [  | 
            ||
| 103 | ['attr1' => null, 'attr2' => 1],  | 
            ||
| 104 | [new OneOf(['attr1', 'attr2'])],  | 
            ||
| 105 | ],  | 
            ||
| 106 | [  | 
            ||
| 107 |                 new class () { | 
            ||
| 108 | public $obj;  | 
            ||
| 109 | |||
| 110 | public function __construct()  | 
            ||
| 111 |                     { | 
            ||
| 112 |                         $this->obj = new class () { | 
            ||
| 113 | public $attr1 = 1;  | 
            ||
| 114 | public $attr2 = null;  | 
            ||
| 115 | };  | 
            ||
| 116 | }  | 
            ||
| 117 | },  | 
            ||
| 118 | ['obj' => new OneOf(['attr1', 'attr2'])],  | 
            ||
| 119 | ],  | 
            ||
| 120 | [  | 
            ||
| 121 |                 new class () { | 
            ||
| 122 | public $obj;  | 
            ||
| 123 | |||
| 124 | public function __construct()  | 
            ||
| 125 |                     { | 
            ||
| 126 |                         $this->obj = new class () { | 
            ||
| 127 | public $attr1 = null;  | 
            ||
| 128 | public $attr2 = 1;  | 
            ||
| 129 | };  | 
            ||
| 130 | }  | 
            ||
| 131 | },  | 
            ||
| 132 | ['obj' => new OneOf(['attr1', 'attr2'])],  | 
            ||
| 133 | ],  | 
            ||
| 134 | [  | 
            ||
| 135 | ['obj' => ['attr1' => 1, 'attr2' => null]],  | 
            ||
| 136 | ['obj' => new OneOf(['attr1', 'attr2'])],  | 
            ||
| 137 | ],  | 
            ||
| 138 | [  | 
            ||
| 139 | ['obj' => ['attr1' => null, 'attr2' => 1]],  | 
            ||
| 140 | ['obj' => new OneOf(['attr1', 'attr2'])],  | 
            ||
| 141 | ],  | 
            ||
| 142 | 'class attribute' => [  | 
            ||
| 143 | new OneOfDto(1),  | 
            ||
| 144 | ],  | 
            ||
| 231 |