-
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
177 changed files
with
950 additions
and
295 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/** | ||
* This configuration will be read and overlaid on top of the | ||
* default configuration. Command line arguments will be applied | ||
* after this file is read. | ||
*/ | ||
return [ | ||
|
||
// A list of directories that should be parsed for class and | ||
// method information. After excluding the directories | ||
// defined in exclude_analysis_directory_list, the remaining | ||
// files will be statically analyzed for errors. | ||
// | ||
// Thus, both first-party and third-party code being used by | ||
// your application should be included in this list. | ||
'directory_list' => [ | ||
'src/', | ||
'vendor/dnoegel/php-xdg-base-dir/src/', | ||
'vendor/doctrine/instantiator/src/', | ||
'vendor/hoa/console/', | ||
'vendor/jakub-onderka/php-console-color/src/', | ||
'vendor/jakub-onderka/php-console-highlighter/src/', | ||
'vendor/nikic/php-parser/lib/', | ||
'vendor/phpdocumentor/reflection-docblock/', | ||
'vendor/symfony/console/', | ||
'vendor/symfony/filesystem/', | ||
'vendor/symfony/finder/', | ||
'vendor/symfony/var-dumper/', | ||
], | ||
|
||
// A directory list that defines files that will be excluded | ||
// from static analysis, but whose class and method | ||
// information should be included. | ||
// | ||
// Generally, you'll want to include the directories for | ||
// third-party code (such as "vendor/") in this list. | ||
// | ||
// n.b.: If you'd like to parse but not analyze 3rd | ||
// party code, directories containing that code | ||
// should be added to both the `directory_list` | ||
// and `exclude_analysis_directory_list` arrays. | ||
"exclude_analysis_directory_list" => [ | ||
'vendor/' | ||
], | ||
]; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ev | ||
|
||
cd "${BASH_SOURCE%/*}/.." | ||
|
||
echo "Building phar" | ||
./bin/build-vendor || exit 1 | ||
./bin/build-phar || exit 1 | ||
./bin/build-vendor | ||
./bin/build-phar | ||
|
||
echo "Building compat phar" | ||
./bin/build-vendor-compat || exit 1 | ||
./bin/build-vendor-compat | ||
./bin/build-phar --compat |
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ev | ||
|
||
cd "${BASH_SOURCE%/*}/.." | ||
|
||
rm -rf build-vendor | ||
|
||
COMPOSER_VENDOR_DIR=build-vendor composer update --prefer-stable --no-dev --no-progress --classmap-authoritative | ||
COMPOSER_VENDOR_DIR=build-vendor composer update --prefer-stable --no-dev --no-progress --classmap-authoritative --no-interaction --verbose |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Psy Shell. | ||
* | ||
* (c) 2012-2017 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\Stmt\Class_ as ClassStmt; | ||
use Psy\Exception\FatalErrorException; | ||
|
||
/** | ||
* The final class pass handles final classes. | ||
*/ | ||
class FinalClassPass extends CodeCleanerPass | ||
{ | ||
private $finalClasses; | ||
|
||
/** | ||
* @param array $nodes | ||
*/ | ||
public function beforeTraverse(array $nodes) | ||
{ | ||
$this->finalClasses = array(); | ||
} | ||
|
||
/** | ||
* @throws RuntimeException if the node is a class that extends a final class | ||
* | ||
* @param Node $node | ||
*/ | ||
public function enterNode(Node $node) | ||
{ | ||
if ($node instanceof ClassStmt) { | ||
if ($node->extends) { | ||
$extends = (string) $node->extends; | ||
if ($this->isFinalClass($extends)) { | ||
$msg = sprintf('Class %s may not inherit from final class (%s)', $node->name, $extends); | ||
throw new FatalErrorException($msg); | ||
} | ||
} | ||
|
||
if ($node->isFinal()) { | ||
$this->finalClasses[strtolower($node->name)] = true; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @param string $name Class name | ||
* | ||
* @return bool | ||
*/ | ||
private function isFinalClass($name) | ||
{ | ||
if (!class_exists($name)) { | ||
return isset($this->finalClasses[strtolower($name)]); | ||
} | ||
|
||
$refl = new \ReflectionClass($name); | ||
|
||
return $refl->isFinal(); | ||
} | ||
} |
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.