Files
laravel-cart/phpstan-bootstrap.php
T
Joel Male 2ced1038af feat: add PHPStan level 5 with zero errors
- Install phpstan/phpstan, add phpstan.neon at level 5 targeting PHP 8.3
- Add phpstan-bootstrap.php stubs for Laravel helper functions (app,
  config, config_path, app_path, session) unavailable in standalone packages
- Fix CartCondition::setOrder() - removed incorrect @return int (method is void)
- Fix CartCondition::getCalculatedValue() - removed incorrect @return mixed PHPDoc
- Fix Cart::condition() - remove redundant instanceof check the type system already guarantees
- Fix Cart::fireEvent() - remove array_values() on already-list literal array
- Fix ItemCollection - add @property annotations for magic __get properties
- Fix ItemCollection::getAssociatedModel() - correct @return bool to @return mixed
- Fix ItemCollection::getConditions() - remove dead is_array && !instanceof check
- Fix Validator - add @method stub so PHPStan resolves make() through __callStatic
- Add ignoreErrors for trait.unused (HasCart designed for external Livewire use)
- Add ignoreErrors for round() mode mismatch (PHPStan 2.x PHP 8.4 stubs bug)
- Add phpstan step to CI (PHP 8.3 only, matches phpVersion config)
2026-06-06 16:02:16 +10:00

43 lines
913 B
PHP

<?php
/**
* PHPStan bootstrap — stubs for Laravel global helpers that are always
* available at runtime in a Laravel application but are not present in the
* standalone illuminate/* packages this package depends on.
*/
if (! function_exists('app')) {
function app(string $abstract = null, array $parameters = []): mixed
{
return null;
}
}
if (! function_exists('config')) {
function config(string|null $key = null, mixed $default = null): mixed
{
return null;
}
}
if (! function_exists('config_path')) {
function config_path(string $path = ''): string
{
return '';
}
}
if (! function_exists('app_path')) {
function app_path(string $path = ''): string
{
return '';
}
}
if (! function_exists('session')) {
function session(string|array|null $key = null, mixed $default = null): mixed
{
return null;
}
}