Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
chore: configure PHPStan Level 6 and resolve strict-type warnings
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
parameters:
|
||||||
|
level: 6
|
||||||
|
paths:
|
||||||
|
- src
|
||||||
@@ -16,7 +16,7 @@ use YakNet\AccessibilityConsole\Source\SourceLocator;
|
|||||||
|
|
||||||
class ScanCommand extends Command
|
class ScanCommand extends Command
|
||||||
{
|
{
|
||||||
protected static $defaultName = 'scan';
|
protected static ?string $defaultName = 'scan';
|
||||||
|
|
||||||
protected function configure(): void
|
protected function configure(): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ namespace YakNet\AccessibilityConsole\Core;
|
|||||||
|
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
|
/** @var array<string, mixed> */
|
||||||
private array $settings = [];
|
private array $settings = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<string, mixed> $settings
|
||||||
|
*/
|
||||||
public function __construct(array $settings = [])
|
public function __construct(array $settings = [])
|
||||||
{
|
{
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace YakNet\AccessibilityConsole\Core;
|
|||||||
|
|
||||||
class RuleEngine
|
class RuleEngine
|
||||||
{
|
{
|
||||||
/** @var array */
|
/** @var array<int, mixed> */
|
||||||
private array $rules = [];
|
private array $rules = [];
|
||||||
|
|
||||||
public function addRule(mixed $rule): void
|
public function addRule(mixed $rule): void
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ namespace YakNet\AccessibilityConsole\Core;
|
|||||||
|
|
||||||
class Violation
|
class Violation
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @param array{file: string, line: int}|null $location
|
||||||
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public string $ruleId,
|
public string $ruleId,
|
||||||
public string $message,
|
public string $message,
|
||||||
@@ -14,6 +17,9 @@ class Violation
|
|||||||
public ?string $fixSuggestion = null
|
public ?string $fixSuggestion = null
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{ruleId: string, message: string, severity: string, standard: string, htmlSnippet: string, location: array{file: string, line: int}|null, fixSuggestion: string|null}
|
||||||
|
*/
|
||||||
public function toArray(): array
|
public function toArray(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use YakNet\AccessibilityConsole\Core\WCAGStandard;
|
|||||||
|
|
||||||
class AriaRole extends AbstractRule
|
class AriaRole extends AbstractRule
|
||||||
{
|
{
|
||||||
|
/** @var array<int, string> */
|
||||||
private static array $validRoles = [
|
private static array $validRoles = [
|
||||||
'alert', 'alertdialog', 'application', 'article', 'banner', 'button', 'cell', 'checkbox',
|
'alert', 'alertdialog', 'application', 'article', 'banner', 'button', 'cell', 'checkbox',
|
||||||
'columnheader', 'combobox', 'complementary', 'contentinfo', 'definition', 'dialog', 'directory',
|
'columnheader', 'combobox', 'complementary', 'contentinfo', 'definition', 'dialog', 'directory',
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ class ColorContrast extends AbstractRule
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{0: int, 1: int, 2: int}|null
|
||||||
|
*/
|
||||||
private function hexToRgb(string $hex): ?array
|
private function hexToRgb(string $hex): ?array
|
||||||
{
|
{
|
||||||
$hex = ltrim($hex, '#');
|
$hex = ltrim($hex, '#');
|
||||||
|
|||||||
@@ -8,12 +8,16 @@ use SplFileInfo;
|
|||||||
|
|
||||||
class SourceLocator
|
class SourceLocator
|
||||||
{
|
{
|
||||||
|
/** @var array<int, string> */
|
||||||
private array $extensions = ['php', 'html', 'twig', 'blade.php'];
|
private array $extensions = ['php', 'html', 'twig', 'blade.php'];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly string $searchPath
|
private readonly string $searchPath
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{file: string, line: int}|null
|
||||||
|
*/
|
||||||
public function locate(string $snippet): ?array
|
public function locate(string $snippet): ?array
|
||||||
{
|
{
|
||||||
if (!is_dir($this->searchPath) || !is_readable($this->searchPath)) {
|
if (!is_dir($this->searchPath) || !is_readable($this->searchPath)) {
|
||||||
@@ -76,6 +80,9 @@ class SourceLocator
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{type: string, score?: float, location?: array{file: string, line: int}}
|
||||||
|
*/
|
||||||
private function searchInFile(string $filepath, string $searchSnippet, string $fullSnippet): array
|
private function searchInFile(string $filepath, string $searchSnippet, string $fullSnippet): array
|
||||||
{
|
{
|
||||||
$content = file_get_contents($filepath);
|
$content = file_get_contents($filepath);
|
||||||
@@ -118,6 +125,9 @@ class SourceLocator
|
|||||||
return ['type' => 'none'];
|
return ['type' => 'none'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{tag: string|null, attributes: array<string, string>}
|
||||||
|
*/
|
||||||
private function parseSnippet(string $snippet): array
|
private function parseSnippet(string $snippet): array
|
||||||
{
|
{
|
||||||
preg_match('/<([a-zA-Z0-9]+)/', $snippet, $matches);
|
preg_match('/<([a-zA-Z0-9]+)/', $snippet, $matches);
|
||||||
@@ -133,6 +143,9 @@ class SourceLocator
|
|||||||
return ['tag' => $tagName, 'attributes' => $attributes];
|
return ['tag' => $tagName, 'attributes' => $attributes];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array{tag: string|null, attributes: array<string, string>} $parsed
|
||||||
|
*/
|
||||||
private function calculateFuzzyScore(string $line, array $parsed): float
|
private function calculateFuzzyScore(string $line, array $parsed): float
|
||||||
{
|
{
|
||||||
if (!$parsed['tag'] || !str_contains(strtolower($line), '<' . strtolower($parsed['tag']))) {
|
if (!$parsed['tag'] || !str_contains(strtolower($line), '<' . strtolower($parsed['tag']))) {
|
||||||
|
|||||||
Reference in New Issue
Block a user