diff --git a/app/Repository/ToolRepository.php b/app/Repository/ToolRepository.php index a2bbfe6b1db..fd3f6385cc5 100644 --- a/app/Repository/ToolRepository.php +++ b/app/Repository/ToolRepository.php @@ -36,7 +36,17 @@ public function fetchAll(): array 'https://tomasvotruba.com/blog/how-to-measure-your-type-coverage', 'composer require tomasvotruba/type-coverage --dev', [], - true + true, + <<<'PHPSTAN' +parameters: + type_coverage: + return: 5 + param: 5 + # enable on PHP 7.4+ + # property: 5 + # enable on PHP 8.3+ + # constant: 5 +PHPSTAN ); $tools[] = new Tool( @@ -59,7 +69,16 @@ public function fetchAll(): array 'https://tomasvotruba.com/blog/can-phpstan-find-dead-public-methods/', 'composer require tomasvotruba/unused-public --dev', [], - true + true, + <<<'PHPSTAN' +parameters: + unused_public: + constants: true + # handle one by one + # properties: true + # methods: true +PHPSTAN + ); $tools[] = new Tool( @@ -83,7 +102,17 @@ public function fetchAll(): array 'https://getrector.com/blog/introducing-type-perfect-for-extra-safety', 'composer require rector/type-perfect --dev', [], - true + true, + <<<'PHPSTAN' +parameters: + type_perfect: + null_over_false: true + # enable one a by one + # no_mixed: true + # narrow_param: true + # narrow_return: true +PHPSTAN + ); $tools[] = new Tool( diff --git a/app/ValueObject/Tool.php b/app/ValueObject/Tool.php index d5f75f45e25..bb7be282c0f 100644 --- a/app/ValueObject/Tool.php +++ b/app/ValueObject/Tool.php @@ -20,6 +20,7 @@ public function __construct( private string $composer, private array $tryCommands = [], private bool $isPhpstanExtension = false, + private ?string $phpstanContents = null, ) { Assert::allString(array_keys($tryCommands)); Assert::allString($tryCommands); @@ -50,7 +51,7 @@ public function getPost(): ?string return $this->post; } - public function getComposer(): ?string + public function getComposer(): string { return $this->composer; } @@ -72,4 +73,9 @@ public function getSlug(): string { return str($this->name)->slug()->toString(); } + + public function getPhpstanContents(): ?string + { + return $this->phpstanContents; + } } diff --git a/resources/css/app.scss b/resources/css/app.scss index 69e53510e76..3576f7325f1 100644 --- a/resources/css/app.scss +++ b/resources/css/app.scss @@ -396,3 +396,12 @@ pre.shiki { margin-right: 1rem; flex-shrink: 0; } + +// hover of badge +a > .text-bg-dark { + background-color: rgba(77, 81, 84, 0.82) !important; + + &:hover { + background-color: #4d5154 !important; + } +} diff --git a/resources/views/tools.blade.php b/resources/views/tools.blade.php index 8dd18bf7a17..9ba4490840b 100644 --- a/resources/views/tools.blade.php +++ b/resources/views/tools.blade.php @@ -27,23 +27,22 @@
- - + -  Github + +
GitHub
- -

{{ $tool->getName() }}

- @if ($tool->isPhpstanExtension())
PHPStan extension
@endif +

{{ $tool->getName() }}

+

Why use? -

+

+

{{ $tool->getWhy() }}

@@ -57,30 +56,40 @@

- @if ($tool->getComposer()) -
+
-
- @endif +
@if ($tool->getTryCommands())
First commands to try
+ + @foreach ($tool->getTryCommands() as $label => $tryCommand) +
+
+ + +
+
+ @endforeach @endif - @foreach ($tool->getTryCommands() as $label => $tryCommand) + @if ($tool->getPhpstanContents()) +
+ Copy-paste to phpstan.neon +
+
-
- - +
+
- @endforeach -
+ @endif +
@endforeach @@ -95,5 +104,20 @@ this.select(); }; }); + + // make textarea as long to fit the contents + function autoResize(textarea) { + // Reset height to handle reducing content + textarea.style.height = 'auto'; + // Set height to match the scroll height (content height) + textarea.style.height = textarea.scrollHeight + 5 + 'px'; + } + + // Trigger resize for all textareas with the class "autoresize" on page load + document.addEventListener('DOMContentLoaded', function() { + document.querySelectorAll('.autoresize').forEach(textarea => { + autoResize(textarea); + }); + }); @endsection