Goffi & FileName
Changes
- Removing
asPharFileName
which had been briefly introduced to manage file names within the phar archive. - GoffiContract no longer converts file names to phar file names when in phar mode.
Use the newasFileName()->withPhar()
solution instead. asFileName
no longer returns a string, instead it will return a CatPaw\Core\FileName, which implements Stringable, making the change backward compatible.
The new FileName class offers a->withPhar()
method.
This method will detect if the given file name is present in your .phar file first, if not, then the file name will fallback and try to find the file name in your file system.
When you run the following code
<?php
use function CatPaw\Core\asFilename;
function main(){
echo asFileName(__DIR__, 'main.php')->withPhar().PHP_EOL;
}
with
composer prod:start
it will print the file name found on your file system
/home/raz/Desktop/starter/src/main.php
On the other hand, if you build it to a .phar and then run it
composer prod:build &&\
php app.phar
it will print the file name found in your .phar
phar:///home/raz/Desktop/starter/app.phar/src/main.php