question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Extra declare strict types appears after every semicolon

See original GitHub issue

If declare_strict_types setting is enabled and updating after every semi-colon is enabled, then typing a new line of code and entering a semi-colon will cause a line preceding the current line to appear so that you end up with this:

// some code
<?php declare(strict_types = 1);
$foo = 'bar';
// more code

The only way to fix this is to disable the extension, disable declare_strict_types or disable php-cs-fixer.autoFixBySemicolon in the VSCode settings.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
olamediacommented, Nov 24, 2019

php-cs-fixer.autoFixBySemicolon doesn’t work with paste, pasting declare(strict_types = 1); with a new line every time. simply typing does not cause this problem.

To check - paste something ending with a semicolon on non-empty line.

Pasting ; at the start of the line, inserts <?php declare(strict_types=1); with a new line

0reactions
junstylecommented, Jan 21, 2019

g

it’s ok!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enabling 'strict_types' globally in PHP 7 - Stack Overflow
You can enable strict_types globally by using sed , awk or another tool of your choice to replace all <?php with <?php declare(strict_types=1); ......
Read more >
semi - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
Strict mode - JavaScript - MDN Web Docs
JavaScript's strict mode is a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
Read more >
Understanding Automatic Semicolon Insertion in JavaScript
A Busy Person's Guide to Understanding Automatic Semicolon Insertion in JavaScript.
Read more >
PSR-12: Extended Coding Style - PHP-FIG
There MUST be a space between type declaration and property name. A property declaration looks like the following: <?php namespace Vendor\Package; class ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found