Skip to content

Commit

Permalink
Handler its_ with phpspec
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroTroller committed May 18, 2016
1 parent 4172201 commit c4f5fe8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ public function it_is_a_spec(\$file) {
public function itIsNotASpec(\$file) {
return;
}
public function its_other_function(\$file) {
return;
}
}
SPEC;

Expand Down Expand Up @@ -69,6 +73,10 @@ function it_is_a_spec(\$file) {
public function itIsNotASpec(\$file) {
return;
}
function its_other_function(\$file) {
return;
}
}
SPEC;

Expand Down
18 changes: 9 additions & 9 deletions src/PedroTroller/CS/Fixer/Contrib/PhpspecScenarioScopeFixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public function fix(\SplFileInfo $file, $content)
$name = $tokens[$next];
$scope = $tokens[$previous];

if (false === in_array($name->getContent(), array('let', 'letGo'))
&& false === $this->startsWith($name->getContent(), 'it_')) {
continue;
}
switch (true) {
case in_array($name->getContent(), array('let', 'letGo')):
case $this->startsWith($name->getContent(), 'it_'):
case $this->startsWith($name->getContent(), 'its_'):
if (T_PUBLIC !== $scope->getId()) {
continue;
}

if (T_PUBLIC !== $scope->getId()) {
continue;
$tokens->overrideAt($previous, '');
$tokens->removeTrailingWhitespace($previous);
}

$tokens->overrideAt($previous, '');
$tokens->removeTrailingWhitespace($previous);
}

return $tokens->generateCode();
Expand Down

0 comments on commit c4f5fe8

Please sign in to comment.