Add deprecation highlighting on disallowed methods (#47) (#49)

This commit is contained in:
btxtiger 2023-02-02 20:57:21 +01:00 committed by GitHub
parent dca9d5bef5
commit 75a863d226
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,7 @@ trait ReadOnlyTrait
* Throws ReadOnlyException on create * Throws ReadOnlyException on create
* @param array $attributes * @param array $attributes
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public static function create(array $attributes = []) public static function create(array $attributes = [])
{ {
@ -26,6 +27,7 @@ trait ReadOnlyTrait
* Throws ReadOnlyException on forceCreate * Throws ReadOnlyException on forceCreate
* @param array $attributes * @param array $attributes
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public static function forceCreate(array $attributes) public static function forceCreate(array $attributes)
{ {
@ -39,6 +41,7 @@ trait ReadOnlyTrait
* Throws ReadOnlyException on save * Throws ReadOnlyException on save
* @param array $options * @param array $options
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function save(array $options = []) public function save(array $options = [])
{ {
@ -53,6 +56,7 @@ trait ReadOnlyTrait
* @param array $attributes * @param array $attributes
* @param array $options * @param array $options
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function update(array $attributes = [], array $options = []) public function update(array $attributes = [], array $options = [])
{ {
@ -67,6 +71,7 @@ trait ReadOnlyTrait
* @param array $attributes * @param array $attributes
* @param array $values * @param array $values
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public static function firstOrCreate(array $attributes, array $values = []) public static function firstOrCreate(array $attributes, array $values = [])
{ {
@ -81,6 +86,7 @@ trait ReadOnlyTrait
* @param array $attributes * @param array $attributes
* @param array $values * @param array $values
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public static function firstOrNew(array $attributes, array $values = []) public static function firstOrNew(array $attributes, array $values = [])
{ {
@ -95,6 +101,7 @@ trait ReadOnlyTrait
* @param array $attributes * @param array $attributes
* @param array $values * @param array $values
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public static function updateOrCreate(array $attributes, array $values = []) public static function updateOrCreate(array $attributes, array $values = [])
{ {
@ -107,6 +114,7 @@ trait ReadOnlyTrait
/** /**
* Throws ReadOnlyException on delete * Throws ReadOnlyException on delete
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function delete() public function delete()
{ {
@ -120,6 +128,7 @@ trait ReadOnlyTrait
* Throws ReadOnlyException on destroy * Throws ReadOnlyException on destroy
* @param mixed $ids * @param mixed $ids
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public static function destroy($ids) public static function destroy($ids)
{ {
@ -132,6 +141,7 @@ trait ReadOnlyTrait
/** /**
* Throws ReadOnlyException on restore * Throws ReadOnlyException on restore
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function restore() public function restore()
{ {
@ -144,6 +154,7 @@ trait ReadOnlyTrait
/** /**
* Throws ReadOnlyException on forceDelete * Throws ReadOnlyException on forceDelete
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function forceDelete() public function forceDelete()
{ {
@ -156,6 +167,7 @@ trait ReadOnlyTrait
/** /**
* Throws ReadOnlyException on performDeleteOnModel * Throws ReadOnlyException on performDeleteOnModel
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function performDeleteOnModel() public function performDeleteOnModel()
{ {
@ -168,6 +180,7 @@ trait ReadOnlyTrait
/** /**
* Throws ReadOnlyException on push * Throws ReadOnlyException on push
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function push() public function push()
{ {
@ -181,6 +194,7 @@ trait ReadOnlyTrait
* Throws ReadOnlyException on finishSave * Throws ReadOnlyException on finishSave
* @param array $options * @param array $options
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function finishSave(array $options) public function finishSave(array $options)
{ {
@ -195,6 +209,7 @@ trait ReadOnlyTrait
* @param Builder $query * @param Builder $query
* @param array $options * @param array $options
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function performUpdate(Builder $query, array $options = []): bool public function performUpdate(Builder $query, array $options = []): bool
{ {
@ -208,6 +223,7 @@ trait ReadOnlyTrait
* Throws ReadOnlyException on touch * Throws ReadOnlyException on touch
* @param string|null $attribute * @param string|null $attribute
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function touch($attribute = null) public function touch($attribute = null)
{ {
@ -220,6 +236,7 @@ trait ReadOnlyTrait
/** /**
* Throws ReadOnlyException on insert * Throws ReadOnlyException on insert
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function insert() public function insert()
{ {
@ -232,6 +249,7 @@ trait ReadOnlyTrait
/** /**
* Throws ReadOnlyException on truncate * Throws ReadOnlyException on truncate
* @throws ReadOnlyException * @throws ReadOnlyException
* @deprecated Method not allowed on read-only model
*/ */
public function truncate() public function truncate()
{ {