RubixML / Tensor

A library and extension that provides objects for scientific computing in PHP.
https://rubixml.com
MIT License
229 stars 28 forks source link

Make it so tests fail if PHP outputs warnings at startup #29

Closed mlocati closed 2 years ago

mlocati commented 2 years ago

When using the tensor PHP extension with PHP 8.1, at startup PHP displays the warnings reported at #28

For example. by simply running an empty PHP code, here's what we have:


Deprecated: Return type of Tensor\Vector::offsetGet($index) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0

Deprecated: Return type of Tensor\Vector::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0

Deprecated: Return type of Tensor\Matrix::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in Unknown on line 0

What about making it so tests fails in this case?

mlocati commented 2 years ago

And here's the tests failure, as expected: https://github.com/RubixML/Tensor/runs/5800556821?check_suite_focus=true#step:4:1446

andrewdalpino commented 2 years ago

Awesome, thank you @mlocati you're the best!