Skip to content
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

Docs: Removing type: 'integer' from mappings #10368

Merged
merged 1 commit into from
Jan 3, 2023

Conversation

ThomasLandauer
Copy link
Contributor

Yet another micro-PR ;-) - as requested at #10364 (comment)

I also changed $currentPrice from float to int, since IMO it's better to store prices as int (=cents).

Question: Is there a reason why most typehints are int|null, instead of ?int? Should I change them?

Yet another micro-PR ;-) - as requested at doctrine#10364 (comment)

I also changed `$currentPrice` from `float` to `int`, since IMO it's better to store prices as `int` (=cents).

Question: Is there a reason why most typehints are `int|null`, instead of `?int`? Should I change them?
@SenseException
Copy link
Member

Thank you @ThomasLandauer

Question: Is there a reason why most typehints are int|null, instead of ?int? Should I change them?

It's part of the coding-standard, but as far as I know there's no deeper meaning into this decision. It was introduced in doctrine/coding-standard#266

@SenseException SenseException merged commit 036ea71 into doctrine:2.14.x Jan 3, 2023
@ThomasLandauer ThomasLandauer deleted the patch-8 branch January 3, 2023 23:36
ThomasLandauer added a commit to ThomasLandauer/orm that referenced this pull request Jan 3, 2023
Answer to doctrine#10368 (comment)

PSR-12 https://www.php-fig.org/psr/psr-12/ has this example, so it looks like it's preferring `?string`:
```php
public function functionName(?string $arg1, ?int &$arg2): ?string
```
But changing it in `ruleset.xml` would lead to errors allover the Doctrine code itself, right?
derrabus added a commit to derrabus/orm that referenced this pull request Jan 9, 2023
* 2.14.x:
  PHPStan 1.9.8, Psalm 5.4.0 (doctrine#10382)
  fix typo for missing a comma (doctrine#10377)
  Docs: Removing `type: 'integer'` from mappings (doctrine#10368)
  Docs: Moving *attributes* mapping to first position (doctrine#10364)
  Docs: Deleting duplicate mapping example (doctrine#10363)
derrabus added a commit to derrabus/orm that referenced this pull request Jan 9, 2023
* 2.15.x:
  Use more precise types for class strings (doctrine#10381)
  PHPStan 1.9.8, Psalm 5.4.0 (doctrine#10382)
  fix typo for missing a comma (doctrine#10377)
  Docs: Removing `type: 'integer'` from mappings (doctrine#10368)
  Docs: Moving *attributes* mapping to first position (doctrine#10364)
  Docs: Deleting duplicate mapping example (doctrine#10363)
@greg0ire greg0ire added this to the 2.14.1 milestone Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants