1010/**
1111 * Only migrate fresh if necessary -> much faster after first time!
1212 * Credits to mayahi, with some small changes of mine.
13+ *
1314 * @link https://mayahi.net/laravel/make-refresh-database-trait-much-faster/
1415 */
1516trait RefreshDatabaseFast
@@ -18,8 +19,6 @@ trait RefreshDatabaseFast
1819
1920 /**
2021 * Only migrates fresh if necessary
21- *
22- * @return void
2322 */
2423 protected function refreshTestDatabase (): void
2524 {
@@ -37,12 +36,10 @@ protected function refreshTestDatabase(): void
3736 /**
3837 * Check if migration fresh is necessary by checking
3938 * if the migrations files checksum has changed.
40- *
41- * @return void
4239 */
4340 protected function runMigrationsIfNecessary (): void
4441 {
45- if (!$ this ->identicalChecksum ()) {
42+ if (! $ this ->identicalChecksum ()) {
4643 if (config ('useful-traits.refresh_db_fast.seed ' )) {
4744 $ this ->seed ();
4845 }
@@ -56,8 +53,6 @@ protected function runMigrationsIfNecessary(): void
5653
5754 /**
5855 * Calaculates the checksum of the migration files.
59- *
60- * @return string
6156 */
6257 private function calculateChecksum (): string
6358 {
@@ -74,15 +69,15 @@ private function calculateChecksum(): string
7469
7570 $ files = array_keys (iterator_to_array ($ files ));
7671
77- $ checksum = collect ($ files )->map (function ($ file ) {return md5_file ($ file );})->implode ('' );
72+ $ checksum = collect ($ files )->map (function ($ file ) {
73+ return md5_file ($ file );
74+ })->implode ('' );
7875
7976 return md5 ($ checksum );
8077 }
8178
8279 /**
8380 * Filepath to store the checksum.
84- *
85- * @return string
8681 */
8782 private function checksumFilePath (): string
8883 {
@@ -91,8 +86,6 @@ private function checksumFilePath(): string
9186
9287 /**
9388 * Creates the checksum file.
94- *
95- * @return void
9689 */
9790 private function createChecksum (): void
9891 {
@@ -111,8 +104,6 @@ private function checksumFileContents()
111104
112105 /**
113106 * Check if checksum exists.
114- *
115- * @return bool
116107 */
117108 private function isChecksumExists (): bool
118109 {
@@ -122,12 +113,10 @@ private function isChecksumExists(): bool
122113 /**
123114 * Check if checksum of current database migration files
124115 * are identical to the one we stored already.
125- *
126- * @return bool
127116 */
128117 private function identicalChecksum (): bool
129118 {
130- if (!$ this ->isChecksumExists ()) {
119+ if (! $ this ->isChecksumExists ()) {
131120 return false ;
132121 }
133122
0 commit comments