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

Only add classes to compile on PHP < 7.0 #387

Merged
merged 1 commit into from
Jun 20, 2017
Merged

Only add classes to compile on PHP < 7.0 #387

merged 1 commit into from
Jun 20, 2017

Conversation

jvasseur
Copy link
Contributor

I am targeting this branch, because this fix a deprecation warning and is BC.

Changelog

### Fixed
- deprecation notices related to `addClassesToCompile`

Subject

Only call addClassesToCompile on PHP < 7.0 since it is deprecated and doesn't improve performances with PHP >= 7.0

addClassesToCompile is deprecated and doesn't improve performances on PHP > 7.0
@greg0ire greg0ire added the patch label Jun 19, 2017
@OskarStark OskarStark closed this Jun 20, 2017
@OskarStark OskarStark reopened this Jun 20, 2017
@OskarStark OskarStark added the RTM label Jun 20, 2017
@OskarStark OskarStark merged commit 4e451e8 into sonata-project:3.x Jun 20, 2017
@jvasseur jvasseur deleted the add-classes-to-compile branch June 20, 2017 07:59
@@ -72,7 +72,9 @@ public function load(array $configs, ContainerBuilder $container)
$this->configureProfiler($container, $config);
$this->configureException($container, $config);
$this->configureMenus($container, $config);
$this->configureClassesToCompile();
if (\PHP_VERSION_ID < 70000) {
Copy link
Member

Choose a reason for hiding this comment

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

It would be more readable to use version_compare IMHO.

Copy link
Contributor Author

@jvasseur jvasseur Jun 20, 2017

Choose a reason for hiding this comment

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

I personally prefer using the constant:

  • It's what symfony uses in it's codebase
  • The php optimizer can optimize it and remove this part of code on the corresponding php versions

Copy link
Contributor

Choose a reason for hiding this comment

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

@soullivaneuh do you know why they choose to do it like this in sf?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@greg0ire it's done to allow the optimization of opcodes : symfony/symfony#12497

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah plus it's less error prone, and it's still easy to ready with such a constant.

Copy link
Member

Choose a reason for hiding this comment

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

In this case, go for it.

It would be a great Fixer idea for php-cs-fixer BTW...

@OskarStark OskarStark removed the RTM label Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants