Skip to content

Commit a649981

Browse files
committed
Deprecate checkMissingIterableValueType and checkGenericClassInNonGenericObjectType in favour of ignoring via identifiers
1 parent 4eeb352 commit a649981

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

src/Command/CommandHelper.php

+44
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,50 @@ public static function begin(
479479
$errorOutput->writeLineFormatted(sprintf('Please implement PHPStan\Type\ExpressionTypeResolverExtension interface instead and register it as a service.'));
480480
}
481481

482+
if ($projectConfig !== null) {
483+
$parameters = $projectConfig['parameters'] ?? [];
484+
/** @var bool $checkMissingIterableValueType */
485+
$checkMissingIterableValueType = $parameters['checkMissingIterableValueType'] ?? true;
486+
if (!$checkMissingIterableValueType) {
487+
$errorOutput->writeLineFormatted('⚠️ You\'re using a deprecated config option <fg=cyan>checkMissingIterableValueType</> ⚠️️');
488+
$errorOutput->writeLineFormatted('');
489+
490+
$featureToggles = $container->getParameter('featureToggles');
491+
if (!((bool) $featureToggles['bleedingEdge'])) {
492+
$errorOutput->writeLineFormatted('It\'s strongly recommended to remove it from your configuration file');
493+
$errorOutput->writeLineFormatted('and add the missing array typehints.');
494+
$errorOutput->writeLineFormatted('');
495+
}
496+
497+
$errorOutput->writeLineFormatted('If you want to continue ignoring missing typehints from arrays,');
498+
$errorOutput->writeLineFormatted('add <fg=cyan>missingType.iterableValue</> error identifier to your <fg=cyan>ignoreErrors</>:');
499+
$errorOutput->writeLineFormatted('');
500+
$errorOutput->writeLineFormatted('parameters:');
501+
$errorOutput->writeLineFormatted("\tignoreErrors:");
502+
$errorOutput->writeLineFormatted("\t\t-");
503+
$errorOutput->writeLineFormatted("\t\t\tidentifier: missingType.iterableValue");
504+
$errorOutput->writeLineFormatted('');
505+
}
506+
507+
/** @var bool $checkGenericClassInNonGenericObjectType */
508+
$checkGenericClassInNonGenericObjectType = $parameters['checkGenericClassInNonGenericObjectType'] ?? true;
509+
if (!$checkGenericClassInNonGenericObjectType) {
510+
$errorOutput->writeLineFormatted('⚠️ You\'re using a deprecated config option <fg=cyan>checkGenericClassInNonGenericObjectType</> ⚠️️');
511+
$errorOutput->writeLineFormatted('');
512+
$errorOutput->writeLineFormatted('It\'s strongly recommended to remove it from your configuration file');
513+
$errorOutput->writeLineFormatted('and add the missing generic typehints.');
514+
$errorOutput->writeLineFormatted('');
515+
$errorOutput->writeLineFormatted('If you want to continue ignoring missing typehints from generics,');
516+
$errorOutput->writeLineFormatted('add <fg=cyan>missingType.generics</> error identifier to your <fg=cyan>ignoreErrors</>:');
517+
$errorOutput->writeLineFormatted('');
518+
$errorOutput->writeLineFormatted('parameters:');
519+
$errorOutput->writeLineFormatted("\tignoreErrors:");
520+
$errorOutput->writeLineFormatted("\t\t-");
521+
$errorOutput->writeLineFormatted("\t\t\tidentifier: missingType.generics");
522+
$errorOutput->writeLineFormatted('');
523+
}
524+
}
525+
482526
$tempResultCachePath = $container->getParameter('tempResultCachePath');
483527
$createDir($tempResultCachePath);
484528

0 commit comments

Comments
 (0)