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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix problem with automatically registered DocBlockDriver #845

Merged

Conversation

alexander-schranz
Copy link
Contributor

@alexander-schranz alexander-schranz commented Mar 22, 2021

Q A
Bug fix? yes
New feature? no
Doc updated no
BC breaks? no
Deprecations? no
Tests pass? hopefully 馃檹
Fixed tickets #...
License MIT

Fixes #844
Related to #824

@alexander-schranz alexander-schranz changed the title Fix problem with automaticaaly registered DocBlockDriver Fix problem with automatically registered DocBlockDriver Mar 22, 2021
@simPod
Copy link
Contributor

simPod commented Mar 22, 2021

Shouldn't we also make TypedPropertiesDriver configurable btw?

@alexander-schranz
Copy link
Contributor Author

@simPod I don't see it for the types as they can not be configured false like phpdoc:

Example:

class MyClass {
     private int $test = '';
}

Is invalid php code and so the class is never loaded and will run into a:

PHP Fatal error: Default value for property of type int can only be int in Command line code on line 2
Fatal error: Default value for property of type int can only be int in Command line code on line 2

where the following with phpdocs is valid php code which runs without any problems:

class MyClass {
     /**
      * @var int
      */
     private $test = '';
}

@simPod
Copy link
Contributor

simPod commented Mar 22, 2021

I suppose some people might want to turn it off. We have doctrine driver configurable too. It's out of scope of this fix though.

@alexander-schranz
Copy link
Contributor Author

Lets wait for the feedback of @goetas. What he think what the best would be to fix this issue.

@goetas
Copy link
Collaborator

goetas commented Mar 22, 2021

make sense, I should have made it opt it from the beginning!

@goetas goetas merged commit e3ab3ab into schmittjoh:master Mar 22, 2021
@goetas
Copy link
Collaborator

goetas commented Mar 22, 2021

Regarding the TypedPropertiesDriver, i think that can stay as it is since the type correctness is enforced by php, thus should work in all the cases

@alexander-schranz alexander-schranz deleted the bugfix/optional-doc-block-driver branch March 22, 2021 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3.9.0] InvalidArgumentException Can't use incorrect type
3 participants