Skip to content

Commit 13cf46e

Browse files
committed
chore: adjusts tests
1 parent 4f926b5 commit 13cf46e

17 files changed

+17
-79
lines changed

src/Application/Adapters/Laravel/Commands/InsightsCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ final class InsightsCommand extends Command
2626
' <options=bold>https://github.com/nunomaduro/phpinsights</>',
2727
' - Sponsor the maintainers:',
2828
' <options=bold>https://github.com/sponsors/nunomaduro</>',
29+
' - Subscribe my YouTube channel:',
30+
' <options=bold>https://www.youtube.com/@nunomaduro</>',
2931
];
3032

3133
protected $name = 'insights';

src/Application/Adapters/Laravel/InsightsServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function boot(): void
2626
/**
2727
* @noRector Rector\DeadCode\Rector\If_\RemoveDeadInstanceOfRector
2828
*/
29-
if ($this->app instanceof Application) {
29+
if ($this->app instanceof Application) { // @phpstan-ignore-line
3030
$this->publishes([
3131
__DIR__ . '/../../../../stubs/laravel.php' => $this->app->configPath('insights.php'),
3232
], 'config');

src/Application/ConfigResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function resolve(array $config, InputInterface $input): Configurat
5454
$preset = $config['preset'] ?? self::guess($composer);
5555

5656
/** @var Preset $presetClass */
57-
foreach (self::PRESETS as $presetClass) {
57+
foreach (self::PRESETS as $presetClass) { // @phpstan-ignore-line
5858
if ($presetClass::getName() === $preset) {
5959
$presetData = self::preparePreset($presetClass::get($composer), $config);
6060
$config = self::mergeConfig($presetData, $config);

src/Application/Console/Commands/InternalProcessorCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ private function loadInsights(string $metricClass): array
123123
$insights = array_diff($insights, $this->configuration->getRemoves());
124124

125125
$insightsAdded = [];
126-
$path = (string) (getcwd() ?? $this->configuration->getCommonPath());
126+
$path = (string) (getcwd() ?: $this->configuration->getCommonPath());
127127
$collector = new Collector([], $path);
128128
foreach ($insights as $insight) {
129129
/** @var InsightLoader $loader */

src/Application/Console/Commands/InvokableCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ final class InvokableCommand extends BaseCommand
1717
' <options=bold>https://github.com/nunomaduro/phpinsights</>',
1818
' - Sponsor the maintainers:',
1919
' <options=bold>https://github.com/sponsors/nunomaduro</>',
20+
' - Subscribe my YouTube channel:',
21+
' <options=bold>https://www.youtube.com/@nunomaduro</>',
2022
];
2123

2224
/**

src/Application/Console/Formatters/Console.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public function __construct(InputInterface $input, OutputInterface $output)
117117
$this->totalWidth = (new Terminal())->getWidth();
118118

119119
$outputFormatterStyle = new OutputFormatterStyle();
120-
$this->supportHyperLinks = method_exists($outputFormatterStyle, 'setHref');
120+
$this->supportHyperLinks = method_exists($outputFormatterStyle, 'setHref'); // @phpstan-ignore-line
121121
}
122122

123123
/**

src/Application/Console/Formatters/PathShortener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public static function extractCommonPath(array $paths): string
3030
$index++;
3131
}
3232

33-
$prefix = mb_substr($first, 0, $index ?? 0);
33+
$prefix = mb_substr($first, 0, $index ? $index : 0);
3434

3535
return mb_substr($prefix, 0, (int) mb_strrpos($prefix, DIRECTORY_SEPARATOR) + 1);
3636
}

src/Application/Console/OutputDecorator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static function decorate(OutputInterface $output): OutputInterface
2626
{
2727
foreach (self::STYLES as $styleClass) {
2828
/** @var Style $style */
29-
$style = new $styleClass();
29+
$style = new $styleClass(); // @phpstan-ignore-line
3030

3131
$style->addTo($output);
3232
}

src/Application/Console/Style.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function waitForKey(string $category): Style
3737
if ($stdin !== false && $this->output instanceof ConsoleOutput && $this->input->isInteractive()) {
3838
$this->newLine();
3939
/** @var ConsoleSectionOutput $section */
40-
$section = $this->output->section();
40+
$section = $this->output->section(); // @phpstan-ignore-line
4141
$section->writeln(sprintf('<title>Press enter to see %s issues...</title>', strtolower($category)));
4242
fgetc($stdin);
4343
$section->clear(3);

src/Application/DefaultPreset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static function get(Composer $composer): array
5252
'ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach' => true,
5353
],
5454
PropertyTypeHintSniff::class => [
55-
'enableNativeTypeHint' => PHP_VERSION_ID >= 70_400,
55+
'enableNativeTypeHint' => true,
5656
],
5757
],
5858
];

0 commit comments

Comments
 (0)