Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add a better Single File Application example#20424

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
tacman wants to merge2 commits intosymfony:7.2
base:7.2
Choose a base branch
Loading
fromtacman:patch-28

Conversation

tacman
Copy link
Contributor

The original example didn't work because it was expecting a return value. This example is a bit more real-world.

The original example didn't work because it didn't return the integer value.  I expanded the example to something that's marginally useful (and more real-world).
@tacman
Copy link
ContributorAuthor

I also add a filename and instructions for running it. I don't understand the second part of the page, where the command can be registered. Is that for bin/console? Or if you want to have your own set of commands, like bin/my-files, where you would have file-counter and others, like bin/console has?

@alexislefebvre
Copy link
Contributor

This PR contains too many commits. You should be able to rebase it on7.1 and remove the unwanted commits, or it may be simpler to create a new branch from7.1 and cherry-pick the commits you want. If you can't reduce the commits for this PR, close it and open a new PR which should contain a few commits only.

@OskarStarkOskarStark changed the base branch from7.1 to7.2December 7, 2024 08:57
@OskarStark
Copy link
Contributor

I switched back to7.2 target branch, we can adjust while merging, but shouldn't we target6.4?

Comment on lines +38 to +42
Now run it with

php bin/file-counter.php

php bin/file-counter.php --all
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Now run it with
php bin/file-counter.php
php bin/file-counter.php --all
Now run it with:
..code-block::bash
php bin/file-counter.php
or
..code-block::bash
php bin/file-counter.php --all

GromNaN reacted with thumbs up emoji
// output arguments and options
$dir = realpath($input->getArgument('dir'));
$all = $input->getOption('all');
$finder = (new Symfony\Component\Finder\Finder())
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use a use statement

Comment on lines +30 to +34
;
$count = iterator_count($finder);
$output->writeln( "$dir has $count " .
($all ? "files" : "files in source control"));
return SingleCommandApplication::SUCCESS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
;
$count = iterator_count($finder);
$output->writeln( "$dir has $count " .
($all ? "files" : "files in source control"));
return SingleCommandApplication::SUCCESS;
;
$count = iterator_count($finder);
$output->writeln("$dir has $count " . ($all ? "files" : "files in source control"));
return SingleCommandApplication::SUCCESS;

Comment on lines +9 to +10
<?php // bin/file-counter.php
require __DIR__.'/../vendor/autoload.php';
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<?php // bin/file-counter.php
require __DIR__.'/../vendor/autoload.php';
// bin/file-counter.php
<?php
require __DIR__.'/../vendor/autoload.php';

Copy link
Member

Choose a reason for hiding this comment

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

This suggestion seems to me to be incorrect as the string// bin/file-counter.php would be printed by PHP when running the file. It's better to just give the file name outside the example, it doesn't matter that much.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@GromNaNGromNaNGromNaN left review comments

@OskarStarkOskarStarkOskarStark left review comments

@xabbuhxabbuhAwaiting requested review from xabbuh

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@tacman@alexislefebvre@OskarStark@GromNaN@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp