8000 Code enhancement and cleanup by yceruto · Pull Request #19830 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

Code enhancement and cleanup #19830

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

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed PHPDoc
  • Loading branch information
yceruto committed Sep 2, 2016
commit c1cc147844cb64cf0e53d8a11aa2d6981e94297a
2 changes: 2 additions & 0 deletions src/Symfony/Bundle/TwigBundle/Extension/ActionsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public function __construct($handler)
* @param string $uri A URI
* @param array $options An array of options
*
* @return string|null The Response content or null when the Response is streamed
*
* @see FragmentHandler::render()
*/
public function renderUri($uri, array $options = array())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ public function onKernelResponse(FilterResponseEvent $event)

/**
* Injects the web debug toolbar into the given Response.
*
* @param Response $response A Response instance
*/
protected function injectToolbar(Response $response, Request $request)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Console/Command/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ public function getSynopsis($short = false)
* Add a command usage example.
*
* @param string $usage The usage, it'll be prefixed with the command name
*
* @return Command The current instance
Copy link
Member

Choose a reason for hiding this comment

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

You should check but I think we are using @return $this elsewhere

Copy link
Member Author
@yceruto yceruto Sep 2, 2016

Choose a reason for hiding this comment

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

In this class @return Command is used, should change this to return $this in the whole class ?

In elsewhere @return <ClassName> is used.

Copy link
Contributor
@HeahDude HeahDude Sep 3, 2016

Choose a reason for hiding this comment

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

@return self is valid as well as $this for phpdoc but the first one is more consistent with the future 7.1 type hinting feature.

*/
public function addUsage($usage)
{
Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/Console/Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ protected function writeError(OutputInterface $output, \Exception $error)
*
* @param OutputInterface $output
* @param Question $question
* @param resource $inputStream
*
* @return string
*/
Expand Down Expand Up @@ -316,7 +317,8 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu
/**
* Gets a hidden response from user.
*
* @param OutputInterface $output An Output instance
* @param OutputInterface $output An Output instance
* @param resource $inputStream The handler resource
*
* @return string The answer
*
Expand Down
7 changes: 0 additions & 7 deletions src/Symfony/Component/Console/Tests/Helper/HelperSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@ public function testIteration()
}
}

/**
* Create a generic mock for the helper interface. Optionally check for a call to setHelperSet with a specific
* helperset instance.
*
* @param string $name
* @param HelperSet $helperset allows a mock to verify a particular helperset set is being added to the Helper
*/
private function getGenericMockHelper($name, HelperSet $helperset = null)
{
$mock_helper = $this->getMock('\Symfony\Component\Console\Helper\HelperInterface');
Expand Down
3 changes: 0 additions & 3 deletions src/Symfony/Component/CssSelector/XPath/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ class Translator implements TranslatorInterface
*/
private $attributeMatchingTranslators = array();

/**
* Constructor.
*/
public function __construct(ParserInterface $parser = null)
{
$this->mainParser = $parser ?: new Parser();
Expand Down
4 changes: 3 additions & 1 deletion src/Symfony/Component/Debug/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,12 @@ private function reRegister($prev)
/**
* Handles errors by filtering then logging them according to the configured bit fields.
*
* @param int $type One of the E_* constants
* @param int $type One of the E_* constants
* @param string $message
* @param string $file
* @param int $line
* @param array $context
* @param array $backtrace
*
* @return bool Returns false when no handling happens so that the PHP engine can handle the error itself
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceRefere
/**
* Returns the value of the edge.
*
* @return ServiceReferenceGraphNode
* @return string
*/
public function getValue()
{
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/ExpressionLanguage/TokenStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ public function next()

/**
* Tests a token.
*
* @param array|int $type The type to test
* @param string|null $value The token value
* @param string|null $message The syntax error message
*/
public function expect($type, $value = null, $message = null)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ public function rename($origin, $target, $overwrite = false)
*
* @param string $filename Path to the file
*
* @return bool
*
* @throws IOException When windows path is longer than 258 characters
*/
private function isReadable($filename)
Expand Down
13 changes: 7 additions & 6 deletions src/Symfony/Component/Form/ChoiceList/ArrayChoiceList.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,13 @@ public function getValuesForChoices(array $choices)
/**
* Flattens an array into the given output variables.
*
* @param array $choices The array to flatten
* @param callable $value The callable for generating choice values
* @param array $choicesByValues The flattened choices indexed by the
* corresponding values
* @param array $keysByValues The original keys indexed by the
* corresponding values
* @param array $choices The array to flatten
* @param callable $value The callable for generating choice values
* @param array $choicesByValues The flattened choices indexed by the
* corresponding values
* @param array $keysByValues The original keys indexed by the
* corresponding values
* @param array $structuredValues The values indexed by the original keys
*
* @internal Must not be used by user-land code
*/
Expand Down
13 changes: 7 additions & 6 deletions src/Symfony/Component/Form/ChoiceList/ArrayKeyChoiceList.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,13 @@ public function getValuesForChoices(array $choices)
/**
* Flattens and flips an array into the given output variable.
*
* @param array $choices The array to flatten
* @param callable $value The callable for generating choice values
* @param array $choicesByValues The flattened choices indexed by the
* corresponding values
* @param array $keysByValues The original keys indexed by the
* corresponding values
* @param array $choices The array to flatten
* @param callable $value The callable for generating choice values
* @param array $choicesByValues The flattened choices indexed by the
* corresponding values
* @param array $keysByValues The original keys indexed by the
* corresponding values
* @param array $structuredValues The values indexed by the original keys
*
* @internal Must not be used by user-land code
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ protected function getIntlDateFormatter($ignoreTimezone = false)
/**
* Checks if the pattern contains only a date.
*
* @param string $pattern The input pattern
*
* @return bool
*/
protected function isPatternDateOnly()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,8 @@
*/
class FormDataExtractor implements FormDataExtractorInterface
{
/**
* @var ValueExporter
*/
private $valueExporter;

/**
* Constructs a new data extractor.
*/
public function __construct(ValueExporter $valueExporter = null)
{
$this->valueExporter = $valueExporter ?: new ValueExporter();
Expand Down
13 changes: 12 additions & 1 deletion src/Symfony/Component/HttpFoundation/JsonResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ public function __construct($data = null, $status = 200, $headers = array())
}

/**
* {@inheritdoc}
* Factory method for chainability.
*
* Example:.
Copy link
Member

Choose a reason for hiding this comment

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

extra dot here

*
* return JsonResponse::create($data, 200)
* ->setSharedMaxAge(300);
*
* @param mixed $data The json response data
* @param int $status The response status code
* @param array $headers An array of response headers
*
* @return JsonResponse
*/
public static function create($data = null, $status = 200, $headers = array())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ public function all();

/**
* Sets all flash messages.
*
* @param array $messages
*/
public function setAll(array $messages);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ protected function getMongo()
* Return an instance of a MongoDate or \MongoDB\BSON\UTCDateTime
*
* @param int $seconds An integer representing UTC seconds since Jan 1 1970. Defaults to now.
*
* @return \MongoDate|\MongoDB\BSON\UTCDateTime
*/
private function createDateTime($seconds = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public function __construct(ContainerInterface $container, $debug = false, Reque
/**
* Adds a service as a fragment renderer.
*
* @param string $name The service name
* @param string $renderer The render service id
*/
public function addRendererService($name, $renderer)
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/HttpKernel/Profiler/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function enable()
*
* @param Response $response A Response instance
*
* @return Profile A Profile instance
* @return Profile|false A Profile instance
*/
public function loadProfileFromResponse(Response $response)
{
Expand Down Expand Up @@ -149,7 +149,7 @@ public function export(Profile $profile)
*
* @param string $data A data string as exported by the export() method
*
* @return Profile A Profile instance
* @return Profile|false A Profile instance
*/
public function import($data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class LanguageBundle extends LanguageDataProvider implements LanguageBundleInter
* @param string $path
* @param BundleEntryReaderInterface $reader
* @param LocaleDataProvider $localeProvider
* @param ScriptDataProvider $scriptProvider
*/
public function __construct($path, BundleEntryReaderInterface $reader, LocaleDataProvider $localeProvider, ScriptDataProvider $scriptProvider)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function getCollectedMessages()
* @param string|null $locale
* @param string|null $domain
* @param string $id
* @param string $trans
* @param string $translation
*/
private function collectMessage($locale, $domain, $id, $translation)
{
Expand Down
B919
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ abstract class Abstract2Dot5ApiTest extends AbstractValidatorTest

/**
* @param MetadataFactoryInterface $metadataFactory
* @param array $objectInitializers
*
* @return ValidatorInterface
*/
Expand Down
5 changes: 3 additions & 2 deletions src/Symfony/Component/VarDumper/Dumper/AbstractDumper.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ protected function dumpLine($depth)
/**
* Generic line dumper callback.
*
* @param string $line The line to write
* @param int $depth The recursive depth in the dumped structure
* @param string $line The line to write
* @param int $depth The recursive depth in the dumped structure
* @param string $indentPad The line indent pad
*/
protected function echoLine($line, $depth, $indentPad)
{
Expand Down
0