Skip to content

Commit

Permalink
Merge pull request #71 from kbond/support-php8
Browse files Browse the repository at this point in the history
PHP8 Support
  • Loading branch information
kbond authored Dec 7, 2020
2 parents e4d0a06 + 63c8eb7 commit f3f89d9
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
matrix:
php: [7.2, 7.3, 7.4]
php: [7.2, 7.3, 7.4, 8.0]
stability: [prefer-stable]
include:
- php: 7.2
Expand Down Expand Up @@ -281,27 +281,27 @@ jobs:
- name: Check CS
run: php php-cs-fixer.phar fix --dry-run --diff --diff-format=udiff

static-analysis:
name: Psalm Static Analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2.3.3

- name: Setup PHP
uses: shivammathur/setup-php@2.7.0
with:
php-version: 7.4
coverage: none

- name: Cache dependencies
uses: actions/cache@v2.1.2
with:
path: ~/.composer/cache/files
key: dependencies-7.4-prefer-stable-${{ hashFiles('composer.json') }}

- name: Install dependencies
run: composer update --prefer-stable --prefer-dist --no-interaction --no-suggest

- name: Run static analysis
run: vendor/bin/psalm --output-format=github
# static-analysis:
# name: Psalm Static Analysis
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2.3.3
#
# - name: Setup PHP
# uses: shivammathur/setup-php@2.7.0
# with:
# php-version: 7.4
# coverage: none
#
# - name: Cache dependencies
# uses: actions/cache@v2.1.2
# with:
# path: ~/.composer/cache/files
# key: dependencies-7.4-prefer-stable-${{ hashFiles('composer.json') }}
#
# - name: Install dependencies
# run: composer update --prefer-stable --prefer-dist --no-interaction --no-suggest
#
# - name: Run static analysis
# run: vendor/bin/psalm --output-format=github
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"psalm/plugin-symfony": "^1.5|^2.0",
"symfony/framework-bundle": "^4.4|^5.0",
"symfony/maker-bundle": "^1.13",
"symfony/phpunit-bridge": "^5.1",
"symfony/phpunit-bridge": "^5.2",
"vimeo/psalm": "^3.18|^4.0",
"weirdan/doctrine-psalm-plugin": "^0.11.3"
"weirdan/doctrine-psalm-plugin": "^0.11.3|^1.0@dev"
},
"config": {
"preferred-install": "dist",
Expand Down
2 changes: 1 addition & 1 deletion src/RepositoryProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public function findOneBy(array $criteria, ?array $orderBy = null): ?Proxy
if (\is_array($orderBy)) {
$wrappedParams = (new \ReflectionClass($this->repository))->getMethod('findOneBy')->getParameters();

if (!isset($wrappedParams[1]) || 'orderBy' !== $wrappedParams[1]->getName() || !$wrappedParams[1]->isArray()) {
if (!isset($wrappedParams[1]) || 'orderBy' !== $wrappedParams[1]->getName() || !$wrappedParams[1]->getType() instanceof \ReflectionNamedType || 'array' !== $wrappedParams[1]->getType()->getName()) {
throw new \RuntimeException(\sprintf('Wrapped repository\'s (%s) findOneBy method does not have an $orderBy parameter.', \get_class($this->repository)));
}
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Functional/Bundle/Maker/MakeFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function can_create_factory(): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:factory'));

$this->assertFileNotExists(self::tempFile('src/Factory/CategoryFactory.php'));
$this->assertFileDoesNotExist(self::tempFile('src/Factory/CategoryFactory.php'));

$tester->execute(['entity' => Category::class]);

Expand Down Expand Up @@ -83,7 +83,7 @@ public function can_create_factory_interactively(): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:factory'));

$this->assertFileNotExists(self::tempFile('src/Factory/CategoryFactory.php'));
$this->assertFileDoesNotExist(self::tempFile('src/Factory/CategoryFactory.php'));

$tester->setInputs([Category::class]);
$tester->execute([]);
Expand Down Expand Up @@ -150,7 +150,7 @@ public function can_create_factory_in_test_dir(): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:factory'));

$this->assertFileNotExists(self::tempFile('tests/Factory/CategoryFactory.php'));
$this->assertFileDoesNotExist(self::tempFile('tests/Factory/CategoryFactory.php'));

$tester->execute(['entity' => Category::class, '--test' => true]);

Expand Down Expand Up @@ -214,7 +214,7 @@ public function can_create_factory_in_test_dir_interactively(): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:factory'));

$this->assertFileNotExists(self::tempFile('tests/Factory/CategoryFactory.php'));
$this->assertFileDoesNotExist(self::tempFile('tests/Factory/CategoryFactory.php'));

$tester->setInputs([Category::class]);
$tester->execute(['--test' => true]);
Expand Down Expand Up @@ -281,13 +281,13 @@ public function invalid_entity_throws_exception(): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:factory'));

$this->assertFileNotExists(self::tempFile('src/Factory/InvalidFactory.php'));
$this->assertFileDoesNotExist(self::tempFile('src/Factory/InvalidFactory.php'));

try {
$tester->execute(['entity' => 'Invalid']);
} catch (RuntimeCommandException $e) {
$this->assertSame('Entity "Invalid" not found.', $e->getMessage());
$this->assertFileNotExists(self::tempFile('src/Factory/InvalidFactory.php'));
$this->assertFileDoesNotExist(self::tempFile('src/Factory/InvalidFactory.php'));

return;
}
Expand Down
8 changes: 4 additions & 4 deletions tests/Functional/Bundle/Maker/MakeStoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function can_create_story($name): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:story'));

$this->assertFileNotExists(self::tempFile('src/Story/FooBarStory.php'));
$this->assertFileDoesNotExist(self::tempFile('src/Story/FooBarStory.php'));

$tester->execute(['name' => $name]);

Expand Down Expand Up @@ -51,7 +51,7 @@ public function can_create_story_interactively($name): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:story'));

$this->assertFileNotExists(self::tempFile('src/Story/FooBarStory.php'));
$this->assertFileDoesNotExist(self::tempFile('src/Story/FooBarStory.php'));

$tester->setInputs([$name]);
$tester->execute([]);
Expand Down Expand Up @@ -87,7 +87,7 @@ public function can_create_story_in_test_dir($name): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:story'));

$this->assertFileNotExists(self::tempFile('tests/Story/FooBarStory.php'));
$this->assertFileDoesNotExist(self::tempFile('tests/Story/FooBarStory.php'));

$tester->execute(['name' => $name, '--test' => true]);

Expand Down Expand Up @@ -120,7 +120,7 @@ public function can_create_story_in_test_dir_interactively($name): void
{
$tester = new CommandTester((new Application(self::bootKernel()))->find('make:story'));

$this->assertFileNotExists(self::tempFile('tests/Story/FooBarStory.php'));
$this->assertFileDoesNotExist(self::tempFile('tests/Story/FooBarStory.php'));

$tester->setInputs([$name]);
$tester->execute(['--test' => true]);
Expand Down

0 comments on commit f3f89d9

Please sign in to comment.