-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
468 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ vendor/ | |
composer.lock | ||
manual/ | ||
__pycache__ | ||
.php_cs.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
<?php | ||
|
||
use Symfony\CS\Config\Config; | ||
use Symfony\CS\Fixer; | ||
use Symfony\CS\FixerInterface; | ||
|
||
$config = new Config(); | ||
$config = Config::create() | ||
// use default level and extra fixers: | ||
->fixers(array('-concat_without_spaces', 'concat_with_spaces', 'strict')) | ||
->setUsingCache(true) | ||
->setUsingLinter(false); | ||
|
||
$config->fixers(array('-concat_without_spaces', 'concat_with_spaces')); | ||
$finder = $config->getFinder() | ||
->in('src') | ||
->in('test'); | ||
|
||
$config->getFinder() | ||
->in(__DIR__) | ||
->exclude('bin') | ||
->exclude('vendor'); | ||
|
||
return $config; | ||
return $config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
language: php | ||
|
||
php: | ||
- 5.3 | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- hhvm | ||
- 5.3 | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- hhvm | ||
|
||
install: | ||
- travis_retry composer install --no-interaction --prefer-source | ||
|
||
before_script: | ||
- composer install | ||
script: | ||
- vendor/bin/phpunit | ||
- vendor/bin/phpcs -n --standard=phpcs.xml ./ | ||
- vendor/bin/php-cs-fixer --diff --dry-run -vv fix | ||
|
||
matrix: | ||
allow_failures: | ||
- php: hhvm | ||
- php: hhvm | ||
fast_finish: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="PsySH Coding Standard"> | ||
<description>The coding standard for PsySH</description> | ||
|
||
<exclude-pattern>*/bin/*</exclude-pattern> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
|
||
<rule ref="PSR2"> | ||
<exclude name="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma"/> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Psy Shell | ||
* | ||
* (c) 2012-2014 Justin Hileman | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Psy\CodeCleaner; | ||
|
||
use PhpParser\Node; | ||
use PhpParser\Node\Expr\Empty_ as ExprEmpty; | ||
use PhpParser\Node\Expr\Variable; | ||
use Psy\Exception\ParseErrorException; | ||
|
||
/** | ||
* Validate that the user did not call the language construct `empty()` on a | ||
* statement in PHP < 5.5. | ||
*/ | ||
class LegacyEmptyPass extends CodeCleanerPass | ||
{ | ||
/** | ||
* Validate use of empty in PHP < 5.5. | ||
* | ||
* @throws ParseErrorException if the user used empty with anything but a variable. | ||
* | ||
* @param Node $node | ||
*/ | ||
public function enterNode(Node $node) | ||
{ | ||
if (version_compare(PHP_VERSION, '5.5', '>=')) { | ||
return; | ||
} | ||
|
||
if (!$node instanceof ExprEmpty) { | ||
return; | ||
} | ||
|
||
if (!$node->expr instanceof Variable) { | ||
$msg = sprintf('syntax error, unexpected %s', $this->getUnexpectedThing($node->expr)); | ||
|
||
throw new ParseErrorException($msg, $node->expr->getLine()); | ||
} | ||
} | ||
|
||
private function getUnexpectedThing(Node $node) | ||
{ | ||
switch ($node->getType()) { | ||
case 'Scalar_String': | ||
case 'Scalar_LNumber': | ||
case 'Scalar_DNumber': | ||
return json_encode($node->value); | ||
|
||
case 'Expr_ConstFetch': | ||
return (string) $node->name; | ||
|
||
default: | ||
return $node->getType(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.