4 * This file is part of the Behat.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
11 namespace Behat\Behat\Definition\Exception;
13 use Behat\Behat\Definition\Definition;
17 * Represents an exception caused by a redundant step definition.
19 * If multiple step definitions in the boundaries of the same suite use same regular expression, behat is not able
20 * to determine which one is better and thus this exception is thrown and test suite is stopped.
22 * @author Konstantin Kudryashov <ever.zet@gmail.com>
24 final class RedundantStepException extends RuntimeException implements SearchException
27 * Initializes redundant exception.
29 * @param Definition $step2 duplicate step definition
30 * @param Definition $step1 firstly matched step definition
32 public function __construct(Definition $step2, Definition $step1)
35 "Step \"%s\" is already defined in %s\n\n%s\n%s",
36 $step2->getPattern(), $step1->getPath(), $step1->getPath(), $step2->getPath()
39 parent::__construct($message);