Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Config] Rename FileLoaderLoadException to LoaderLoadException #28027

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 1 commit into from
Aug 10, 2018

Conversation

ProgMiner
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no
Deprecations? yes
Tests pass? yes
Fixed tickets #27895
License MIT
Doc PR -

Renamed FileLoaderLoadException to LoaderLoadException.

* Exception class for when a resource cannot be loaded or imported.
*
* @author Ryan Weaver <[email protected]>
/*
Copy link
Member

@nicolas-grekas nicolas-grekas Jul 23, 2018

Choose a reason for hiding this comment

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

this should start a real docblock: /**
and in order to help IDEs and composer detect the deprecation and the alias, it should be on a real class declaration:

if (false) {
    /**
     * @deprecated since Symfony 4.2, use LoaderLoadException instead.
     */
    class FileLoaderLoadException extends LoaderLoadException
    {
    }
}

then a real deprecation should also be triggered (outside of the "if"):
@trigger_error(..., E_USER_DEPRECATED);


parent::__construct($message, $code, $previous);
}
@trigger_error('Deprecated since Symfony 4.2, use LoaderLoadException instead', E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

The "%s" class is deprecated since...

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

with a minor comment
what about naming the new exception LoaderException by the way?


parent::__construct($message, $code, $previous);
}
@trigger_error('The FileLoaderLoadException class is deprecated since Symfony 4.2, use LoaderLoadException instead', E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

sorry I was too laconic in my previous messages: we should to the same as in other places: put the FQCN, and double quotes around the class name:
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.2, use "%s" instead.', FileLoaderLoadException::class, LoaderLoadException::class), E_USER_DEPRECATED);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, ok.

@ProgMiner
Copy link
Contributor Author

I think LoaderLoadExcepton is better than LoadException, because other exceptions is named too like a "class + exception".
I have an another one question: is we have to use class_alias if FileLoaderLoadException is simply can extends LoaderLoadException and be deprecated?

@nicolas-grekas
Copy link
Member

FileLoaderLoadException is simply can extends LoaderLoadException

That wouldn't work: now that we throw the new kind, doing this would break existing catch and instanceof blocks that check for thrown exceptions.

@ProgMiner
Copy link
Contributor Author

Ok, thanks. Is it all that needed for merge?

@nicolas-grekas
Copy link
Member

It needs more people reviewing before, but basically yes :)

@nicolas-grekas nicolas-grekas changed the title Rename FileLoaderLoadException to LoaderLoadException [Config] Rename FileLoaderLoadException to LoaderLoadException Aug 7, 2018
@nicolas-grekas nicolas-grekas force-pushed the fileloaderloadexception branch 2 times, most recently from 0175962 to 1b54be7 Compare August 7, 2018 09:27
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

(I removed the class_alias() and replaced it with regular inheritance, so not break blocks like catch/instanceof FileLoaderLoadException)

UPGRADE-4.2.md Outdated
@@ -10,6 +10,7 @@ Config
------

* Deprecated constructing a `TreeBuilder` without passing root node information.
* Deprecated `FileLoaderLoadException`. Renamed to `LoaderLoadException`.
Copy link
Member

Choose a reason for hiding this comment

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

we need an entry in the UPGRADE-5.0.md file too mentioning the removal of the FileLoaderLoadException

Copy link
Member

Choose a reason for hiding this comment

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

done

@nicolas-grekas nicolas-grekas force-pushed the fileloaderloadexception branch from 1b54be7 to 24471a2 Compare August 10, 2018 07:13
@nicolas-grekas
Copy link
Member

Thank you @ProgMiner.

@nicolas-grekas nicolas-grekas merged commit 24471a2 into symfony:master Aug 10, 2018
nicolas-grekas added a commit that referenced this pull request Aug 10, 2018
…xception (ProgMiner)

This PR was merged into the 4.2-dev branch.

Discussion
----------

[Config] Rename FileLoaderLoadException to LoaderLoadException

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #27895
| License       | MIT
| Doc PR        | -

Renamed `FileLoaderLoadException` to `LoaderLoadException`.

Commits
-------

24471a2 [Config] Rename FileLoaderLoadException to LoaderLoadException
@ProgMiner ProgMiner deleted the fileloaderloadexception branch August 11, 2018 07:51
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
@fabpot fabpot mentioned this pull request Nov 3, 2018
@fabpot fabpot mentioned this pull request Nov 3, 2018
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.

4 participants