diff --git a/.github/workflows/ci-mssql.yml b/.github/workflows/ci-mssql.yml
index 43d00c0..2b34c22 100644
--- a/.github/workflows/ci-mssql.yml
+++ b/.github/workflows/ci-mssql.yml
@@ -14,6 +14,6 @@ jobs:
phpunit:
uses: cycle/gh-actions/.github/workflows/db-mssql.yml@master
with:
- php: '["8.1","8.2","8.3"]'
+ php: '["8.1","8.2","8.3","8.4"]'
...
diff --git a/.github/workflows/ci-mysql.yml b/.github/workflows/ci-mysql.yml
index f74f61c..e788f59 100644
--- a/.github/workflows/ci-mysql.yml
+++ b/.github/workflows/ci-mysql.yml
@@ -14,6 +14,6 @@ jobs:
phpunit:
uses: cycle/gh-actions/.github/workflows/db-mysql.yml@master
with:
- php: '["8.1","8.2","8.3"]'
+ php: '["8.1","8.2","8.3","8.4"]'
...
diff --git a/.github/workflows/ci-pgsql.yml b/.github/workflows/ci-pgsql.yml
index 40f186e..83ffad3 100644
--- a/.github/workflows/ci-pgsql.yml
+++ b/.github/workflows/ci-pgsql.yml
@@ -14,6 +14,6 @@ jobs:
phpunit:
uses: cycle/gh-actions/.github/workflows/db-pgsql.yml@master
with:
- php: '["8.1","8.2","8.3"]'
+ php: '["8.1","8.2","8.3","8.4"]'
...
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 44471e5..34bc8f5 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -14,13 +14,20 @@ jobs:
matrix:
php-versions: ['8.1']
steps:
+ - name: Install ODBC driver.
+ run: |
+ sudo curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
+ sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
+
- name: Checkout
uses: actions/checkout@v2
+
- name: Setup DB services
run: |
cd tests
docker compose up -d
cd ..
+
- name: Setup PHP ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
@@ -28,22 +35,24 @@ jobs:
coverage: pcov
tools: pecl
extensions: mbstring, pdo, pdo_sqlite, pdo_pgsql, pdo_sqlsrv, pdo_mysql
+
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
+
- name: Restore Composer Cache
- uses: actions/cache@v2
+ uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies with composer
- if: matrix.php-versions != '8.2'
+ if: matrix.php-versions != '8.5'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- - name: Install dependencies with composer php 8.2
- if: matrix.php-versions == '8.2'
+ - name: Install dependencies with composer php 8.5
+ if: matrix.php-versions == '8.5'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Execute Tests
@@ -67,7 +76,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
- php-versions: ['8.1']
+ php-versions: ['8.1', '8.4']
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -82,18 +91,18 @@ jobs:
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Restore Composer Cache
- uses: actions/cache@v2
+ uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies with composer
- if: matrix.php-versions != '8.1'
+ if: matrix.php-versions != '8.5'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- - name: Install dependencies with composer php 8.1
- if: matrix.php-versions == '8.1'
+ - name: Install dependencies with composer php 8.5
+ if: matrix.php-versions == '8.5'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
- name: Execute Tests
diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml
index b272684..dbb74a1 100644
--- a/.github/workflows/static-analysis.yml
+++ b/.github/workflows/static-analysis.yml
@@ -56,7 +56,7 @@ jobs:
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
- name: ♻️ Restore cached dependencies installed with composer
- uses: actions/cache@v4.0.2
+ uses: actions/cache@v4
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
diff --git a/.idea/icon.svg b/.idea/icon.svg
new file mode 100644
index 0000000..1174bb0
--- /dev/null
+++ b/.idea/icon.svg
@@ -0,0 +1,15 @@
+
diff --git a/composer.json b/composer.json
index a97720d..59dde7c 100644
--- a/composer.json
+++ b/composer.json
@@ -15,8 +15,8 @@
"buggregator/trap": "^1.11",
"mockery/mockery": "^1.5",
"phpunit/phpunit": "^9.5",
- "spiral/code-style": "~2.2.0",
- "vimeo/psalm": "^5.25"
+ "spiral/code-style": "^2.2.0",
+ "vimeo/psalm": "^6.4"
},
"autoload": {
"psr-4": {
diff --git a/psalm-baseline.xml b/psalm-baseline.xml
index 9f77c52..8def121 100644
--- a/psalm-baseline.xml
+++ b/psalm-baseline.xml
@@ -1,5 +1,5 @@
-
+
@@ -65,9 +65,6 @@
-
-
-
schemas]]>
@@ -80,12 +77,6 @@
-
-
-
-
-
-
config['directory'] ?? '']]>
config['directory'] ?? '']]>
@@ -98,13 +89,14 @@
+
+
+
-
-
]]>
@@ -124,9 +116,6 @@
capsule->getDatabase()]]>
-
-
-
diff --git a/psalm.xml b/psalm.xml
index e48b2c0..6be83f4 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -20,11 +20,4 @@
-
-
-
-
-
-
-
diff --git a/src/FileRepository.php b/src/FileRepository.php
index 9b9c0ec..20cde99 100644
--- a/src/FileRepository.php
+++ b/src/FileRepository.php
@@ -39,7 +39,7 @@ final class FileRepository implements RepositoryInterface
private FilesInterface $files;
private Inflector $inflector;
- public function __construct(private MigrationConfig $config, FactoryInterface $factory = null)
+ public function __construct(private MigrationConfig $config, ?FactoryInterface $factory = null)
{
$this->files = new Files();
$this->factory = $factory ?? new Container();
@@ -71,7 +71,7 @@ public function getMigrations(): array
return $migrations;
}
- public function registerMigration(string $name, string $class, string $body = null): string
+ public function registerMigration(string $name, string $class, ?string $body = null): string
{
if (empty($body) && !\class_exists($class)) {
throw new RepositoryException(
@@ -123,6 +123,7 @@ private function getFilesIterator(): \Generator
$this->config->getVendorDirectories(),
) as $directory
) {
+ $directory === '' and $directory = '.';
yield from $this->getFiles($directory);
}
}
@@ -130,6 +131,8 @@ private function getFilesIterator(): \Generator
/**
* Internal method to fetch all migration filenames.
*
+ * @param non-empty-string $directory
+ *
* @return \Generator
*/
private function getFiles(string $directory): \Generator
diff --git a/src/Migrator.php b/src/Migrator.php
index edaaa2e..22dd179 100644
--- a/src/Migrator.php
+++ b/src/Migrator.php
@@ -105,7 +105,7 @@ public function getMigrations(): array
*
* @throws MigrationException
*/
- public function run(CapsuleInterface $capsule = null): ?MigrationInterface
+ public function run(?CapsuleInterface $capsule = null): ?MigrationInterface
{
if (!$this->isConfigured()) {
throw new MigrationException('Unable to run migration, Migrator not configured');
@@ -158,7 +158,7 @@ static function () use ($migration, $capsule): void {
*
* @throws \Throwable
*/
- public function rollback(CapsuleInterface $capsule = null): ?MigrationInterface
+ public function rollback(?CapsuleInterface $capsule = null): ?MigrationInterface
{
if (!$this->isConfigured()) {
throw new MigrationException('Unable to run migration, Migrator not configured');
@@ -214,7 +214,7 @@ protected function resolveState(MigrationInterface $migration): State
* Migration table, all migration information will be stored in it.
*
*/
- protected function migrationTable(string $database = null): Table
+ protected function migrationTable(?string $database = null): Table
{
return $this->dbal->database($database)->table($this->config->getTable());
}
diff --git a/src/RepositoryInterface.php b/src/RepositoryInterface.php
index 0750e30..de9f9e5 100644
--- a/src/RepositoryInterface.php
+++ b/src/RepositoryInterface.php
@@ -31,5 +31,5 @@ public function getMigrations(): array;
* @throws RepositoryException
*
*/
- public function registerMigration(string $name, string $class, string $body = null): string;
+ public function registerMigration(string $name, string $class, ?string $body = null): string;
}
diff --git a/src/State.php b/src/State.php
index 493b837..8e7abfb 100644
--- a/src/State.php
+++ b/src/State.php
@@ -41,7 +41,7 @@ public function getTimeExecuted(): ?\DateTimeInterface
return $this->timeExecuted;
}
- public function withStatus(int $status, \DateTimeInterface $timeExecuted = null): self
+ public function withStatus(int $status, ?\DateTimeInterface $timeExecuted = null): self
{
$state = clone $this;
$state->status = $status;
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index d66bac9..9121c27 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -49,8 +49,9 @@
database: 'tempdb',
host: '127.0.0.1',
port: 11433,
+ trustServerCertificate: true,
user: 'SA',
- password: 'YourStrong!Passw0rd'
+ password: 'YourStrong!Passw0rd',
),
queryCache: true
),