11<?php
2+ declare (strict_types=1 );
23/**
34 * This file is part of cakephp-database-backup.
45 *
@@ -36,7 +37,7 @@ trait BackupTrait
3637 * @param string $path Relative or absolute path
3738 * @return string
3839 */
39- public function getAbsolutePath ($ path )
40+ public function getAbsolutePath (string $ path ): string
4041 {
4142 if (!(new Filesystem ())->isAbsolutePath ($ path )) {
4243 return add_slash_term (Configure::read ('DatabaseBackup.target ' )) . $ path ;
@@ -52,7 +53,7 @@ public function getAbsolutePath($path)
5253 * @uses getExtension()
5354 * @uses getValidCompressions()
5455 */
55- public function getCompression ($ filename )
56+ public function getCompression (string $ filename ): ? string
5657 {
5758 //Gets the extension from the filename
5859 $ extension = $ this ->getExtension ($ filename );
@@ -66,7 +67,7 @@ public function getCompression($filename)
6667 * @param string|null $name Connection name
6768 * @return \Cake\Datasource\ConnectionInterface A connection object
6869 */
69- public function getConnection ($ name = null )
70+ public function getConnection (? string $ name = null ): ConnectionInterface
7071 {
7172 return ConnectionManager::get ($ name ?: Configure::readOrFail ('DatabaseBackup.connection ' ));
7273 }
@@ -80,7 +81,7 @@ public function getConnection($name = null)
8081 * @throws \InvalidArgumentException
8182 * @uses getConnection()
8283 */
83- public function getDriver (ConnectionInterface $ connection = null )
84+ public function getDriver (? ConnectionInterface $ connection = null ): object
8485 {
8586 $ connection = $ connection ?: $ this ->getConnection ();
8687 $ className = get_class_short_name ($ connection ->getDriver ());
@@ -101,7 +102,7 @@ public function getDriver(ConnectionInterface $connection = null)
101102 * if is an invalid extension
102103 * @uses $validExtensions
103104 */
104- public function getExtension ($ filename )
105+ public function getExtension (string $ filename ): ? string
105106 {
106107 $ extension = get_extension ($ filename );
107108
@@ -114,7 +115,7 @@ public function getExtension($filename)
114115 * @since 2.4.0
115116 * @uses $validExtensions
116117 */
117- public function getValidCompressions ()
118+ public function getValidCompressions (): array
118119 {
119120 return array_filter (self ::$ validExtensions );
120121 }
0 commit comments