Skip to content

Add support for PHP 8 #662

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
matrix:
php-version:
- "7.4"
- "8.0"

steps:
- name: "Checkout"
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
symfony-version:
- "4.4.x"
- "5.1.x"
Expand Down Expand Up @@ -91,14 +92,20 @@ jobs:
run: "composer update --no-interaction --no-progress --prefer-dist --prefer-stable --prefer-lowest"
if: "${{ matrix.deps == 'low' }}"

- name: "Run PHPUnit"
- name: "Run PHPUnit with coverage"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
if: "${{ matrix.php-version != '8.0' }}"

- name: "Run PHPUnit without coverage"
run: "vendor/bin/phpunit"
if: "${{ matrix.php-version == '8.0' }}"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "phpunit-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
if: "${{ matrix.php-version != '8.0' }}"

upload_coverage:
name: "Upload coverage to Codecov"
Expand Down
1 change: 1 addition & 0 deletions Tests/DataCollector/CommandDataCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ public function testCollector(): void
$collector = new CommandDataCollector(new CommandLogger());

$collector->collect($request = new Request(['group' => '0']), $response = new Response());
$this->assertSame(0, $collector->getCommandCount());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test was marked as risky. so I've added at least one assert.

}
}
6 changes: 0 additions & 6 deletions Tests/Fixtures/Form/Guesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,12 @@ class Guesser
/** @ODM\Field(type="bool") */
public $boolField;

/** @ODM\Field(type="boolean") */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had this error in phpunit

Remaining indirect deprecation notices (2)

  1x: Since doctrine/mongodb-odm 2.1: The "boolean" mapping type is deprecated. Use "bool" instead.
    1x in TypeGuesserTest::testTypesShouldBeGuessedCorrectly from Doctrine\Bundle\MongoDBBundle\Tests\Form\Type

  1x: Since doctrine/mongodb-odm 2.1: The "integer" mapping type is deprecated. Use "int" instead.
    1x in TypeGuesserTest::testTypesShouldBeGuessedCorrectly from Doctrine\Bundle\MongoDBBundle\Tests\Form\Type

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be the best to extract these two asserts into a separate test that would allow deprecation notices but considering simplicity of the guesser I think we'll be just fine

public $booleanField;

/** @ODM\Field(type="float") */
public $floatField;

/** @ODM\Field(type="int") */
public $intField;

/** @ODM\Field(type="integer") */
public $integerField;

/** @ODM\Field(type="collection") */
public $collectionField;

Expand Down
2 changes: 0 additions & 2 deletions Tests/Form/Type/GuesserTestType.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
->add('ts')
->add('categories', null, ['document_manager' => $options['dm']])
->add('boolField')
->add('booleanField')
->add('floatField')
->add('intField')
->add('integerField')
->add('collectionField')
->add('nonMappedField');
}
Expand Down
2 changes: 0 additions & 2 deletions Tests/Form/Type/TypeGuesserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,8 @@ public function testTypesShouldBeGuessedCorrectly(): void
$this->assertType('datetime', $form->get('date'));
$this->assertType('datetime', $form->get('ts'));
$this->assertType('checkbox', $form->get('boolField'));
$this->assertType('checkbox', $form->get('booleanField'));
$this->assertType('number', $form->get('floatField'));
$this->assertType('integer', $form->get('intField'));
$this->assertType('integer', $form->get('integerField'));
$this->assertType('collection', $form->get('collectionField'));
$this->assertType('text', $form->get('nonMappedField'));
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{"name": "Jonathan H. Wage", "email": "[email protected]"}
],
"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"doctrine/annotations": "^1.2",
"doctrine/mongodb-odm": "^2.0.0",
"doctrine/persistence": "^1.3.6|^2.0",
Expand Down