Aggiornato Composer
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace Psy\Command\ListCommand;
|
||||
|
||||
use Psy\Reflection\ReflectionClassConstant;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
|
||||
/**
|
||||
@@ -22,7 +21,7 @@ class ClassConstantEnumerator extends Enumerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
// only list constants when a Reflector is present.
|
||||
if ($reflector === null) {
|
||||
@@ -56,18 +55,18 @@ class ClassConstantEnumerator extends Enumerator
|
||||
/**
|
||||
* Get defined constants for the given class or object Reflector.
|
||||
*
|
||||
* @param \Reflector $reflector
|
||||
* @param bool $noInherit Exclude inherited constants
|
||||
* @param \ReflectionClass $reflector
|
||||
* @param bool $noInherit Exclude inherited constants
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getConstants(\Reflector $reflector, bool $noInherit = false): array
|
||||
protected function getConstants(\ReflectionClass $reflector, bool $noInherit = false): array
|
||||
{
|
||||
$className = $reflector->getName();
|
||||
|
||||
$constants = [];
|
||||
foreach ($reflector->getConstants() as $name => $constant) {
|
||||
$constReflector = ReflectionClassConstant::create($reflector->name, $name);
|
||||
$constReflector = new \ReflectionClassConstant($reflector->name, $name);
|
||||
|
||||
if ($noInherit && $constReflector->getDeclaringClass()->getName() !== $className) {
|
||||
continue;
|
||||
@@ -110,8 +109,6 @@ class ClassConstantEnumerator extends Enumerator
|
||||
* Get a label for the particular kind of "class" represented.
|
||||
*
|
||||
* @param \ReflectionClass $reflector
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKindLabel(\ReflectionClass $reflector): string
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -22,7 +22,7 @@ class ClassEnumerator extends Enumerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
// if we have a reflector, ensure that it's a namespace reflector
|
||||
if (($target !== null || $reflector !== null) && !$reflector instanceof ReflectionNamespace) {
|
||||
@@ -66,7 +66,7 @@ class ClassEnumerator extends Enumerator
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function filterClasses(string $key, array $classes, bool $internal, bool $user, string $prefix = null): array
|
||||
protected function filterClasses(string $key, array $classes, bool $internal, bool $user, ?string $prefix = null): array
|
||||
{
|
||||
$ret = [];
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -49,7 +49,7 @@ class ConstantEnumerator extends Enumerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
// if we have a reflector, ensure that it's a namespace reflector
|
||||
if (($target !== null || $reflector !== null) && !$reflector instanceof ReflectionNamespace) {
|
||||
@@ -122,7 +122,7 @@ class ConstantEnumerator extends Enumerator
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getConstants(string $category = null): array
|
||||
protected function getConstants(?string $category = null): array
|
||||
{
|
||||
if (!$category) {
|
||||
return \get_defined_constants();
|
||||
@@ -133,7 +133,7 @@ class ConstantEnumerator extends Enumerator
|
||||
if ($category === 'internal') {
|
||||
unset($consts['user']);
|
||||
|
||||
return \call_user_func_array('array_merge', \array_values($consts));
|
||||
return \array_merge(...\array_values($consts));
|
||||
}
|
||||
|
||||
foreach ($consts as $key => $value) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -54,7 +54,7 @@ abstract class Enumerator
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function enumerate(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
public function enumerate(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
$this->filter->bind($input);
|
||||
|
||||
@@ -82,7 +82,7 @@ abstract class Enumerator
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
abstract protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array;
|
||||
abstract protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array;
|
||||
|
||||
protected function showItem($name)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -22,7 +22,7 @@ class FunctionEnumerator extends Enumerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
// if we have a reflector, ensure that it's a namespace reflector
|
||||
if (($target !== null || $reflector !== null) && !$reflector instanceof ReflectionNamespace) {
|
||||
@@ -67,7 +67,7 @@ class FunctionEnumerator extends Enumerator
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getFunctions(string $type = null): array
|
||||
protected function getFunctions(?string $type = null): array
|
||||
{
|
||||
$funcs = \get_defined_functions();
|
||||
|
||||
@@ -86,7 +86,7 @@ class FunctionEnumerator extends Enumerator
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function prepareFunctions(array $functions, string $prefix = null): array
|
||||
protected function prepareFunctions(array $functions, ?string $prefix = null): array
|
||||
{
|
||||
\natcasesort($functions);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -21,7 +21,7 @@ class GlobalVariableEnumerator extends Enumerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
// only list globals when no Reflector is present.
|
||||
if ($reflector !== null || $target !== null) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -21,7 +21,7 @@ class MethodEnumerator extends Enumerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
// only list methods when a Reflector is present.
|
||||
if ($reflector === null) {
|
||||
@@ -55,13 +55,13 @@ class MethodEnumerator extends Enumerator
|
||||
/**
|
||||
* Get defined methods for the given class or object Reflector.
|
||||
*
|
||||
* @param bool $showAll Include private and protected methods
|
||||
* @param \Reflector $reflector
|
||||
* @param bool $noInherit Exclude inherited methods
|
||||
* @param bool $showAll Include private and protected methods
|
||||
* @param \ReflectionClass $reflector
|
||||
* @param bool $noInherit Exclude inherited methods
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getMethods(bool $showAll, \Reflector $reflector, bool $noInherit = false): array
|
||||
protected function getMethods(bool $showAll, \ReflectionClass $reflector, bool $noInherit = false): array
|
||||
{
|
||||
$className = $reflector->getName();
|
||||
|
||||
@@ -112,8 +112,6 @@ class MethodEnumerator extends Enumerator
|
||||
* Get a label for the particular kind of "class" represented.
|
||||
*
|
||||
* @param \ReflectionClass $reflector
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKindLabel(\ReflectionClass $reflector): string
|
||||
{
|
||||
@@ -130,8 +128,6 @@ class MethodEnumerator extends Enumerator
|
||||
* Get output style for the given method's visibility.
|
||||
*
|
||||
* @param \ReflectionMethod $method
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getVisibilityStyle(\ReflectionMethod $method): string
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -21,7 +21,7 @@ class PropertyEnumerator extends Enumerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
// only list properties when a Reflector is present.
|
||||
|
||||
@@ -56,13 +56,13 @@ class PropertyEnumerator extends Enumerator
|
||||
/**
|
||||
* Get defined properties for the given class or object Reflector.
|
||||
*
|
||||
* @param bool $showAll Include private and protected properties
|
||||
* @param \Reflector $reflector
|
||||
* @param bool $noInherit Exclude inherited properties
|
||||
* @param bool $showAll Include private and protected properties
|
||||
* @param \ReflectionClass $reflector
|
||||
* @param bool $noInherit Exclude inherited properties
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getProperties(bool $showAll, \Reflector $reflector, bool $noInherit = false): array
|
||||
protected function getProperties(bool $showAll, \ReflectionClass $reflector, bool $noInherit = false): array
|
||||
{
|
||||
$className = $reflector->getName();
|
||||
|
||||
@@ -112,8 +112,6 @@ class PropertyEnumerator extends Enumerator
|
||||
* Get a label for the particular kind of "class" represented.
|
||||
*
|
||||
* @param \ReflectionClass $reflector
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getKindLabel(\ReflectionClass $reflector): string
|
||||
{
|
||||
@@ -128,8 +126,6 @@ class PropertyEnumerator extends Enumerator
|
||||
* Get output style for the given property's visibility.
|
||||
*
|
||||
* @param \ReflectionProperty $property
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getVisibilityStyle(\ReflectionProperty $property): string
|
||||
{
|
||||
@@ -147,8 +143,6 @@ class PropertyEnumerator extends Enumerator
|
||||
*
|
||||
* @param \ReflectionProperty $property
|
||||
* @param mixed $target
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function presentValue(\ReflectionProperty $property, $target): string
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2022 Justin Hileman
|
||||
* (c) 2012-2023 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -45,7 +45,7 @@ class VariableEnumerator extends Enumerator
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function listItems(InputInterface $input, \Reflector $reflector = null, $target = null): array
|
||||
protected function listItems(InputInterface $input, ?\Reflector $reflector = null, $target = null): array
|
||||
{
|
||||
// only list variables when no Reflector is present.
|
||||
if ($reflector !== null || $target !== null) {
|
||||
|
||||
Reference in New Issue
Block a user