Skip to content
Permalink
Browse files

Fix phpcs issues

  • Loading branch information
muglug committed Nov 11, 2019
1 parent af5f836 commit 96586f16c055d29e3640a7e949ff65be857af31c
@@ -141,13 +141,13 @@
</errorLevel>
</InternalMethod>

<PossiblyUndefinedArrayOffset>
<PossiblyUndefinedStringArrayOffset>
<errorLevel type="suppress">
<directory name="src/Psalm/Internal/Provider/ReturnTypeProvider" />
<file name="src/Psalm/Internal/Type/AssertionReconciler.php" />
<file name="src/Psalm/Internal/Type/NegatedAssertionReconciler.php" />
<directory name="tests"/>
</errorLevel>
</PossiblyUndefinedArrayOffset>
</PossiblyUndefinedStringArrayOffset>
</issueHandlers>
</psalm>
@@ -18,9 +18,9 @@ public function __construct(
$file_path,
$file_name
) {
/** @psalm-suppress PossiblyUndefinedArrayOffset */
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */
$this->file_start = (int)$error->getAttributes()['startFilePos'];
/** @psalm-suppress PossiblyUndefinedArrayOffset */
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */
$this->file_end = (int)$error->getAttributes()['endFilePos'];
$this->raw_file_start = $this->file_start;
$this->raw_file_end = $this->file_end;
@@ -314,7 +314,7 @@ public static function getReturnTypeFromCallMapWithArgs(
if (isset($first_arg->inferredType)) {
if ($first_arg->inferredType->hasArray()) {
/** @psalm-suppress PossiblyUndefinedArrayOffset */
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */
$array_type = $first_arg->inferredType->getTypes()['array'];
if ($array_type instanceof Type\Atomic\ObjectLike) {
return $array_type->getGenericValueType();
@@ -584,7 +584,7 @@ function (FunctionLikeParameter $p) {
) {
if ($this->function->inferredType) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var Type\Atomic\TFn
*/
$closure_atomic = \array_values($this->function->inferredType->getTypes())[0];
@@ -766,7 +766,7 @@ public static function handleIterable(
// The collection might be an iterator, in which case
// we want to call the iterator function
/** @psalm-suppress PossiblyUndefinedArrayOffset */
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */
if (!isset($generic_storage->template_type_extends['Traversable'])
|| ($generic_storage
->template_type_extends['Traversable']['TKey']->isMixed()
@@ -764,7 +764,7 @@ private static function handleByRefFunctionArg(
&& $arg->value->inferredType->hasArray()
) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var TArray|TList|ObjectLike
*/
$array_type = $arg->value->inferredType->getTypes()['array'];
@@ -844,7 +844,7 @@ private static function handleArrayAddition(
if (isset($array_arg->inferredType) && $array_arg->inferredType->hasArray()) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var TArray|ObjectLike|TList
*/
$array_type = $array_arg->inferredType->getTypes()['array'];
@@ -989,7 +989,7 @@ private static function handleArraySplice(
&& $replacement_arg->inferredType->hasArray()
) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var TArray|ObjectLike|TList
*/
$array_type = $array_arg->inferredType->getTypes()['array'];
@@ -999,7 +999,7 @@ private static function handleArraySplice(
}
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var TArray|ObjectLike|TList
*/
$replacement_array_type = $replacement_arg->inferredType->getTypes()['array'];
@@ -1465,7 +1465,7 @@ private static function checkFunctionLikeArgumentMatches(
&& $param_type->hasArray()
) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var TList|TArray
*/
$array_type = $param_type->getTypes()['array'];
@@ -1711,7 +1711,7 @@ private static function checkFunctionLikeTypeMatches(
if ($arg->unpack) {
if ($arg_type->hasArray()) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var Type\Atomic\TArray|Type\Atomic\TList|Type\Atomic\ObjectLike
*/
$array_atomic_type = $arg_type->getTypes()['array'];
@@ -1809,7 +1809,7 @@ private static function checkFunctionLikeTypeMatches(
if ($arg_type->hasArray()) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var Type\Atomic\TArray|Type\Atomic\TList|Type\Atomic\ObjectLike
*/
$array_atomic_type = $arg_type->getTypes()['array'];
@@ -1963,7 +1963,7 @@ protected static function checkArrayFunctionArgumentsMatch(
$array_arg = isset($arg->value) ? $arg->value : null;
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var ObjectLike|TArray|TList|null
*/
$array_arg_type = $array_arg
@@ -185,7 +185,7 @@ public static function analyze(
|| $stmt->var instanceof PhpParser\Node\Expr\ConstFetch)
) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var TArray|ObjectLike|TList
*/
$array_type = $stmt->var->inferredType->getTypes()['array'];
@@ -452,7 +452,7 @@ public static function analyze(
(string)$statements_analyzer->getFQCLN()
)
) {
/** @psalm-suppress PossiblyUndefinedArrayOffset */
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */
$use_context->vars_in_scope['$this'] = clone $context->vars_in_scope['$this'];
} elseif ($context->self) {
$use_context->vars_in_scope['$this'] = new Type\Union([new TNamedObject($context->self)]);
@@ -1944,7 +1944,6 @@ private static function isMatchingTypeContainedBy(
|| $input_param->hasLiteralValue()
) {
if (!$atomic_comparison_result->replacement_atomic_type) {
$atomic_comparison_result->replacement_atomic_type = clone $input_type_part;
}
@@ -134,7 +134,7 @@ public static function getMatchingCallableFromCallMapOptions(
if ($arg->unpack && !$function_param->is_variadic) {
if ($arg_type->hasArray()) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var Type\Atomic\TArray|Type\Atomic\ObjectLike|Type\Atomic\TList
*/
$array_atomic_type = $arg_type->getTypes()['array'];
@@ -58,7 +58,7 @@ public function collect() : array
* "TRAVIS", "TRAVIS_JOB_ID" must be set.
*
* @return $this
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
*/
protected function fillTravisCi() : self
{
@@ -134,7 +134,7 @@ protected function fillCircleCi() : self
* "APPVEYOR", "APPVEYOR_BUILD_NUMBER" must be set.
*
* @return $this
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
*/
protected function fillAppVeyor() : self
{
@@ -206,7 +206,7 @@ protected function fillJenkins() : self
* "JENKINS_URL", "BUILD_NUMBER" must be set.
*
* @return $this
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
*/
protected function fillScrutinizer() : self
{
@@ -202,7 +202,7 @@ function (
if (($call_arg_type = $call_args[$element_type_offset]->value->inferredType ?? null)) {
if ($call_arg_type->hasArray()) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var Type\Atomic\TArray|Type\Atomic\ObjectLike|Type\Atomic\TList
*/
$array_atomic_type = $call_arg_type->getTypes()['array'];
@@ -337,7 +337,7 @@ function (
if (($call_arg_type = $call_args[$element_type_offset]->value->inferredType ?? null)) {
if ($call_arg_type->hasArray()) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var Type\Atomic\TArray|Type\Atomic\ObjectLike|Type\Atomic\TList
*/
$array_atomic_type = $call_arg_type->getTypes()['array'];
@@ -795,7 +795,7 @@ private static function reconcileNonEmptyCountable(
$old_var_type_string = $existing_var_type->getId();
if ($existing_var_type->hasType('array')) {
/** @psalm-suppress PossiblyUndefinedArrayOffset */
/** @psalm-suppress PossiblyUndefinedStringArrayOffset */
$array_atomic_type = $existing_var_type->getTypes()['array'];
$did_remove_type = false;
@@ -2863,7 +2863,7 @@ private function improveParamsFromDocblock(
if (!$docblock_param_variadic && $storage_param->is_variadic && $new_param_type->hasArray()) {
/**
* @psalm-suppress PossiblyUndefinedArrayOffset
* @psalm-suppress PossiblyUndefinedStringArrayOffset
* @var Type\Atomic\TArray|Type\Atomic\ObjectLike|Type\Atomic\TList
*/
$array_type = $new_param_type->getTypes()['array'];
@@ -151,10 +151,6 @@ public function testInvalidCode($code, $error_message, $error_levels = [], $chec
$this->project_analyzer->getConfig()->ensure_array_string_offsets_exist = $is_array_offset_test;
$this->project_analyzer->getConfig()->ensure_array_int_offsets_exist = $is_array_offset_test;
if (strpos($error_message, 'ArrayOffset')) {
}
foreach ($error_levels as $error_level) {
$this->project_analyzer->getCodebase()->config->setCustomErrorLevel($error_level, Config::REPORT_SUPPRESS);
}

0 comments on commit 96586f1

Please sign in to comment.
You can’t perform that action at this time.