Skip to content

Commit 05b8573

Browse files
authored
Merge pull request #11 from bavix/fixes
init fixes
2 parents 20c4ea8 + b0f99e8 commit 05b8573

File tree

6 files changed

+197
-52
lines changed

6 files changed

+197
-52
lines changed

phpstan.baseline.neon

Lines changed: 100 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ parameters:
3030
count: 1
3131
path: src/Database/Connection.php
3232

33+
-
34+
message: "#^Return type \\(Bavix\\\\LaravelClickHouse\\\\Database\\\\Query\\\\Builder\\) of method Bavix\\\\LaravelClickHouse\\\\Database\\\\Connection\\:\\:query\\(\\) should be compatible with return type \\(Tinderbox\\\\ClickhouseBuilder\\\\Integrations\\\\Laravel\\\\Builder\\) of method Tinderbox\\\\ClickhouseBuilder\\\\Integrations\\\\Laravel\\\\Connection\\:\\:query\\(\\)$#"
35+
count: 1
36+
path: src/Database/Connection.php
37+
3338
-
3439
message: "#^Access to protected property Bavix\\\\LaravelClickHouse\\\\Database\\\\Query\\\\Builder\\:\\:\\$wheres\\.$#"
3540
count: 5
@@ -100,6 +105,16 @@ parameters:
100105
count: 1
101106
path: src/Database/Eloquent/Builder.php
102107

108+
-
109+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Builder\\:\\:create\\(\\) has no return type specified\\.$#"
110+
count: 1
111+
path: src/Database/Eloquent/Builder.php
112+
113+
-
114+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Builder\\:\\:create\\(\\) has parameter \\$attributes with no type specified\\.$#"
115+
count: 1
116+
path: src/Database/Eloquent/Builder.php
117+
103118
-
104119
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Builder\\:\\:createNestedWhere\\(\\) has parameter \\$whereSlice with no value type specified in iterable type array\\.$#"
105120
count: 1
@@ -455,6 +470,26 @@ parameters:
455470
count: 1
456471
path: src/Database/Eloquent/Collection.php
457472

473+
-
474+
message: "#^Call to an undefined method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Builder\\:\\:withTrashed\\(\\)\\.$#"
475+
count: 1
476+
path: src/Database/Eloquent/Model.php
477+
478+
-
479+
message: "#^Call to an undefined method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\|Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\Relation\\:\\:first\\(\\)\\.$#"
480+
count: 1
481+
path: src/Database/Eloquent/Model.php
482+
483+
-
484+
message: "#^Call to an undefined method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\|Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\Relation\\:\\:where\\(\\)\\.$#"
485+
count: 1
486+
path: src/Database/Eloquent/Model.php
487+
488+
-
489+
message: "#^Call to an undefined method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\|Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\Relation\\:\\:withTrashed\\(\\)\\.$#"
490+
count: 1
491+
path: src/Database/Eloquent/Model.php
492+
458493
-
459494
message: "#^Call to an undefined static method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:insert\\(\\)\\.$#"
460495
count: 1
@@ -560,6 +595,11 @@ parameters:
560595
count: 1
561596
path: src/Database/Eloquent/Model.php
562597

598+
-
599+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:childRouteBindingRelationshipName\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
600+
count: 1
601+
path: src/Database/Eloquent/Model.php
602+
563603
-
564604
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:clearBootedModels\\(\\) has no return type specified\\.$#"
565605
count: 1
@@ -610,11 +650,6 @@ parameters:
610650
count: 1
611651
path: src/Database/Eloquent/Model.php
612652

613-
-
614-
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:getConnection\\(\\) should return Illuminate\\\\Database\\\\Connection but returns Illuminate\\\\Database\\\\ConnectionInterface\\.$#"
615-
count: 1
616-
path: src/Database/Eloquent/Model.php
617-
618653
-
619654
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:getConnectionName\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
620655
count: 1
@@ -670,6 +705,16 @@ parameters:
670705
count: 1
671706
path: src/Database/Eloquent/Model.php
672707

708+
-
709+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:getRouteKey\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
710+
count: 1
711+
path: src/Database/Eloquent/Model.php
712+
713+
-
714+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:getRouteKeyName\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
715+
count: 1
716+
path: src/Database/Eloquent/Model.php
717+
673718
-
674719
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:getTable\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
675720
count: 1
@@ -785,11 +830,56 @@ parameters:
785830
count: 1
786831
path: src/Database/Eloquent/Model.php
787832

833+
-
834+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveChildRouteBinding\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
835+
count: 1
836+
path: src/Database/Eloquent/Model.php
837+
838+
-
839+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveChildRouteBindingQuery\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
840+
count: 1
841+
path: src/Database/Eloquent/Model.php
842+
843+
-
844+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveChildRouteBindingQuery\\(\\) return type with generic class Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\Relation does not specify its types\\: TRelatedModel$#"
845+
count: 1
846+
path: src/Database/Eloquent/Model.php
847+
788848
-
789849
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveConnection\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
790850
count: 1
791851
path: src/Database/Eloquent/Model.php
792852

853+
-
854+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveRouteBinding\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
855+
count: 1
856+
path: src/Database/Eloquent/Model.php
857+
858+
-
859+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveRouteBinding\\(\\) should return Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\|null but returns object\\|null\\.$#"
860+
count: 1
861+
path: src/Database/Eloquent/Model.php
862+
863+
-
864+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveRouteBindingQuery\\(\\) has parameter \\$query with generic class Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\Relation but does not specify its types\\: TRelatedModel$#"
865+
count: 1
866+
path: src/Database/Eloquent/Model.php
867+
868+
-
869+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveRouteBindingQuery\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
870+
count: 1
871+
path: src/Database/Eloquent/Model.php
872+
873+
-
874+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveSoftDeletableChildRouteBinding\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
875+
count: 1
876+
path: src/Database/Eloquent/Model.php
877+
878+
-
879+
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:resolveSoftDeletableRouteBinding\\(\\) is not final, but since the containing class is abstract, it should be\\.$#"
880+
count: 1
881+
path: src/Database/Eloquent/Model.php
882+
793883
-
794884
message: "#^Method Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:save\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
795885
count: 1
@@ -875,6 +965,11 @@ parameters:
875965
count: 1
876966
path: src/Database/Eloquent/Model.php
877967

968+
-
969+
message: "#^Property Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$casts \\(array\\) on left side of \\?\\? is not nullable\\.$#"
970+
count: 1
971+
path: src/Database/Eloquent/Model.php
972+
878973
-
879974
message: "#^Property Bavix\\\\LaravelClickHouse\\\\Database\\\\Eloquent\\\\Model\\:\\:\\$dateFormat \\(string\\) on left side of \\?\\? is not nullable\\.$#"
880975
count: 1
@@ -965,21 +1060,6 @@ parameters:
9651060
count: 1
9661061
path: src/Database/Query/Builder.php
9671062

968-
-
969-
message: "#^Property Bavix\\\\LaravelClickHouse\\\\Database\\\\Query\\\\Builder\\:\\:\\$connection has no type specified\\.$#"
970-
count: 1
971-
path: src/Database/Query/Builder.php
972-
973-
-
974-
message: "#^Unable to resolve the template type TKey in call to function collect$#"
975-
count: 1
976-
path: src/Database/Query/Builder.php
977-
978-
-
979-
message: "#^Unable to resolve the template type TValue in call to function collect$#"
980-
count: 1
981-
path: src/Database/Query/Builder.php
982-
9831063
-
9841064
message: "#^Unsafe usage of new static\\(\\)\\.$#"
9851065
count: 1

src/Database/Connection.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010

1111
class Connection extends \Tinderbox\ClickhouseBuilder\Integrations\Laravel\Connection
1212
{
13-
/**
14-
* @return Builder|\Tinderbox\ClickhouseBuilder\Integrations\Laravel\Builder
15-
*/
16-
public function query()
13+
public function query(): Builder
1714
{
1815
return new Builder($this, new Grammar());
1916
}

src/Database/Eloquent/Builder.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,13 @@ public function newModelInstance($attributes = [])
652652
->setConnection($this->query->getConnection()->getName());
653653
}
654654

655+
public function create($attributes = [])
656+
{
657+
return tap($this->newModelInstance($attributes), static function ($instance) {
658+
$instance->save();
659+
});
660+
}
661+
655662
public function getQuery(): QueryBuilder
656663
{
657664
return $this->query;

src/Database/Eloquent/Concerns/HasAttributes.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@ trait HasAttributes
1212

1313
public function getDates(): array
1414
{
15-
return property_exists($this, 'dates') && is_array($this->dates)
16-
? $this->dates
17-
: [];
15+
return $this->dates ?? [];
1816
}
1917

2018
public function getCasts(): array
2119
{
22-
return $this->casts;
20+
return $this->casts ?? [];
2321
}
2422

2523
protected function getDateFormat(): string

0 commit comments

Comments
 (0)