-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Starting pass at phpstan on database * Contd work * Continued work for database * Starting work on collection * Finishing collections * PHPSTAN on interface * Wrapping up for now * Wrapping up phpstan for support
- Loading branch information
Showing
46 changed files
with
1,146 additions
and
773 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Method Mantle\\\\Support\\\\Collection\\:\\:map_to_groups\\(\\) should return Mantle\\\\Support\\\\Collection\\<TMapToGroupsKey of \\(int\\|string\\), Mantle\\\\Support\\\\Collection\\<int, TMapToGroupsValue\\>\\> but returns Mantle\\\\Support\\\\Collection\\<TMapToGroupsKey of \\(int\\|string\\), Mantle\\\\Support\\\\Collection\\<TMakeKey of \\(int\\|string\\), TMakeValue\\>\\>\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$callback of method Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\),TValue\\>\\:\\:when_empty\\(\\) expects callable\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\: TUnlessNotEmptyReturnType, callable\\(\\$this\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\)\\: TUnlessNotEmptyReturnType given\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$callback of method Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\),TValue\\>\\:\\:when_not_empty\\(\\) expects callable\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\: TUnlessEmptyReturnType, callable\\(\\$this\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\)\\: TUnlessEmptyReturnType given\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php | ||
|
||
- | ||
message: "#^Parameter \\#2 \\$callback of method Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\),TValue\\>\\:\\:when\\(\\) expects \\(callable\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>, bool\\)\\: TWhenEmptyReturnType\\)\\|null, callable\\(\\$this\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\)\\: TWhenEmptyReturnType given\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php | ||
|
||
- | ||
message: "#^Parameter \\#2 \\$callback of method Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\),TValue\\>\\:\\:when\\(\\) expects \\(callable\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>, bool\\)\\: TWhenNotEmptyReturnType\\)\\|null, callable\\(\\$this\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\)\\: TWhenNotEmptyReturnType given\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php | ||
|
||
- | ||
message: "#^Parameter \\#2 \\$default of method Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\),TValue\\>\\:\\:when_empty\\(\\) expects \\(callable\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\: TUnlessNotEmptyReturnType\\)\\|null, \\(callable\\(\\$this\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\)\\: TUnlessNotEmptyReturnType\\)\\|null given\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php | ||
|
||
- | ||
message: "#^Parameter \\#2 \\$default of method Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\),TValue\\>\\:\\:when_not_empty\\(\\) expects \\(callable\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\: TUnlessEmptyReturnType\\)\\|null, \\(callable\\(\\$this\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\)\\: TUnlessEmptyReturnType\\)\\|null given\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php | ||
|
||
- | ||
message: "#^Parameter \\#3 \\$default of method Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\),TValue\\>\\:\\:when\\(\\) expects \\(callable\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>, bool\\)\\: TWhenEmptyReturnType\\)\\|null, \\(callable\\(\\$this\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\)\\: TWhenEmptyReturnType\\)\\|null given\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php | ||
|
||
- | ||
message: "#^Parameter \\#3 \\$default of method Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\),TValue\\>\\:\\:when\\(\\) expects \\(callable\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>, bool\\)\\: TWhenNotEmptyReturnType\\)\\|null, \\(callable\\(\\$this\\(Mantle\\\\Support\\\\Collection\\<TKey of \\(int\\|string\\), TValue\\>\\)\\)\\: TWhenNotEmptyReturnType\\)\\|null given\\.$#" | ||
count: 1 | ||
path: src/mantle/support/class-collection.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
/** | ||
* Model_Meta interface file. | ||
* | ||
* @package Mantle | ||
*/ | ||
|
||
namespace Mantle\Contracts\Database; | ||
|
||
use Mantle\Database\Model\Model_Exception; | ||
|
||
/** | ||
* Model Meta Interface | ||
*/ | ||
interface Model_Meta { | ||
/** | ||
* Retrieve meta data for the object. | ||
* | ||
* @param string $meta_key Meta key to retrieve. | ||
* @param bool $single Return the first meta key, defaults to true. | ||
* @return mixed | ||
*/ | ||
public function get_meta( string $meta_key, bool $single = true ): mixed; | ||
|
||
/** | ||
* Add meta value for the object. | ||
* | ||
* @param string $meta_key Meta key. | ||
* @param mixed $meta_value Meta value to store. | ||
* @param string $prev_value Optional, previous meta value. | ||
*/ | ||
public function add_meta( string $meta_key, mixed $meta_value, mixed $prev_value = '' ): void; | ||
|
||
/** | ||
* Update meta value for the object. | ||
* | ||
* @param string $meta_key Meta key. | ||
* @param mixed $meta_value Meta value to store. | ||
* @param string $prev_value Optional, previous meta value. | ||
*/ | ||
public function set_meta( string $meta_key, mixed $meta_value, mixed $prev_value = '' ): void; | ||
|
||
/** | ||
* Delete a object's meta. | ||
* | ||
* @param string $meta_key Meta key to delete by. | ||
* @param mixed $meta_value Previous meta value to delete. | ||
*/ | ||
public function delete_meta( string $meta_key, mixed $meta_value = '' ); | ||
|
||
/** | ||
* Allow setting meta through an array via an attribute mutator. | ||
* | ||
* @param array $meta_values Meta values to set. | ||
* @throws Model_Exception Thrown on invalid value being set. | ||
*/ | ||
public function set_meta_attribute( array $meta_values ): void; | ||
|
||
/** | ||
* Get a queued meta attribute. | ||
* | ||
* @param string $key Meta key. | ||
* @return mixed|null Meta value or null. | ||
*/ | ||
public function get_queued_meta_attribute( string $key ): mixed; | ||
|
||
/** | ||
* Queue a meta attribute for saving. | ||
* Allows meta to be set before a model is saved. | ||
* | ||
* Should not be called directly, only to be used via `$model->meta->...`. | ||
* | ||
* @param string $key Meta key. | ||
* @param mixed $value Meta value. | ||
* @param bool $update Flag to update the queued meta. | ||
* @return void | ||
*/ | ||
public function queue_meta_attribute( string $key, $value, bool $update = true ): void; | ||
|
||
/** | ||
* Store queued model meta. | ||
*/ | ||
public function store_queued_meta(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.