Skip to content

Commit

Permalink
Merge pull request FriendsOfSymfony#1389 from FriendsOfSymfony/INSIGHT
Browse files Browse the repository at this point in the history
Fix several issues from Sensio Insight
  • Loading branch information
GuilhemN committed Mar 12, 2016
2 parents d6cbe3d + 3a21be0 commit 23594b2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Controller/ExceptionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ protected function getParameters(ViewHandler $viewHandler, $currentContent, $cod
protected function findTemplate(Request $request, $format, $statusCode, $showException)
{
$name = $showException ? 'exception' : 'error';
if ($showException && 'html' == $format) {
if ($showException && 'html' === $format) {
$name = 'exception_full';
}

Expand Down
2 changes: 1 addition & 1 deletion Resources/meta/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE.
4 changes: 2 additions & 2 deletions Routing/Loader/RestXmlCollectionLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function parseRoute(RouteCollection $collection, \DOMElement $node, $p
$length = $node->childNodes->length;
for ($i = 0; $i < $length; ++$i) {
$loopNode = $node->childNodes->item($i);
if ($loopNode->nodeType == XML_TEXT_NODE) {
if ($loopNode->nodeType === XML_TEXT_NODE) {
continue;
}

Expand Down Expand Up @@ -266,7 +266,7 @@ private function getXmlErrors_($internalErrors)
$errors = array();
foreach (libxml_get_errors() as $error) {
$errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)',
LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
LIBXML_ERR_WARNING === $error->level ? 'WARNING' : 'ERROR',
$error->code,
trim($error->message),
$error->file ? $error->file : 'n/a',
Expand Down
5 changes: 3 additions & 2 deletions Serializer/JMSSerializerAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ private function convertContext($context, $direction)
$jmsContext = JMSSerializationContext::create();
} else {
$jmsContext = JMSDeserializationContext::create();
if (null !== $context->getMaxDepth()) {
for ($i = 0; $i < $context->getMaxDepth(); ++$i) {
$maxDepth = $context->getMaxDepth();
if (null !== $maxDepth) {
for ($i = 0; $i < $maxDepth; ++$i) {
$jmsContext->increaseDepth();
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/Routing/Loader/RestYamlCollectionLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public function testControllerAsServiceWithClassName()
$this->containerMock->expects($this->any())
->method('has')
->will($this->returnCallback(function ($serviceId) use ($controller) {
return $serviceId == get_class($controller);
return $serviceId === get_class($controller);
}));
$this->containerMock->expects($this->once())
->method('get')
Expand Down
4 changes: 2 additions & 2 deletions View/ViewHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ protected function getSerializationContext(View $view)
{
// BC < 1.8
$viewClass = 'FOS\RestBundle\View\View';
if (get_class($view) == $viewClass) {
if (get_class($view) === $viewClass) {
$context = $view->getContext();
} else {
$method = new \ReflectionMethod($view, 'getSerializationContext');
Expand Down Expand Up @@ -370,7 +370,7 @@ public function handle(View $view, Request $request = null)
public function createRedirectResponse(View $view, $location, $format)
{
$content = null;
if (($view->getStatusCode() == Codes::HTTP_CREATED || $view->getStatusCode() == Codes::HTTP_ACCEPTED) && $view->getData() != null) {
if (($view->getStatusCode() === Codes::HTTP_CREATED || $view->getStatusCode() === Codes::HTTP_ACCEPTED) && $view->getData() !== null) {
$response = $this->initResponse($view, $format);
} else {
$response = $view->getResponse();
Expand Down

0 comments on commit 23594b2

Please sign in to comment.