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
"Modernize" codebase #259
"Modernize" codebase #259
Conversation
}, | ||
"config": { | ||
"platform": { | ||
"php": "7.1" | ||
"php": "7.1.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to specify this bugfix version as it is the minimum required by vimeo/psalm
@@ -65,6 +66,10 @@ private function createTwig($templateDirectory) | |||
]); | |||
|
|||
if (file_exists($templateDirectory.'/twig.php')) { | |||
/** | |||
* @psalm-suppress UnresolvableInclude | |||
* @var callable(Twig_Environment): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we type with Twig_Environment
but in the documentation of this feature you use Twig\Environment
, should I replace Twig_Environment
by the namespaced class name ? (There shouldn't be a difference since it's an alias, but I'm not sure of potential side effects)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly go the way you prefer, I don't there should be side effects either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the composer.json
refers twig ~1.10
the namespace isn't provided in this version, I'll change the documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is awesome! I added a minor comment and then we're good to merge!
Thanks!
@@ -225,7 +225,7 @@ private function startLivereload( | |||
|
|||
private function isSupported(): bool | |||
{ | |||
if (version_compare(phpversion(), '5.4.0', '<')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That isSupported()
is for checking that PHP >= 5.4 because that's the version they added the built-in webserver.
We could completely remove that check now instead of upgrading the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Why not declaring strict typehint to all the files too? |
As suggested by @alanpoulain I added strict types everywhere |
Awesome thanks! |
Need
As mentioned in #257 an upgrade of the codebase is interesting in order to type everything to help future upgrades.
Implementation
The following changes have been applied:
: void
return type on all methods/functions that return nothing: int
return type forCommand::execute()
as Symfony was moving to enforce developers to return an exit codemixed
or union types)vimeo/psalm
as a dev requirement, configured on the strictest levelvendor/bin/psalm
is now run in travis afterphpunit
FQCN::class
pseudo constant, so tools and IDEs can better understand thempreview
command (as 7.1 il already enforced incomposer.json
Comments
: void
to the interfaceStep::__invoke
it would require a new major release as it's a BC break. Depending on your release strategy this change may be rollbacked.os(linux, macOs)
,php(7.1, 7.2, 7.3, 7.4)
anddependencies(lowest, normal)
)travis-auto-deploy
command