Skip to content

Commit 0fdf09c

Browse files
authored
Fix documentation that led to Issue #37 (#42)
1 parent 6118ff0 commit 0fdf09c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+787
-811
lines changed

.gitignore

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
.project
2-
.idea
3-
.buildpath
4-
.settings
5-
*.log
61
*.db
2+
*.log
73
*.swp
8-
.phpunit.cache
9-
vendor/*
10-
output/*
11-
composer.lock
12-
phpunit.xml
4+
.buildpath
5+
.idea
136
.php_cs.cache
147
.php_cs
15-
docs/api
8+
.php-cs-fixer.cache
9+
.phpunit.cache
1610
.phpunit.result.cache
11+
.project
12+
.settings
1713
.stan-cache
18-
.php-cs-fixer.cache
14+
/.vscode
15+
/docs/api
16+
/node_modules/*
17+
/output/*
18+
/vendor/*
19+
composer.lock
20+
package-lock.json
21+
phpunit.xml

.php-cs-fixer.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@
22

33
$finder = new PhpCsFixer\Finder();
44
$config = new PhpCsFixer\Config('json-schema', 'json-schema style guide');
5-
$finder->in(__DIR__ . '/lib');
5+
$finder->in(__DIR__)
6+
->exclude('.github')
7+
->exclude('.phpunit.cache')
8+
->exclude('.stan.cache')
9+
->exclude('.vscode')
10+
->exclude('assets')
11+
->exclude('docs')
12+
->exclude('node_modules')
13+
->exclude('output')
14+
->exclude('vendor');
615

716
$config
817
->setRules([

.travis.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

lib/Model.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,7 +1671,7 @@ public static function last(/* ... */)
16711671
* YourModel::find(1,2,3);
16721672
*
16731673
* # finding by pk accepts an options array
1674-
* YourModel::find(123,array('order' => 'name desc'));
1674+
* YourModel::find(123, ['order' => 'name desc']);
16751675
* ```
16761676
*
16771677
* Finding by using a conditions array:
@@ -1719,19 +1719,19 @@ public static function last(/* ... */)
17191719
* array<string, int|string> static User::find(["name"=>"Philip"]);
17201720
* "first" static|null User::find("first", ["name"=>"Waldo"]);
17211721
* "last" static|null User::find("last", ["name"=>"William"]);
1722-
* "all" static[] User::find("all", ["name" => "Stephen"]
1722+
* "all" static[] User::find("all", ["name"=>"Stephen"]
17231723
* ...int|string static[] User::find(1, 3, 5, 8);
17241724
* array<int,int|string> static[] User::find([1,3,5,8]);
1725-
* array<"conditions", array<string,string>> static[] User::find(["conditions"=> ["name" => "Kurt"]]);
1725+
* array<"conditions", array<string, string>> static[] User::find(["conditions"=>["name"=>"Kurt"]]);
17261726
*/
1727-
public static function find(/* $type, $options */)
1727+
public static function find(/* $type, $options */): static|array|null
17281728
{
17291729
$class = get_called_class();
17301730

1731-
if (func_num_args() <= 0) {
1731+
$args = func_get_args();
1732+
if (0 === count($args)) {
17321733
throw new RecordNotFound("Couldn't find $class without an ID");
17331734
}
1734-
$args = func_get_args();
17351735
$options = static::extract_and_validate_options($args);
17361736

17371737
$num_args = count($args);
@@ -1765,7 +1765,7 @@ public static function find(/* $type, $options */)
17651765

17661766
// find by pk
17671767
else {
1768-
if (1 === count($args) && 1 == $num_args) {
1768+
if (1 === $num_args) {
17691769
$args = $args[0];
17701770
}
17711771

test/ActiveRecordCacheTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ public function tearDown(): void
2424
Cache::initialize();
2525
}
2626

27-
public function test_default_expire()
27+
public function testDefaultExpire()
2828
{
2929
$this->assertEquals(30, Cache::$options['expire']);
3030
}
3131

32-
public function test_explicit_default_expire()
32+
public function testExplicitDefaultExpire()
3333
{
3434
Config::instance()->set_cache('memcache://localhost', ['expire' => 1]);
3535
$this->assertEquals(1, Cache::$options['expire']);
3636
}
3737

38-
public function test_caches_column_meta_data()
38+
public function testCachesColumnMetaData()
3939
{
4040
Author::first();
4141

0 commit comments

Comments
 (0)