Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is
duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
The expression \DateTime::createFromFor...TimeZone($matches[1])); of type DateTime|false adds false to the return on line 17 which is incompatible with the return type documented by Recurrence\RruleTransfor...tTransformer::transform of type DateTime|null. It seems like you forgot to handle an error condition.
Loading history...
18
} catch (\Exception $e) {
19
throw new \InvalidArgumentException(sprintf('Invalid RRULE [%s] option : [%s] with timezone [%s]', $this::RRULE_PARAMETER, $matches[2], $matches[1]));
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
24
return \DateTime::createFromFormat('Ymd\THisZ', $matches[1], new \DateTimeZone('UTC'));
The expression \DateTime::createFromFor... \DateTimeZone('UTC')); of type DateTime|false adds false to the return on line 24 which is incompatible with the return type documented by Recurrence\RruleTransfor...tTransformer::transform of type DateTime|null. It seems like you forgot to handle an error condition.
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
The expression \DateTime::createFromFor...d\\THis', $matches[1]); of type DateTime|false adds false to the return on line 28 which is incompatible with the return type documented by Recurrence\RruleTransfor...tTransformer::transform of type DateTime|null. It seems like you forgot to handle an error condition.
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
The expression \DateTime::createFromFormat('Ymd', $matches[1]); of type DateTime|false adds false to the return on line 32 which is incompatible with the return type documented by Recurrence\RruleTransfor...tTransformer::transform of type DateTime|null. It seems like you forgot to handle an error condition.