8889841cPK'l[^*RunningLaravelDuskInProductionProvider.phpnuW+AgetMessage() === 'It is unsafe to run Dusk in production.'; } public function getSolutions(Throwable $throwable): array { return [ BaseSolution::create('Laravel Dusk should not be run in production.') ->setSolutionDescription('Install the dependencies with the `--no-dev` flag.'), BaseSolution::create('Laravel Dusk can be run in other environments.') ->setSolutionDescription('Consider setting the `APP_ENV` to something other than `production` like `local` for example.'), ]; } } PK'l[;  %UndefinedVariableSolutionProvider.phpnuW+AgetNameAndView($throwable) !== null; } public function getSolutions(Throwable $throwable): array { $solutions = []; extract($this->getNameAndView($throwable)); if (! isset($variableName)) { return []; } $solutions = $this->findCorrectVariableSolutions($throwable, $variableName, $viewFile); $solutions[] = $this->findOptionalVariableSolution($variableName, $viewFile); return $solutions; } protected function findCorrectVariableSolutions( ViewException $throwable, string $variableName, string $viewFile ): array { return collect($throwable->getViewData()) ->map(function ($value, $key) use ($variableName) { similar_text($variableName, $key, $percentage); return ['match' => $percentage, 'value' => $value]; }) ->sortByDesc('match')->filter(function ($var) { return $var['match'] > 40; }) ->keys() ->map(function ($suggestion) use ($variableName, $viewFile) { return new SuggestCorrectVariableNameSolution($variableName, $viewFile, $suggestion); }) ->map(function ($solution) { return $solution->isRunnable() ? $solution : BaseSolution::create($solution->getSolutionTitle()) ->setSolutionDescription($solution->getSolutionDescription()); }) ->toArray(); } protected function findOptionalVariableSolution(string $variableName, string $viewFile) { $optionalSolution = new MakeViewVariableOptionalSolution($variableName, $viewFile); return $optionalSolution->isRunnable() ? $optionalSolution : BaseSolution::create($optionalSolution->getSolutionTitle()) ->setSolutionDescription($optionalSolution->getSolutionDescription()); } protected function getNameAndView(Throwable $throwable): ?array { $pattern = '/Undefined variable:? (.*?) \(View: (.*?)\)/'; preg_match($pattern, $throwable->getMessage(), $matches); if (count($matches) === 3) { [, $variableName, $viewFile] = $matches; $variableName = ltrim($variableName, '$'); return compact('variableName', 'viewFile'); } return null; } } PK'l[ !MissingColumnSolutionProvider.phpnuW+AisBadTableErrorCode($throwable->getCode()); } protected function isBadTableErrorCode($code): bool { return $code === static::MYSQL_BAD_FIELD_CODE; } public function getSolutions(Throwable $throwable): array { return [new RunMigrationsSolution('A column was not found')]; } } PK'l[pyף~~!DefaultDbNameSolutionProvider.phpnuW+AgetCode() !== self::MYSQL_UNKNOWN_DATABASE_CODE) { return false; } if (! in_array(env('DB_DATABASE'), ['homestead', 'laravel'])) { return false; } return true; } public function getSolutions(Throwable $throwable): array { return [new SuggestUsingCorrectDbNameSolution()]; } } PK'l[8 &MissingMixManifestSolutionProvider.phpnuW+AgetMessage(), 'The Mix manifest does not exist'); } public function getSolutions(Throwable $throwable): array { return [ BaseSolution::create('Missing Mix Manifest File') ->setSolutionDescription('Did you forget to run `npm ci && npm run dev`?'), ]; } } PK'l[_55,MissingLivewireComponentSolutionProvider.phpnuW+AlivewireIsInstalled()) { return false; } if (! $throwable instanceof ComponentNotFoundException) { return false; } return true; } public function getSolutions(Throwable $throwable): array { return [new LivewireDiscoverSolution('A Livewire component was not found')]; } public function livewireIsInstalled(): bool { if (! class_exists(ComponentNotFoundException::class)) { return false; } if (! class_exists(LivewireComponentsFinder::class)) { return false; } return true; } } PK'l[ǧA!MergeConflictSolutionProvider.phpnuW+AhasMergeConflictExceptionMessage($throwable)) { return false; } $file = file_get_contents($throwable->getFile()); if (strpos($file, '=======') === false) { return false; } if (strpos($file, '>>>>>>>') === false) { return false; } return true; } public function getSolutions(Throwable $throwable): array { $file = file_get_contents($throwable->getFile()); preg_match('/\>\>\>\>\>\>\> (.*?)\n/', $file, $matches); $source = $matches[1]; $target = $this->getCurrentBranch(basename($throwable->getFile())); return [ BaseSolution::create("Merge conflict from branch '$source' into $target") ->setSolutionDescription('You have a Git merge conflict. To undo your merge do `git reset --hard HEAD`'), ]; } protected function getCurrentBranch(string $directory): string { $branch = "'".trim(shell_exec("cd {$directory}; git branch | grep \\* | cut -d ' ' -f2"))."'"; if ($branch === "''") { $branch = 'current branch'; } return $branch; } protected function hasMergeConflictExceptionMessage(Throwable $throwable): bool { // For PHP 7.x and below if (Str::startsWith($throwable->getMessage(), 'syntax error, unexpected \'<<\'')) { return true; } // For PHP 8+ if (Str::startsWith($throwable->getMessage(), 'syntax error, unexpected token "<<"')) { return true; } return false; } } PK'l[+UndefinedLivewireMethodSolutionProvider.phpnuW+A $methodName, 'component' => $component] = $this->getMethodAndComponent($throwable); if ($methodName === null || $component === null) { return []; } $parsed = LivewireComponentParser::create($component); return $parsed->getMethodNamesLike($methodName) ->map(function (string $suggested) use ($parsed, $methodName) { return new SuggestLivewireMethodNameSolution( $methodName, $parsed->getComponentClass(), $suggested ); }) ->toArray(); } protected function getMethodAndComponent(Throwable $throwable): array { preg_match_all('/\[([\d\w\-_]*)\]/m', $throwable->getMessage(), $matches, PREG_SET_ORDER); return [ 'methodName' => $matches[0][1] ?? null, 'component' => $matches[1][1] ?? null, ]; } } PK'l[ȗ  ViewNotFoundSolutionProvider.phpnuW+AgetMessage(), $matches); } public function getSolutions(Throwable $throwable): array { preg_match(self::REGEX, $throwable->getMessage(), $matches); $missingView = $matches[1] ?? null; $suggestedView = $this->findRelatedView($missingView); if ($suggestedView == $missingView) { return [ BaseSolution::create("{$missingView} was not found.") ->setSolutionDescription('View names should not contain the . character!'), ]; } if ($suggestedView) { return [ BaseSolution::create("{$missingView} was not found.") ->setSolutionDescription("Did you mean `{$suggestedView}`?"), ]; } return [ BaseSolution::create("{$missingView} was not found.") ->setSolutionDescription('Are you sure the view exists and is a `.blade.php` file?'), ]; } protected function findRelatedView(string $missingView): ?string { $views = $this->getAllViews(); return StringComparator::findClosestMatch($views, $missingView); } protected function getAllViews(): array { /** @var \Illuminate\View\FileViewFinder $fileViewFinder */ $fileViewFinder = View::getFinder(); $extensions = $fileViewFinder->getExtensions(); $viewsForHints = collect($fileViewFinder->getHints()) ->flatMap(function ($paths, string $namespace) use ($extensions) { $paths = Arr::wrap($paths); return collect($paths) ->flatMap(function (string $path) use ($extensions) { return $this->getViewsInPath($path, $extensions); }) ->map(function (string $view) use ($namespace) { return "{$namespace}::{$view}"; }) ->toArray(); }); $viewsForViewPaths = collect($fileViewFinder->getPaths()) ->flatMap(function (string $path) use ($extensions) { return $this->getViewsInPath($path, $extensions); }); return $viewsForHints->merge($viewsForViewPaths)->toArray(); } protected function getViewsInPath(string $path, array $extensions): array { $filePatterns = array_map(function (string $extension) { return "*.{$extension}"; }, $extensions); $extensionsWithDots = array_map(function (string $extension) { return ".{$extension}"; }, $extensions); $files = (new Finder()) ->in($path) ->files(); foreach ($filePatterns as $filePattern) { $files->name($filePattern); } $views = []; foreach ($files as $file) { if ($file instanceof SplFileInfo) { $view = $file->getRelativePathname(); $view = str_replace($extensionsWithDots, '', $view); $view = str_replace('/', '.', $view); $views[] = $view; } } return $views; } } PK'l[9Aaa(LazyLoadingViolationSolutionProvider.phpnuW+AgetPrevious()) { return false; } return $previous instanceof LazyLoadingViolationException; } public function getSolutions(Throwable $throwable): array { $majorVersion = LaravelVersion::major(); return [BaseSolution::create( 'Lazy loading was disabled to detect N+1 problems' ) ->setSolutionDescription( 'Either avoid lazy loading the relation or allow lazy loading.' ) ->setDocumentationLinks([ 'Read the docs on preventing lazy loading' => "https://laravel.com/docs/{$majorVersion}.x/eloquent-relationships#preventing-lazy-loading", 'Watch a video on how to deal with the N+1 problem' => 'https://www.youtube.com/watch?v=ZE7KBeraVpc', ]),]; } } PK'l[xx-UndefinedLivewirePropertySolutionProvider.phpnuW+A $variable, 'component' => $component] = $this->getMethodAndComponent($throwable); if ($variable === null || $component === null) { return []; } $parsed = LivewireComponentParser::create($component); return $parsed->getPropertyNamesLike($variable) ->map(function (string $suggested) use ($parsed, $variable) { return new SuggestLivewirePropertyNameSolution( $variable, $parsed->getComponentClass(), '$'.$suggested ); }) ->toArray(); } protected function getMethodAndComponent(Throwable $throwable): array { preg_match_all('/\[([\d\w\-_\$]*)\]/m', $throwable->getMessage(), $matches, PREG_SET_ORDER, 0); return [ 'variable' => $matches[0][1] ?? null, 'component' => $matches[1][1] ?? null, ]; } } PK'l[∖k k &InvalidRouteActionSolutionProvider.phpnuW+AgetMessage(), $matches)) { return false; } return Str::startsWith($throwable->getMessage(), 'Invalid route action: '); } public function getSolutions(Throwable $throwable): array { preg_match(self::REGEX, $throwable->getMessage(), $matches); $invalidController = $matches[1] ?? null; $suggestedController = $this->findRelatedController($invalidController); if ($suggestedController === $invalidController) { return [ BaseSolution::create("`{$invalidController}` is not invokable.") ->setSolutionDescription("The controller class `{$invalidController}` is not invokable. Did you forget to add the `__invoke` method or is the controller's method missing in your routes file?"), ]; } if ($suggestedController) { return [ BaseSolution::create("`{$invalidController}` was not found.") ->setSolutionDescription("Controller class `{$invalidController}` for one of your routes was not found. Did you mean `{$suggestedController}`?"), ]; } return [ BaseSolution::create("`{$invalidController}` was not found.") ->setSolutionDescription("Controller class `{$invalidController}` for one of your routes was not found. Are you sure this controller exists and is imported correctly?"), ]; } protected function findRelatedController(string $invalidController): ?string { $composerClassMap = app(ComposerClassMap::class); $controllers = collect($composerClassMap->listClasses()) ->filter(function (string $_file, string $fqcn) { return Str::endsWith($fqcn, 'Controller'); }) ->mapWithKeys(function (string $_file, string $fqcn) { return [$fqcn => class_basename($fqcn)]; }) ->toArray(); $basenameMatch = StringComparator::findClosestMatch($controllers, $invalidController, 4); $controllers = array_flip($controllers); $fqcnMatch = StringComparator::findClosestMatch($controllers, $invalidController, 4); return $fqcnMatch ?? $basenameMatch; } } PK'l[F_a SolutionProviderRepository.phpnuW+AsolutionProviders = Collection::make($solutionProviders); } public function registerSolutionProvider(string $solutionProviderClass): SolutionProviderRepositoryContract { $this->solutionProviders->push($solutionProviderClass); return $this; } public function registerSolutionProviders(array $solutionProviderClasses): SolutionProviderRepositoryContract { $this->solutionProviders = $this->solutionProviders->merge($solutionProviderClasses); return $this; } public function getSolutionsForThrowable(Throwable $throwable): array { $solutions = []; if ($throwable instanceof Solution) { $solutions[] = $throwable; } if ($throwable instanceof ProvidesSolution) { $solutions[] = $throwable->getSolution(); } $providedSolutions = $this->solutionProviders ->filter(function (string $solutionClass) { if (! in_array(HasSolutionsForThrowable::class, class_implements($solutionClass))) { return false; } if (in_array($solutionClass, config('ignition.ignored_solution_providers', []))) { return false; } return true; }) ->map(function (string $solutionClass) { return app($solutionClass); }) ->filter(function (HasSolutionsForThrowable $solutionProvider) use ($throwable) { try { return $solutionProvider->canSolve($throwable); } catch (Throwable $e) { return false; } }) ->map(function (HasSolutionsForThrowable $solutionProvider) use ($throwable) { try { return $solutionProvider->getSolutions($throwable); } catch (Throwable $e) { return []; } }) ->flatten() ->toArray(); return array_merge($solutions, $providedSolutions); } public function getSolutionForClass(string $solutionClass): ?Solution { if (! class_exists($solutionClass)) { return null; } if (! in_array(Solution::class, class_implements($solutionClass))) { return null; } return app($solutionClass); } } PK'l[&G!MissingImportSolutionProvider.phpnuW+AgetMessage(), $matches)) { return false; } $class = $matches[1]; $this->composerClassMap = new ComposerClassMap(); $this->search($class); return ! is_null($this->foundClass); } public function getSolutions(Throwable $throwable): array { return [new SuggestImportSolution($this->foundClass)]; } protected function search(string $missingClass) { $this->foundClass = $this->composerClassMap->searchClassMap($missingClass); if (is_null($this->foundClass)) { $this->foundClass = $this->composerClassMap->searchPsrMaps($missingClass); } } } PK'l[{!MissingAppKeySolutionProvider.phpnuW+AgetMessage() === 'No application encryption key has been specified.'; } public function getSolutions(Throwable $throwable): array { return [new GenerateAppKeySolution()]; } } PK'l[!TableNotFoundSolutionProvider.phpnuW+AisBadTableErrorCode($throwable->getCode()); } protected function isBadTableErrorCode($code): bool { return $code === static::MYSQL_BAD_TABLE_CODE; } public function getSolutions(Throwable $throwable): array { return [new RunMigrationsSolution('A table was not found')]; } } PK'l[4L  %UnknownValidationSolutionProvider.phpnuW+Avalidate(?!(Attribute|UsingCustomRule))[A-Z][a-zA-Z]+)/m'; public function canSolve(Throwable $throwable): bool { if (! $throwable instanceof BadMethodCallException) { return false; } return ! is_null($this->getMethodFromExceptionMessage($throwable->getMessage())); } public function getSolutions(Throwable $throwable): array { return [ BaseSolution::create('Unknown Validation Rule') ->setSolutionDescription($this->getSolutionDescription($throwable)), ]; } protected function getSolutionDescription(Throwable $throwable): string { $method = $this->getMethodFromExceptionMessage($throwable->getMessage()); $possibleMethod = StringComparator::findSimilarText( $this->getAvailableMethods()->toArray(), $method ); if (empty($possibleMethod)) { return ''; } $rule = Str::snake(str_replace('validate', '', $possibleMethod)); return "Did you mean `{$rule}` ?"; } protected function getMethodFromExceptionMessage(string $message): ?string { if (! preg_match(self::REGEX, $message, $matches)) { return null; } return $matches['method']; } protected function getAvailableMethods(): Collection { $class = new ReflectionClass(Validator::class); $extensions = Collection::make((app('validator')->make([], []))->extensions) ->keys() ->map(function (string $extension) { return 'validate'.Str::studly($extension); }); return Collection::make($class->getMethods()) ->filter(function (ReflectionMethod $method) { return preg_match('/(validate(?!(Attribute|UsingCustomRule))[A-Z][a-zA-Z]+)/', $method->name); }) ->map(function (ReflectionMethod $method) { return $method->name; }) ->merge($extensions); } } PK'l[Q/ %UndefinedPropertySolutionProvider.phpnuW+AgetClassAndPropertyFromExceptionMessage($throwable->getMessage()))) { return false; } if (! $this->similarPropertyExists($throwable)) { return false; } return true; } public function getSolutions(Throwable $throwable): array { return [ BaseSolution::create('Unknown Property') ->setSolutionDescription($this->getSolutionDescription($throwable)), ]; } public function getSolutionDescription(Throwable $throwable): string { if (! $this->canSolve($throwable) || ! $this->similarPropertyExists($throwable)) { return ''; } extract($this->getClassAndPropertyFromExceptionMessage($throwable->getMessage()), EXTR_OVERWRITE); $possibleProperty = $this->findPossibleProperty($class, $property); return "Did you mean {$class}::\${$possibleProperty->name} ?"; } protected function similarPropertyExists(Throwable $throwable) { extract($this->getClassAndPropertyFromExceptionMessage($throwable->getMessage()), EXTR_OVERWRITE); $possibleProperty = $this->findPossibleProperty($class, $property); return $possibleProperty !== null; } protected function getClassAndPropertyFromExceptionMessage(string $message): ?array { if (! preg_match(self::REGEX, $message, $matches)) { return null; } return [ 'class' => $matches[1], 'property' => $matches[2], ]; } protected function findPossibleProperty(string $class, string $invalidPropertyName) { return $this->getAvailableProperties($class) ->sortByDesc(function (ReflectionProperty $property) use ($invalidPropertyName) { similar_text($invalidPropertyName, $property->name, $percentage); return $percentage; }) ->filter(function (ReflectionProperty $property) use ($invalidPropertyName) { similar_text($invalidPropertyName, $property->name, $percentage); return $percentage >= self::MINIMUM_SIMILARITY; })->first(); } protected function getAvailableProperties($class): Collection { $class = new ReflectionClass($class); return Collection::make($class->getProperties()); } } PK'l[@#RouteNotDefinedSolutionProvider.phpnuW+A=')) { if (! $throwable instanceof RouteNotFoundException) { return false; } } if (version_compare(Application::VERSION, '6.0.0', '<')) { if (! $throwable instanceof InvalidArgumentException && ! $throwable instanceof ViewException) { return false; } } return (bool)preg_match(self::REGEX, $throwable->getMessage(), $matches); } public function getSolutions(Throwable $throwable): array { preg_match(self::REGEX, $throwable->getMessage(), $matches); $missingRoute = $matches[1] ?? null; $suggestedRoute = $this->findRelatedRoute($missingRoute); if ($suggestedRoute) { return [ BaseSolution::create("{$missingRoute} was not defined.") ->setSolutionDescription("Did you mean `{$suggestedRoute}`?"), ]; } return [ BaseSolution::create("{$missingRoute} was not defined.") ->setSolutionDescription('Are you sure that the route is defined'), ]; } protected function findRelatedRoute(string $missingRoute): ?string { Route::getRoutes()->refreshNameLookups(); return StringComparator::findClosestMatch(array_keys(Route::getRoutes()->getRoutesByName()), $missingRoute); } } PK'l[*V!BadMethodCallSolutionProvider.phpnuW+AgetClassAndMethodFromExceptionMessage($throwable->getMessage()))) { return false; } return true; } public function getSolutions(Throwable $throwable): array { return [ BaseSolution::create('Bad Method Call') ->setSolutionDescription($this->getSolutionDescription($throwable)), ]; } public function getSolutionDescription(Throwable $throwable): string { if (! $this->canSolve($throwable)) { return ''; } extract($this->getClassAndMethodFromExceptionMessage($throwable->getMessage()), EXTR_OVERWRITE); $possibleMethod = $this->findPossibleMethod($class, $method); return "Did you mean {$class}::{$possibleMethod->name}() ?"; } protected function getClassAndMethodFromExceptionMessage(string $message): ?array { if (! preg_match(self::REGEX, $message, $matches)) { return null; } return [ 'class' => $matches[1], 'method' => $matches[2], ]; } protected function findPossibleMethod(string $class, string $invalidMethodName) { return $this->getAvailableMethods($class) ->sortByDesc(function (ReflectionMethod $method) use ($invalidMethodName) { similar_text($invalidMethodName, $method->name, $percentage); return $percentage; })->first(); } protected function getAvailableMethods($class): Collection { $class = new ReflectionClass($class); return Collection::make($class->getMethods()); } } PK'l[ӜVV"MissingPackageSolutionProvider.phpnuW+AgetMessage(), $matches)) { return false; } $class = $matches[1]; if (Str::startsWith($class, app()->getNamespace())) { return false; } $this->package = $this->findPackageFromClassName($class); return ! is_null($this->package); } public function getSolutions(Throwable $throwable): array { return [new MissingPackageSolution($this->package)]; } protected function findPackageFromClassName(string $missingClassName): ?Package { if (! $package = $this->findComposerPackageForClassName($missingClassName)) { return null; } return $package->hasNamespaceThatContainsClassName($missingClassName) ? $package : null; } protected function findComposerPackageForClassName(string $className): ?Package { $packages = Packagist::findPackagesForClassName($className); return $packages[0] ?? null; } } PK'l[Jx II/IncorrectValetDbCredentialsSolutionProvider.phpnuW+AisAccessDeniedCode($throwable->getCode())) { return false; } if (! $this->envFileExists()) { return false; } if (! $this->isValetInstalled()) { return false; } if ($this->usingCorrectDefaultCredentials()) { return false; } return true; } public function getSolutions(Throwable $throwable): array { return [new UseDefaultValetDbCredentialsSolution()]; } protected function envFileExists(): bool { return file_exists(base_path('.env')); } protected function isAccessDeniedCode($code): bool { return $code === static::MYSQL_ACCESS_DENIED_CODE; } protected function isValetInstalled(): bool { return file_exists('/usr/local/bin/valet'); } protected function usingCorrectDefaultCredentials(): bool { return env('DB_USERNAME') === 'root' && env('DB_PASSWORD') === ''; } } PK'l[^*RunningLaravelDuskInProductionProvider.phpnuW+APK'l[;  %NUndefinedVariableSolutionProvider.phpnuW+APK'l[ !MissingColumnSolutionProvider.phpnuW+APK'l[pyף~~!DefaultDbNameSolutionProvider.phpnuW+APK'l[8 &MissingMixManifestSolutionProvider.phpnuW+APK'l[_55,MissingLivewireComponentSolutionProvider.phpnuW+APK'l[ǧA!7 MergeConflictSolutionProvider.phpnuW+APK'l[+(UndefinedLivewireMethodSolutionProvider.phpnuW+APK'l[ȗ  .ViewNotFoundSolutionProvider.phpnuW+APK'l[9Aaa(>LazyLoadingViolationSolutionProvider.phpnuW+APK'l[xx-DUndefinedLivewirePropertySolutionProvider.phpnuW+APK'l[∖k k &vKInvalidRouteActionSolutionProvider.phpnuW+APK'l[F_a 7WSolutionProviderRepository.phpnuW+APK'l[&G!PcMissingImportSolutionProvider.phpnuW+APK'l[{!hMissingAppKeySolutionProvider.phpnuW+APK'l[!zkTableNotFoundSolutionProvider.phpnuW+APK'l[4L  %oUnknownValidationSolutionProvider.phpnuW+APK'l[Q/ %yUndefinedPropertySolutionProvider.phpnuW+APK'l[@# RouteNotDefinedSolutionProvider.phpnuW+APK'l[*V!pBadMethodCallSolutionProvider.phpnuW+APK'l[ӜVV"xMissingPackageSolutionProvider.phpnuW+APK'l[Jx II/ IncorrectValetDbCredentialsSolutionProvider.phpnuW+APKȤ