| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 36 |
| 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 declare(strict_types=1); |
||
| 120 | public function itCanCreateAnEntityWithRequiredRelationsUsingNestedDtos(): void |
||
| 121 | { |
||
| 122 | $attributesAddressFqn = |
||
| 123 | $this->getCopiedFqn(self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_ATTRIBUTES_ADDRESS); |
||
| 124 | |||
| 125 | $companyDirectorFqn = |
||
| 126 | $this->getCopiedFqn(self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_DIRECTOR); |
||
| 127 | |||
| 128 | $personFqn = |
||
| 129 | $this->getCopiedFqn(self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_PERSON); |
||
| 130 | |||
| 131 | $emailFqn = |
||
| 132 | $this->getCopiedFqn(self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_EMAIL); |
||
| 133 | |||
| 134 | $companyFqn = |
||
| 135 | $this->getCopiedFqn(self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_COMPANY); |
||
| 136 | |||
| 137 | $personDto = $this->getEntityDtoFactory() |
||
| 138 | ->createEmptyDtoFromEntityFqn($personFqn); |
||
| 139 | $personDto->getAttributesEmails()->add( |
||
| 140 | $this->getEntityDtoFactory() |
||
| 141 | ->createEmptyDtoFromEntityFqn($emailFqn) |
||
| 142 | ->setEmailAddress('[email protected]') |
||
| 143 | ); |
||
| 144 | |||
| 145 | $companyDto = $this->getEntityDtoFactory() |
||
| 146 | ->createEmptyDtoFromEntityFqn($companyFqn); |
||
| 147 | |||
| 148 | $companyDto->getCompanyDirectors() |
||
| 149 | ->add( |
||
| 150 | $this->getEntityDtoFactory() |
||
| 151 | ->createEmptyDtoFromEntityFqn($companyDirectorFqn) |
||
| 152 | ->setPersonDto($personDto) |
||
| 153 | ); |
||
| 154 | |||
| 155 | $companyDto->getAttributesAddresses() |
||
| 156 | ->add( |
||
| 157 | $this->getEntityDtoFactory() |
||
| 158 | ->createEmptyDtoFromEntityFqn($attributesAddressFqn) |
||
| 159 | ); |
||
| 160 | |||
| 161 | $companyDto->getAttributesEmails() |
||
| 162 | ->add( |
||
| 163 | $this->getEntityDtoFactory() |
||
| 164 | ->createEmptyDtoFromEntityFqn($emailFqn) |
||
| 165 | ->setEmailAddress('[email protected]') |
||
| 166 | ); |
||
| 167 | |||
| 168 | $company = $this->factory->create($companyFqn, $companyDto); |
||
| 169 | self::assertInstanceOf($companyFqn, $company); |
||
| 170 | self::assertInstanceOf($companyDirectorFqn, $company->getCompanyDirectors()->first()); |
||
| 171 | self::assertSame($company, $company->getCompanyDirectors()->first()->getCompanies()->first()); |
||
| 172 | } |
||
| 174 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.