for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Recurrence\Constraint;
use Recurrence\Model\Recurrence;
/**
* Class ExcludeWeekendConstraint
* @package Recurrence\Constraint
*/
class ExcludeWeekendConstraint implements RecurrenceConstraintInterface
{
* @param Recurrence $recurrence
* @param \Datetime $datetime
* @return \Datetime
public function apply(Recurrence $recurrence, \Datetime $datetime)
if ($this->isWeekend($datetime)) {
// Add 1 or 2 days to skip weekend (we didn't use `next monday` pattern of \Datetime::format cause it remove time)
$days = (7 - (int) $datetime->format('N') + 1);
$datetime->modify(sprintf('+%d days', $days));
}
return $datetime;
* @param \Datetime $date
$date
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
* @return bool
private function isWeekend($datetime) {
return ((int) $datetime->format('N') >= 6);
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.