diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php index bb37d99b21..6100eb87a5 100644 --- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php +++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php @@ -149,7 +149,7 @@ EOF return; } $refl = new \ReflectionMethod($cb[0], $cb[1]); - } elseif (is_object($cb) && is_callable($cb)) { + } elseif (is_object($cb) && method_exists($cb, '__invoke')) { $refl = new \ReflectionMethod($cb, '__invoke'); } elseif (function_exists($cb)) { $refl = new \ReflectionFunction($cb); diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml index 9d70124fbe..36347eccb2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.xml @@ -14,7 +14,7 @@ - + null null null diff --git a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php index 199226a5a9..89961b9cae 100644 --- a/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php +++ b/src/Symfony/Component/Console/Descriptor/ApplicationDescription.php @@ -137,15 +137,17 @@ class ApplicationDescription private function sortCommands(array $commands) { $namespacedCommands = array(); + $globalCommands = array(); foreach ($commands as $name => $command) { $key = $this->application->extractNamespace($name, 1); if (!$key) { - $key = '_global'; + $globalCommands['_global'][$name] = $command; + } else { + $namespacedCommands[$key][$name] = $command; } - - $namespacedCommands[$key][$name] = $command; } ksort($namespacedCommands); + $namespacedCommands = array_merge($globalCommands, $namespacedCommands); foreach ($namespacedCommands as &$commandsSet) { ksort($commandsSet); diff --git a/src/Symfony/Component/Console/Question/Question.php b/src/Symfony/Component/Console/Question/Question.php index 9aa4c69d27..6effa42585 100644 --- a/src/Symfony/Component/Console/Question/Question.php +++ b/src/Symfony/Component/Console/Question/Question.php @@ -220,7 +220,7 @@ class Question * * The normalizer can be a callable (a string), a closure or a class implementing __invoke. * - * @param string|\Closure $normalizer + * @param callable $normalizer * * @return Question The current instance */ @@ -236,7 +236,7 @@ class Question * * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. * - * @return string|\Closure + * @return callable */ public function getNormalizer() { diff --git a/src/Symfony/Component/Console/Tests/Command/ListCommandTest.php b/src/Symfony/Component/Console/Tests/Command/ListCommandTest.php index 3578d48856..36d2380602 100644 --- a/src/Symfony/Component/Console/Tests/Command/ListCommandTest.php +++ b/src/Symfony/Component/Console/Tests/Command/ListCommandTest.php @@ -61,4 +61,52 @@ EOF; $this->assertEquals($output, $commandTester->getDisplay(true)); } + + public function testExecuteListsCommandsOrder() + { + require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php'); + $application = new Application(); + $application->add(new \Foo6Command()); + $commandTester = new CommandTester($command = $application->get('list')); + $commandTester->execute(array('command' => $command->getName()), array('decorated' => false)); + $output = <<assertEquals($output, trim($commandTester->getDisplay(true))); + } + + public function testExecuteListsCommandsOrderRaw() + { + require_once realpath(__DIR__.'/../Fixtures/Foo6Command.php'); + $application = new Application(); + $application->add(new \Foo6Command()); + $commandTester = new CommandTester($command = $application->get('list')); + $commandTester->execute(array('command' => $command->getName(), '--raw' => true)); + $output = <<assertEquals($output, trim($commandTester->getDisplay(true))); + } } diff --git a/src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php b/src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php new file mode 100644 index 0000000000..6ae987e484 --- /dev/null +++ b/src/Symfony/Component/Console/Tests/Fixtures/Foo6Command.php @@ -0,0 +1,12 @@ +setName('0foo:bar')->setDescription('0foo:bar command'); + } +} diff --git a/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php b/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php index 24b15d97ad..b43b88d98d 100644 --- a/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php +++ b/src/Symfony/Component/Finder/Iterator/CustomFilterIterator.php @@ -26,8 +26,8 @@ class CustomFilterIterator extends FilterIterator /** * Constructor. * - * @param \Iterator $iterator The Iterator to filter - * @param array $filters An array of PHP callbacks + * @param \Iterator $iterator The Iterator to filter + * @param callable[] $filters An array of PHP callbacks * * @throws \InvalidArgumentException */ diff --git a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php index 87ac434804..0be0b68a45 100644 --- a/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ b/src/Symfony/Component/HttpKernel/Controller/ControllerResolver.php @@ -131,7 +131,7 @@ class ControllerResolver implements ControllerResolverInterface * * @param string $controller A Controller string * - * @return mixed A PHP callable + * @return callable A PHP callable * * @throws \InvalidArgumentException */ diff --git a/src/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php b/src/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php index b61999cd6d..77a5c1a2ad 100644 --- a/src/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php +++ b/src/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php @@ -29,8 +29,6 @@ class FilterControllerEvent extends KernelEvent { /** * The current controller. - * - * @var callable */ private $controller; diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 4bd616d9f6..1f3c282e64 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -1270,7 +1270,7 @@ class Process * * @param callable|null $callback The user defined PHP callback * - * @return callable A PHP callable + * @return \Closure A PHP closure */ protected function buildCallback($callback) { diff --git a/src/Symfony/Component/Security/Core/Resources/translations/security.tr.xlf b/src/Symfony/Component/Security/Core/Resources/translations/security.tr.xlf index fbf9b260b0..68c44213d1 100644 --- a/src/Symfony/Component/Security/Core/Resources/translations/security.tr.xlf +++ b/src/Symfony/Component/Security/Core/Resources/translations/security.tr.xlf @@ -8,7 +8,7 @@ Authentication credentials could not be found. - Yetkilendirme girdileri bulunamadı. + Kimlik bilgileri bulunamadı. Authentication request could not be processed due to a system problem. @@ -16,7 +16,7 @@ Invalid credentials. - Geçersiz girdiler. + Geçersiz kimlik bilgileri. Cookie has already been used by someone else. @@ -32,7 +32,7 @@ Digest nonce has expired. - Derleme zaman aşımı gerçekleşti. + Derleme zaman aşımına uğradı. No authentication provider found to support the authentication token. @@ -44,7 +44,7 @@ No token could be found. - Bilet bulunamadı. + Fiş bulunamadı. Username could not be found. @@ -56,11 +56,11 @@ Credentials have expired. - Girdiler zaman aşımına uğradı. + Kimlik bilgileri zaman aşımına uğradı. Account is disabled. - Hesap devre dışı bırakılmış. + Hesap engellenmiş. Account is locked. diff --git a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php index 08bbc58245..412af91c4f 100644 --- a/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php +++ b/src/Symfony/Component/Security/Core/Tests/Authorization/AccessDecisionManagerTest.php @@ -102,7 +102,7 @@ class AccessDecisionManagerTest extends \PHPUnit_Framework_TestCase protected function getVoterFor2Roles($token, $vote1, $vote2) { $voter = $this->getMock('Symfony\Component\Security\Core\Authorization\Voter\VoterInterface'); - $voter->expects($this->exactly(2)) + $voter->expects($this->any()) ->method('vote') ->will($this->returnValueMap(array( array($token, null, array('ROLE_FOO'), $vote1), diff --git a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php index 3638f0c414..8627bc82a4 100644 --- a/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php +++ b/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php @@ -35,7 +35,10 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface const COOKIE_DELIMITER = ':'; protected $logger; - protected $options; + protected $options = array( + 'secure' => false, + 'httponly' => true, + ); private $providerKey; private $secret; private $userProviders; @@ -66,7 +69,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface $this->userProviders = $userProviders; $this->secret = $secret; $this->providerKey = $providerKey; - $this->options = $options; + $this->options = array_merge($this->options, $options); $this->logger = $logger; } diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php index 4ea4f5d706..7495398ec2 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/AbstractRememberMeServicesTest.php @@ -91,11 +91,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase $request = new Request(); $response = new Response(); $token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'); - $service->logout($request, $response, $token); - $cookie = $request->attributes->get(RememberMeServicesInterface::COOKIE_ATTR_NAME); - $this->assertInstanceOf('Symfony\Component\HttpFoundation\Cookie', $cookie); $this->assertTrue($cookie->isCleared()); $this->assertSame($options['name'], $cookie->getName()); @@ -286,13 +283,6 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase $userProvider = $this->getProvider(); } - if (!isset($options['secure'])) { - $options['secure'] = false; - } - if (!isset($options['httponly'])) { - $options['httponly'] = true; - } - return $this->getMockForAbstractClass('Symfony\Component\Security\Http\RememberMe\AbstractRememberMeServices', array( array($userProvider), 'foosecret', 'fookey', $options, $logger, )); diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php index 43aaf92232..502d17077b 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/PersistentTokenBasedRememberMeServicesTest.php @@ -313,13 +313,6 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test $userProvider = $this->getProvider(); } - if (!isset($options['secure'])) { - $options['secure'] = false; - } - if (!isset($options['httponly'])) { - $options['httponly'] = true; - } - return new PersistentTokenBasedRememberMeServices(array($userProvider), 'foosecret', 'fookey', $options, $logger, new SecureRandom(sys_get_temp_dir().'/_sf2.seed')); } diff --git a/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php b/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php index dab811b2e6..f1fb897b86 100644 --- a/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php +++ b/src/Symfony/Component/Security/Http/Tests/RememberMe/TokenBasedRememberMeServicesTest.php @@ -266,13 +266,6 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase $userProvider = $this->getProvider(); } - if (!isset($options['secure'])) { - $options['secure'] = false; - } - if (!isset($options['httponly'])) { - $options['httponly'] = true; - } - $service = new TokenBasedRememberMeServices(array($userProvider), 'foosecret', 'fookey', $options, $logger); return $service; diff --git a/src/Symfony/Component/Security/Tests/TranslationSyncStatusTest.php b/src/Symfony/Component/Security/Tests/TranslationSyncStatusTest.php new file mode 100644 index 0000000000..4b72d41d5a --- /dev/null +++ b/src/Symfony/Component/Security/Tests/TranslationSyncStatusTest.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Tests; + +use Symfony\Component\Finder\Finder; + +class TranslationSyncStatusTest extends \PHPUnit_Framework_TestCase +{ + /** + * @dataProvider getTranslationDirectoriesData + */ + public function testTranslationFileIsNotMissingInCore($dir1, $dir2) + { + $finder = new Finder(); + $files = $finder->in($dir1)->files(); + + foreach ($files as $file) { + $this->assertFileExists($dir2.'/'.$file->getFilename(), 'Missing file '.$file->getFilename().' in directory '.$dir2); + } + } + + public function getTranslationDirectoriesData() + { + $legacyTranslationsDir = $this->getLegacyTranslationsDirectory(); + $coreTranslationsDir = $this->getCoreTranslationsDirectory(); + + return array( + 'file-not-missing-in-core' => array($legacyTranslationsDir, $coreTranslationsDir), + 'file-not-added-in-core' => array($coreTranslationsDir, $legacyTranslationsDir), + ); + } + + public function testFileContentsAreEqual() + { + $finder = new Finder(); + $files = $finder->in($this->getLegacyTranslationsDirectory())->files(); + + foreach ($files as $file) { + $coreFile = $this->getCoreTranslationsDirectory().'/'.$file->getFilename(); + + $this->assertFileEquals($file->getRealPath(), $coreFile, $file.' and '.$coreFile.' have equal content.'); + } + } + + private function getLegacyTranslationsDirectory() + { + return __DIR__.'/../Resources/translations'; + } + + private function getCoreTranslationsDirectory() + { + return __DIR__.'/../Core/Resources/translations'; + } +} diff --git a/src/Symfony/Component/Security/composer.json b/src/Symfony/Component/Security/composer.json index ad0ea41586..8a585207b3 100644 --- a/src/Symfony/Component/Security/composer.json +++ b/src/Symfony/Component/Security/composer.json @@ -30,6 +30,7 @@ "symfony/security-http": "self.version" }, "require-dev": { + "symfony/finder": "~2.3|~3.0.0", "symfony/phpunit-bridge": "~2.7|~3.0.0", "symfony/intl": "~2.3|~3.0.0", "symfony/routing": "~2.2|~3.0.0", diff --git a/src/Symfony/Component/Security/phpunit.xml.dist b/src/Symfony/Component/Security/phpunit.xml.dist index c0dbb2d299..0d9fe5fee1 100644 --- a/src/Symfony/Component/Security/phpunit.xml.dist +++ b/src/Symfony/Component/Security/phpunit.xml.dist @@ -12,6 +12,7 @@ + ./Tests/ ./Acl/Tests/ ./Core/Tests/ ./Http/Tests/ @@ -24,6 +25,7 @@ ./ ./vendor + ./Tests ./Acl/Tests ./Core/Tests ./Http/Tests diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index 8cc85e5b61..55c60c0f95 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -105,7 +105,7 @@ abstract class AbstractNormalizer extends SerializerAwareNormalizer implements N /** * Set normalization callbacks. * - * @param array $callbacks help normalize the result + * @param callable[] $callbacks help normalize the result * * @return self * diff --git a/src/Symfony/Component/Templating/PhpEngine.php b/src/Symfony/Component/Templating/PhpEngine.php index 755fa283bd..253796c051 100644 --- a/src/Symfony/Component/Templating/PhpEngine.php +++ b/src/Symfony/Component/Templating/PhpEngine.php @@ -350,8 +350,8 @@ class PhpEngine implements EngineInterface, \ArrayAccess /** * Adds an escaper for the given context. * - * @param string $context The escaper context (html, js, ...) - * @param mixed $escaper A PHP callable + * @param string $context The escaper context (html, js, ...) + * @param callable $escaper A PHP callable */ public function setEscaper($context, $escaper) { @@ -364,7 +364,7 @@ class PhpEngine implements EngineInterface, \ArrayAccess * * @param string $context The context name * - * @return mixed $escaper A PHP callable + * @return callable $escaper A PHP callable * * @throws \InvalidArgumentException */ diff --git a/src/Symfony/Component/Translation/PluralizationRules.php b/src/Symfony/Component/Translation/PluralizationRules.php index 3ef8f00b6e..f250423908 100644 --- a/src/Symfony/Component/Translation/PluralizationRules.php +++ b/src/Symfony/Component/Translation/PluralizationRules.php @@ -189,8 +189,8 @@ class PluralizationRules /** * Overrides the default plural rule for a given locale. * - * @param string $rule A PHP callable - * @param string $locale The locale + * @param callable $rule A PHP callable + * @param string $locale The locale * * @throws \LogicException */