有没有使用多个调用和参数的PHP代码标准


Is there any code standards for PHP using multiple calls and arguments?

我正在使用Doctrine,并且在PHP中有这行代码:

    $result = $entityManager->getRepository('Example'Entity'Users')->findOneBy(array(
        'address' => $address->getId(),
        'email' => $email->getEmail(),
        'type' => $type->getId(),
    ));

我想知道是否有任何代码标准可以设置多个调用的行。我翻阅了《交响乐》和其他一些PSR,但找不到这么具体的东西。

PSR当前未指定它们。当链接方法时,我通常采用jQuery方法,例如,每个链接都在自己的缩进行上。所以,以你的代码为例,我会做这样的事情:

$result = $entityManager
            ->getRepository('Example'Entity'Users')
            ->findOneBy(
                array(
                    'address' => $address->getId(),
                    'email'   => $email->getEmail(),
                    'type'    => $type->getId(),
                )
            );

但话说回来,有些人会觉得它很丑陋,有些人不会:)它是PHP,毕竟,没有其他语言会产生这么多混杂的意见:)