Skip to content

Commit

Permalink
Merge 194c4ee into 735cd11
Browse files Browse the repository at this point in the history
  • Loading branch information
jaapio committed Jan 13, 2018
2 parents 735cd11 + 194c4ee commit 5b5127d
Show file tree
Hide file tree
Showing 350 changed files with 2,049 additions and 3,502 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -37,7 +37,6 @@ jobs:
- composer create-project symplify/easy-coding-standard temp/ecs
script:
- temp/ecs/bin/ecs check src tests
- vendor/bin/phpstan analyse src --level max --configuration phpstan.neon
- docker-compose run --rm phpstan

- stage: release
Expand Down
31 changes: 27 additions & 4 deletions easy-coding-standard.neon
Expand Up @@ -3,10 +3,6 @@ includes:
- temp/ecs/config/psr2.neon
- temp/ecs/config/common.neon

checkers:
PhpCsFixer\Fixer\Operator\ConcatSpaceFixer:
spacing: one

parameters:
exclude_checkers:
# from temp/ecs/config/common.neon
Expand All @@ -19,3 +15,30 @@ parameters:
skip:
PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff:
- */tests/**
PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff:
- */tests/data/**
PhpCsFixer\Fixer\Basic\Psr4Fixer:
- */tests/data/**
- */tests/features/assets/**
Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDocBlockFixer:
- */tests/data/**
- */tests/features/assets/**
PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\UpperCaseConstantNameSniff:
- */tests/data/file-level/PackagePrecedesDefine.php
- */tests/data/file-level/NoPackagePrecedesDefine.php
SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff:
- */tests/data/**
- */tests/ReferenceImplementation.php
- */phpDocumentor/Compiler/Pass/ResolveInlineLinkAndSeeTags.php
PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope\MethodScopeSniff:
- */tests/data/**
PhpCsFixer\Fixer\Import\NoUnusedImportsFixer:
- */tests/features/assets/singlefile/syntax/groupedUse.php
PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer:
- */tests/features/assets/singlefile/syntax/groupedUse.php
PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer:
- */tests/data/NoShortDescription.php
PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer:
- */tests/data/NoShortDescription.php
Symplify\CodingStandard\Fixer\Commenting\RemoveEmptyDocBlockFixer:
- */tests/data/NoShortDescription.php
11 changes: 6 additions & 5 deletions src/Cilex/Provider/JmsSerializerServiceProvider.php
Expand Up @@ -12,10 +12,10 @@
namespace Cilex\Provider;

use Cilex\Application;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Doctrine\Common\Annotations\AnnotationRegistry;
use JMS\Serializer\SerializerBuilder;
use Pimple\Container;
use Pimple\ServiceProviderInterface;

/**
* Cilex Service Provider to provide serialization services.
Expand All @@ -36,9 +36,9 @@ public function register(Container $app)
$serializerPath = __DIR__ . '/../../../../../jms/serializer/src';
}

$app['serializer.annotations'] = array(
array('namespace' => 'JMS\Serializer\Annotation', 'path' => $serializerPath)
);
$app['serializer.annotations'] = [
['namespace' => 'JMS\Serializer\Annotation', 'path' => $serializerPath],
];

$app['serializer'] = function ($container) {
if (!isset($container['serializer.annotations']) || !is_array($container['serializer.annotations'])) {
Expand All @@ -55,6 +55,7 @@ public function register(Container $app)
. 'serializer what the namespace for the provided annotations are.'
);
}

if (!isset($annotationsDefinition['path'])) {
throw new \UnexpectedValueException(
'The annotation definition for the Serializer should have a key "path" that tells the '
Expand Down
2 changes: 1 addition & 1 deletion src/Cilex/Provider/MonologServiceProvider.php
Expand Up @@ -10,8 +10,8 @@

namespace Cilex\Provider;

use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;

use Pimple\Container;
use Pimple\ServiceProviderInterface;
Expand Down
43 changes: 12 additions & 31 deletions src/phpDocumentor/Application.php
Expand Up @@ -14,7 +14,6 @@
use Cilex\Application as Cilex;
use Cilex\Provider\JmsSerializerServiceProvider;
use Cilex\Provider\MonologServiceProvider;
use Cilex\Provider\ValidatorServiceProvider;
use Composer\Autoload\ClassLoader;
use Monolog\ErrorHandler;
use Monolog\Handler\NullHandler;
Expand All @@ -26,7 +25,6 @@
use Symfony\Component\Console\Application as ConsoleApplication;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Shell;
use Symfony\Component\Stopwatch\Stopwatch;

/**
Expand All @@ -43,9 +41,8 @@ class Application extends Cilex
* Initializes all components used by phpDocumentor.
*
* @param ClassLoader $autoloader
* @param array $values
*/
public function __construct($autoloader = null, array $values = array())
public function __construct($autoloader = null, array $values = [])
{
$this->defineIniSettings();

Expand Down Expand Up @@ -89,8 +86,6 @@ public function __construct($autoloader = null, array $values = array())
* @param integer $level The minimum level that will be written to the normal logfile; matches one of the
* constants in {@see \Monolog\Logger}.
* @param string $logPath The full path where the normal log file needs to be written.
*
* @return void
*/
public function configureLogger($logger, $level, $logPath = null)
{
Expand Down Expand Up @@ -131,8 +126,8 @@ public function configureLogger($logger, $level, $logPath = null)
$this['monolog.level'] = $level;
if ($logPath) {
$logPath = str_replace(
array('{APP_ROOT}', '{DATE}'),
array(realpath(__DIR__ . '/../..'), $this['kernel.timer.start']),
['{APP_ROOT}', '{DATE}'],
[realpath(__DIR__ . '/../..'), $this['kernel.timer.start']],
$logPath
);
$this['monolog.logfile'] = $logPath;
Expand Down Expand Up @@ -162,8 +157,6 @@ public function configureLogger($logger, $level, $logPath = null)
}

/**
* @param null|InputInterface $input
* @param null|OutputInterface $output
* @return mixed
*/
public function run(InputInterface $input = null, OutputInterface $output = null)
Expand All @@ -180,11 +173,8 @@ public function run(InputInterface $input = null, OutputInterface $output = null
return parent::run(new ArgvInput(), $output);
}


/**
* Adjust php.ini settings.
*
* @return void
*/
protected function defineIniSettings()
{
Expand All @@ -201,9 +191,10 @@ protected function defineIniSettings()
}
}

if (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.save_comments') == 0) {
if (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.save_comments') === 0) {
throw new \RuntimeException('Please enable zend_optimizerplus.save_comments in php.ini.');
}

// @codeCoverageIgnoreEnd
}

Expand All @@ -218,12 +209,10 @@ protected function defineIniSettings()
* default timezone.
*
* @codeCoverageIgnore this method is very hard, if not impossible, to unit test and not critical.
*
* @return void
*/
protected function setTimezone()
{
if (false == ini_get('date.timezone')
if (false === ini_get('date.timezone')
|| (version_compare(phpversion(), '5.4.0', '<') && false === getenv('TZ'))
) {
date_default_timezone_set('UTC');
Expand All @@ -232,27 +221,25 @@ protected function setTimezone()

/**
* Adds a logging provider to the container of phpDocumentor.
*
* @return void
*/
protected function addLogging()
{
$this->register(
new MonologServiceProvider(),
array(
'monolog.name' => 'phpDocumentor',
'monolog.logfile' => sys_get_temp_dir() . '/phpdoc.log',
[
'monolog.name' => 'phpDocumentor',
'monolog.logfile' => sys_get_temp_dir() . '/phpdoc.log',
'monolog.debugfile' => sys_get_temp_dir() . '/phpdoc.debug.log',
'monolog.level' => Logger::INFO,
)
'monolog.level' => Logger::INFO,
]
);

$app = $this;
/** @var Configuration $configuration */
$configuration = $this['config'];
$this['monolog.configure'] = $this->protect(
function ($log) use ($app, $configuration) {
$paths = $configuration->getLogging()->getPaths();
$paths = $configuration->getLogging()->getPaths();
$logLevel = $configuration->getLogging()->getLevel();

$app->configureLogger($log, $logLevel, $paths['default']);
Expand All @@ -274,8 +261,6 @@ function (ConsoleApplication $console) use ($configuration) {

/**
* Adds the event dispatcher to phpDocumentor's container.
*
* @return void
*/
protected function addEventDispatcher()
{
Expand All @@ -286,8 +271,6 @@ protected function addEventDispatcher()

/**
* Adds the command to phpDocumentor that belong to the Project namespace.
*
* @return void
*/
protected function addCommandsForProjectNamespace()
{
Expand All @@ -296,8 +279,6 @@ protected function addCommandsForProjectNamespace()

/**
* Adds the command to phpDocumentor that belong to the Phar namespace.
*
* @return void
*/
protected function addCommandsForPharNamespace()
{
Expand Down
4 changes: 2 additions & 2 deletions src/phpDocumentor/Bootstrap.php
Expand Up @@ -59,7 +59,7 @@ public function initialize()

$autoloader = $this->createAutoloader($vendorPath);

return new Application($autoloader, array('composer.vendor_path' => $vendorPath));
return new Application($autoloader, ['composer.vendor_path' => $vendorPath]);
}

/**
Expand Down Expand Up @@ -136,7 +136,7 @@ public function findVendorPath($baseDir = __DIR__)

// Composerised installation, vendor/phpdocumentor/phpdocumentor/src/phpDocumentor is __DIR__
$rootFolderWhenInstalledWithComposer = $baseDir . '/../../../../../';
$composerConfigurationPath = $rootFolderWhenInstalledWithComposer .'composer.json';
$composerConfigurationPath = $rootFolderWhenInstalledWithComposer . 'composer.json';
if (file_exists($composerConfigurationPath)) {
$vendorDir = $rootFolderWhenInstalledWithComposer
. $this->getCustomVendorPathFromComposer($composerConfigurationPath);
Expand Down
4 changes: 0 additions & 4 deletions src/phpDocumentor/Command/Command.php
Expand Up @@ -27,8 +27,6 @@ class Command extends BaseCommand
{
/**
* Registers the current command.
*
* @param HelperSet $helperSet
*/
public function setHelperSet(HelperSet $helperSet)
{
Expand All @@ -42,8 +40,6 @@ public function setHelperSet(HelperSet $helperSet)
*
* With this helper it is possible to display a progress bar and make it fill.
*
* @param InputInterface $input
*
* @return ProgressHelper
*/
protected function getProgressBar(InputInterface $input)
Expand Down
6 changes: 2 additions & 4 deletions src/phpDocumentor/Command/Helper/ConfigurationHelper.php
Expand Up @@ -24,8 +24,6 @@ class ConfigurationHelper extends Helper

/**
* Initializes this helper and registers the application configuration on it.
*
* @param Configuration $configuration
*/
public function __construct(Configuration $configuration)
{
Expand Down Expand Up @@ -75,7 +73,7 @@ public function getOption(

// use default if value is still null
if ($this->valueIsEmpty($value)) {
return (is_array($value) && $default === null) ? array() : $default;
return (is_array($value) && $default === null) ? [] : $default;
}

return $commaSeparated
Expand All @@ -92,7 +90,7 @@ public function getOption(
*/
protected function splitCommaSeparatedValues($value)
{
if (!is_array($value) || (count($value) == 1) && is_string(current($value))) {
if (!is_array($value) || (count($value) === 1) && is_string(current($value))) {
$value = (array) $value;
$value = explode(',', $value[0]);
}
Expand Down

0 comments on commit 5b5127d

Please sign in to comment.