consolidation / output-formatters

Apply transformations to structured data to write output in different formats.
Other
192 stars 13 forks source link

fixing deprecation warning #100

Closed stovak closed 1 year ago

stovak commented 1 year ago

Overview

This pull request:

Summary

A null cell generates a deprecation warning in php 8.1

Description

Error:

Deprecated: str_pad(): Passing null to parameter #1 ($string) of type string is deprecated in /Users/stovak/Projects/terminus/vendor/consolidation/output-formatters/src/StructuredData/NumericCellRenderer.php on line 68
codecov[bot] commented 1 year ago

Codecov Report

Merging #100 (f9c048e) into main (d57992b) will increase coverage by 0.13%. The diff coverage is 100.00%.

@@             Coverage Diff              @@
##               main     #100      +/-   ##
============================================
+ Coverage     91.47%   91.61%   +0.13%     
+ Complexity      518      511       -7     
============================================
  Files            50       49       -1     
  Lines          1244     1216      -28     
============================================
- Hits           1138     1114      -24     
+ Misses          106      102       -4     
Impacted Files Coverage Δ
src/Exception/AbstractDataFormatException.php 100.00% <ø> (ø)
src/Exception/IncompatibleDataException.php 100.00% <ø> (ø)
src/Exception/InvalidFormatException.php 100.00% <ø> (ø)
src/Exception/UnknownFieldException.php 100.00% <ø> (ø)
src/Exception/UnknownFormatException.php 100.00% <ø> (ø)
src/Formatters/CsvFormatter.php 97.36% <ø> (-0.26%) :arrow_down:
src/Formatters/FormatterAwareTrait.php 100.00% <ø> (ø)
src/Formatters/JsonFormatter.php 100.00% <ø> (ø)
src/Formatters/ListFormatter.php 100.00% <ø> (ø)
src/Formatters/MetadataFormatterTrait.php 94.11% <ø> (ø)
... and 51 more

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

greg-1-anderson commented 1 year ago

Making wordwrap come out the same across different versions of Symfony would likely be a nightmare, and not productive. You may simply reduce the length of the test message, or increase the column width to avoid wordwrap on the failing lowest test.

stovak commented 1 year ago

Rejoining them with spaces eliminates the word-wrap problem.

greg-1-anderson commented 1 year ago

I know, I'm a pain, but I really don't relish looking at diffs of table outputs in the future if the EOLs are removed. There's just one test with a word wrap failure now; if you eliminate wrapping there, then we can retain the EOLs.

stovak commented 1 year ago

@greg-1-anderson fixed. All tests passing.

stovak commented 1 year ago

RE: composer.lock - Can I move it into place for the test for 7.1 and move it out of the way for everything else?

greg-1-anderson commented 1 year ago

I am not sure what you are trying to accomplish, but the 7.1 test is a "lowest" test, and does not need the lock file. Does the lock file cause problems for the "highest" tests?