diff --git a/database/factories/AddressFactory.php b/database/factories/AddressFactory.php index 5b09a384..856fedf8 100644 --- a/database/factories/AddressFactory.php +++ b/database/factories/AddressFactory.php @@ -11,7 +11,7 @@ class AddressFactory extends Factory /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Address::class; diff --git a/database/factories/CartFactory.php b/database/factories/CartFactory.php index 8d8caefe..a05fe521 100644 --- a/database/factories/CartFactory.php +++ b/database/factories/CartFactory.php @@ -6,12 +6,15 @@ use Cone\Bazar\Models\Cart; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class CartFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Cart::class; diff --git a/database/factories/CategoryFactory.php b/database/factories/CategoryFactory.php index 1b8d3b4f..aed4c411 100644 --- a/database/factories/CategoryFactory.php +++ b/database/factories/CategoryFactory.php @@ -11,7 +11,7 @@ class CategoryFactory extends Factory /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Category::class; diff --git a/database/factories/ItemFactory.php b/database/factories/ItemFactory.php index 51c3fbf7..6c8fe2df 100644 --- a/database/factories/ItemFactory.php +++ b/database/factories/ItemFactory.php @@ -5,12 +5,15 @@ use Cone\Bazar\Models\Item; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class ItemFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Item::class; diff --git a/database/factories/OrderFactory.php b/database/factories/OrderFactory.php index 1afe1a97..b2552ac3 100644 --- a/database/factories/OrderFactory.php +++ b/database/factories/OrderFactory.php @@ -7,12 +7,15 @@ use Cone\Bazar\Models\Transaction; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class OrderFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Order::class; diff --git a/database/factories/ProductFactory.php b/database/factories/ProductFactory.php index ec2105eb..11d6cb7f 100644 --- a/database/factories/ProductFactory.php +++ b/database/factories/ProductFactory.php @@ -8,12 +8,15 @@ use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class ProductFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Product::class; diff --git a/database/factories/PropertyFactory.php b/database/factories/PropertyFactory.php index 794c3b6a..10202272 100644 --- a/database/factories/PropertyFactory.php +++ b/database/factories/PropertyFactory.php @@ -6,12 +6,15 @@ use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class PropertyFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Property::class; diff --git a/database/factories/PropertyValueFactory.php b/database/factories/PropertyValueFactory.php index e1b4488a..04ef5896 100644 --- a/database/factories/PropertyValueFactory.php +++ b/database/factories/PropertyValueFactory.php @@ -5,12 +5,15 @@ use Cone\Bazar\Models\PropertyValue; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class PropertyValueFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = PropertyValue::class; diff --git a/database/factories/ShippingFactory.php b/database/factories/ShippingFactory.php index 88b62092..7a151035 100644 --- a/database/factories/ShippingFactory.php +++ b/database/factories/ShippingFactory.php @@ -6,12 +6,15 @@ use Cone\Bazar\Support\Facades\Shipping as Manager; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class ShippingFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Shipping::class; diff --git a/database/factories/TransactionFactory.php b/database/factories/TransactionFactory.php index b22e766d..28cc744a 100644 --- a/database/factories/TransactionFactory.php +++ b/database/factories/TransactionFactory.php @@ -6,12 +6,15 @@ use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Facades\Date; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class TransactionFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Transaction::class; diff --git a/database/factories/VariantFactory.php b/database/factories/VariantFactory.php index c15761a0..55358618 100644 --- a/database/factories/VariantFactory.php +++ b/database/factories/VariantFactory.php @@ -7,12 +7,15 @@ use Cone\Root\Models\Meta; use Illuminate\Database\Eloquent\Factories\Factory; +/** + * @template TModel of \Illuminate\Database\Eloquent\Model + */ class VariantFactory extends Factory { /** * The name of the factory's corresponding model. * - * @var string + * @var class-string<\Illuminate\Database\Eloquent\Model> */ protected $model = Variant::class; diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 4b5fcf3f..1226c055 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -13,3 +13,13 @@ parameters: checkMissingIterableValueType: false ignoreErrors: - '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model::#' + # Incorrect framework types + - + path: 'src/Traits/HasPrices.php' + message: '#^Parameter \#2 \$type of method Illuminate\\Database\\Eloquent\\Model::getMorphs\(\) expects string, null given\.$#' + count: 2 + - + path: 'src/Traits/HasPrices.php' + message: '#^Parameter \#3 \$id of method Illuminate\\Database\\Eloquent\\Model::getMorphs\(\) expects string, null given\.$#' + count: 2 + diff --git a/src/Models/Address.php b/src/Models/Address.php index e4d548ad..5903472e 100644 --- a/src/Models/Address.php +++ b/src/Models/Address.php @@ -20,7 +20,7 @@ class Address extends Model implements Contract /** * The accessors to append to the model's array form. * - * @var array + * @var list */ protected $appends = [ 'name', @@ -62,7 +62,7 @@ class Address extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'address_secondary', diff --git a/src/Models/Cart.php b/src/Models/Cart.php index f1eec352..b98c055f 100644 --- a/src/Models/Cart.php +++ b/src/Models/Cart.php @@ -50,7 +50,7 @@ class Cart extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'currency', @@ -101,6 +101,8 @@ public function getMorphClass(): string /** * Get the order for the cart. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Cone\Bazar\Models\Order, \Cone\Bazar\Models\Cart> */ public function order(): BelongsTo { diff --git a/src/Models/Category.php b/src/Models/Category.php index aad5e4e7..4bfdf933 100644 --- a/src/Models/Category.php +++ b/src/Models/Category.php @@ -22,7 +22,7 @@ class Category extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'description', diff --git a/src/Models/Item.php b/src/Models/Item.php index 70168582..385c45b7 100644 --- a/src/Models/Item.php +++ b/src/Models/Item.php @@ -26,7 +26,7 @@ class Item extends Model implements Contract /** * The accessors to append to the model's array form. * - * @var array + * @var list */ protected $appends = [ 'subtotal', @@ -60,7 +60,7 @@ class Item extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'buyable_id', @@ -75,7 +75,7 @@ class Item extends Model implements Contract /** * The attributes that should be hidden for arrays. * - * @var array + * @var list */ protected $hidden = [ 'itemable', diff --git a/src/Models/Order.php b/src/Models/Order.php index 665c51f6..f7a7e3c2 100644 --- a/src/Models/Order.php +++ b/src/Models/Order.php @@ -51,7 +51,7 @@ class Order extends Model implements Contract /** * The accessors to append to the model's array form. * - * @var array + * @var list */ protected $appends = [ 'formatted_discount', @@ -87,7 +87,7 @@ class Order extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'currency', diff --git a/src/Models/Product.php b/src/Models/Product.php index e6f362e8..72905aa2 100644 --- a/src/Models/Product.php +++ b/src/Models/Product.php @@ -36,7 +36,7 @@ class Product extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'description', diff --git a/src/Models/Property.php b/src/Models/Property.php index b78085ea..c459f81c 100644 --- a/src/Models/Property.php +++ b/src/Models/Property.php @@ -20,7 +20,7 @@ class Property extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'name', diff --git a/src/Models/PropertyValue.php b/src/Models/PropertyValue.php index aabea775..3a64c975 100644 --- a/src/Models/PropertyValue.php +++ b/src/Models/PropertyValue.php @@ -18,7 +18,7 @@ class PropertyValue extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'name', diff --git a/src/Models/Shipping.php b/src/Models/Shipping.php index 1e1053af..18986af5 100644 --- a/src/Models/Shipping.php +++ b/src/Models/Shipping.php @@ -47,7 +47,7 @@ class Shipping extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'cost', diff --git a/src/Models/Transaction.php b/src/Models/Transaction.php index 11a341f9..7b73ba4c 100644 --- a/src/Models/Transaction.php +++ b/src/Models/Transaction.php @@ -28,7 +28,7 @@ class Transaction extends Model implements Contract /** * The accessors to append to the model's array form. * - * @var array + * @var list */ protected $appends = [ 'driver_name', @@ -47,7 +47,7 @@ class Transaction extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'amount', @@ -90,6 +90,8 @@ public function getMorphClass(): string /** * Get the order for the transaction. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Cone\Bazar\Models\Order, \Cone\Bazar\Models\Transaction> */ public function order(): BelongsTo { diff --git a/src/Models/Variant.php b/src/Models/Variant.php index faf83dcb..e17eb04f 100644 --- a/src/Models/Variant.php +++ b/src/Models/Variant.php @@ -36,7 +36,7 @@ class Variant extends Model implements Contract /** * The attributes that are mass assignable. * - * @var array + * @var list */ protected $fillable = [ 'alias', diff --git a/src/Traits/InteractsWithItemables.php b/src/Traits/InteractsWithItemables.php index 4fbd8611..fe32f232 100644 --- a/src/Traits/InteractsWithItemables.php +++ b/src/Traits/InteractsWithItemables.php @@ -20,6 +20,8 @@ public function items(): MorphMany /** * Get the products for the model. + * + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Cone\Bazar\Models\Order> */ public function orders(): HasManyThrough { @@ -30,6 +32,8 @@ public function orders(): HasManyThrough /** * Get the carts for the product. + * + * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<\Cone\Bazar\Models\Cart> */ public function carts(): HasManyThrough {