Skip to content

Commit

Permalink
Merge pull request #121 from carusogabriel/task/bump-cs
Browse files Browse the repository at this point in the history
Update to doctrine/cs v5
  • Loading branch information
Ocramius authored Apr 22, 2019
2 parents aefb49b + 95aecd6 commit 0e78dbd
Show file tree
Hide file tree
Showing 58 changed files with 189 additions and 176 deletions.
6 changes: 3 additions & 3 deletions bin/roave-backward-compatibility-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
use Symfony\Component\Console\Output\ConsoleOutput;
use function file_exists;

(function () : void {
(function () : void {
(static function () : void {
(static function () : void {
$autoloaderLocations = [
__DIR__ . '/../vendor/autoload.php', // Installed by cloning the project and running `composer install`
__DIR__ . '/../../../autoload.php', // Installed via `composer require`
Expand Down Expand Up @@ -65,7 +65,7 @@
new GetVersionCollectionFromGitRepository(),
new PickLastMinorVersionFromCollection(),
new LocateDependenciesViaComposer(
function (string $installationPath) use ($composerIo) : Installer {
static function (string $installationPath) use ($composerIo) : Installer {
return Installer::create(
$composerIo,
(new Factory())->createComposer(
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
}
],
"require-dev": {
"doctrine/coding-standard": "^4.0",
"doctrine/coding-standard": "^5.0",
"infection/infection": "^0.9.1",
"phpstan/phpstan": "^0.10.3",
"phpstan/phpstan-beberlei-assert": "^0.10",
"phpstan/phpstan-phpunit": "^0.10",
"phpunit/phpunit": "^7.0",
"roave/security-advisories": "dev-master",
"squizlabs/php_codesniffer": "^3.2",
"squizlabs/php_codesniffer": "^3.4",
"vimeo/psalm": "^2.0"
},
"autoload": {
Expand Down
79 changes: 40 additions & 39 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/CompareClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public function __invoke(
ClassReflector $newSourcesWithDependencies
) : Changes {
$definedApiClassNames = array_map(
function (ReflectionClass $class) : string {
static function (ReflectionClass $class) : string {
return $class->getName();
},
array_filter(
$definedSymbols->getAllClasses(),
function (ReflectionClass $class) : bool {
static function (ReflectionClass $class) : bool {
return ! $class->isAnonymous();
}
)
Expand Down
4 changes: 2 additions & 2 deletions src/DetectChanges/BCBreak/ClassBased/ConstantRemoved.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass) :
$this->accessibleConstants($toClass)
);

return Changes::fromList(...array_values(array_map(function (ReflectionClassConstant $constant) use ($fromClass) : Change {
return Changes::fromList(...array_values(array_map(static function (ReflectionClassConstant $constant) use ($fromClass) : Change {
return Change::removed(
sprintf('Constant %s::%s was removed', $fromClass->getName(), $constant->getName()),
true
Expand All @@ -34,7 +34,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass) :
/** @return ReflectionClassConstant[] */
private function accessibleConstants(ReflectionClass $class) : array
{
return array_filter($class->getReflectionConstants(), function (ReflectionClassConstant $constant) : bool {
return array_filter($class->getReflectionConstants(), static function (ReflectionClassConstant $constant) : bool {
return $constant->isPublic() || $constant->isProtected();
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/DetectChanges/BCBreak/ClassBased/MethodChanged.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private function methods(ReflectionClass $class) : array
$methods = $class->getMethods();

return array_combine(
array_map(function (ReflectionMethod $method) : string {
array_map(static function (ReflectionMethod $method) : string {
return strtolower($method->getName());
}, $methods),
$methods
Expand Down
4 changes: 2 additions & 2 deletions src/DetectChanges/BCBreak/ClassBased/MethodRemoved.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass) :
/** @return ReflectionMethod[] */
private function accessibleMethods(ReflectionClass $class) : array
{
$methods = array_filter($class->getMethods(), function (ReflectionMethod $method) : bool {
$methods = array_filter($class->getMethods(), static function (ReflectionMethod $method) : bool {
return $method->isPublic() || $method->isProtected();
});

return array_combine(
array_map(function (ReflectionMethod $method) : string {
array_map(static function (ReflectionMethod $method) : string {
return $method->getName();
}, $methods),
$methods
Expand Down
2 changes: 1 addition & 1 deletion src/DetectChanges/BCBreak/ClassBased/PropertyRemoved.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __invoke(ReflectionClass $fromClass, ReflectionClass $toClass) :
/** @return ReflectionProperty[] */
private function accessibleProperties(ReflectionClass $class) : array
{
return array_filter($class->getProperties(), function (ReflectionProperty $property) : bool {
return array_filter($class->getProperties(), static function (ReflectionProperty $property) : bool {
return $property->isPublic() || $property->isProtected();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ private function defaultParameterValues(ReflectionFunctionAbstract $function) :
{
$optionalParameters = array_values(array_filter(
$function->getParameters(),
function (ReflectionParameter $parameter) : bool {
static function (ReflectionParameter $parameter) : bool {
return $parameter->isDefaultValueAvailable();
}
));

return array_combine(
array_map(function (ReflectionParameter $parameter) : int {
array_map(static function (ReflectionParameter $parameter) : int {
return $parameter->getPosition();
}, $optionalParameters),
$optionalParameters
Expand Down
4 changes: 2 additions & 2 deletions src/DetectChanges/BCBreak/InterfaceBased/MethodAdded.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __invoke(ReflectionClass $fromInterface, ReflectionClass $toInte
return Changes::empty();
}

return Changes::fromList(...array_values(array_map(function (ReflectionMethod $method) use (
return Changes::fromList(...array_values(array_map(static function (ReflectionMethod $method) use (
$fromInterface
) : Change {
return Change::added(
Expand All @@ -47,7 +47,7 @@ private function methods(ReflectionClass $interface) : array
$methods = $interface->getMethods();

return array_combine(
array_map(function (ReflectionMethod $method) : string {
array_map(static function (ReflectionMethod $method) : string {
return strtolower($method->getName());
}, $methods),
$methods
Expand Down
3 changes: 2 additions & 1 deletion src/DetectChanges/Variance/TypeIsCovariant.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Roave\BackwardCompatibility\Support\ArrayHelpers;
use Roave\BetterReflection\Reflection\ReflectionType;
use Traversable;
use function strtolower;

/**
Expand Down Expand Up @@ -57,7 +58,7 @@ public function __invoke(
}

if (strtolower($typeAsString) === 'iterable' && ! $comparedType->isBuiltin()) {
if ($comparedType->targetReflectionClass()->implementsInterface(\Traversable::class)) {
if ($comparedType->targetReflectionClass()->implementsInterface(Traversable::class)) {
// `iterable` can be restricted via any `Iterator` implementation
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Factory/DirectoryReflectorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
use Roave\BetterReflection\SourceLocator\Type\SourceLocator;

/**
* @codeCoverageIgnore
*
* @deprecated this class builds a simplistic reflector with a DirectoriesSourceLocator around a given
* path: that is no longer the preferred approach.
* Please use {@see \Roave\BackwardCompatibilityCheck\Factory\ComposerInstallationReflectorFactory} instead.
*
* @codeCoverageIgnore
*/
final class DirectoryReflectorFactory
{
Expand Down
Loading

0 comments on commit 0e78dbd

Please sign in to comment.