Skip to content

Releases: azjezz/psl

Lavi - 1.5.0

19 Mar 04:11
Compare
Choose a tag to compare

Components:

Features:

  • added Psl\Shell\execute function
  • added Psl\Shell\escape_argument function
  • added Psl\Shell\escape_command function
  • added Psl\Filesystem\SEPARATOR constant
  • added Psl\Filesystem\change_group function
  • added Psl\Filesystem\change_owner function
  • added Psl\Filesystem\change_permissions function
  • added Psl\Filesystem\copy function
  • added Psl\Filesystem\create_directory function
  • added Psl\Filesystem\create_file function
  • added Psl\Filesystem\delete_directory function
  • added Psl\Filesystem\delete_file function
  • added Psl\Filesystem\exists function
  • added Psl\Filesystem\file_size function
  • added Psl\Filesystem\get_group function
  • added Psl\Filesystem\get_owner function
  • added Psl\Filesystem\get_permissions function
  • added Psl\Filesystem\get_basename function
  • added Psl\Filesystem\get_directory function
  • added Psl\Filesystem\get_extension function
  • added Psl\Filesystem\get_filename function
  • added Psl\Filesystem\is_directory function
  • added Psl\Filesystem\is_file function
  • added Psl\Filesystem\is_symbolic_link function
  • added Psl\Filesystem\is_readable function
  • added Psl\Filesystem\is_writable function
  • added Psl\Filesystem\canonicalize function
  • added Psl\Filesystem\is_executable function
  • added Psl\Filesystem\read_directory function
  • added Psl\Filesystem\read_file function
  • added Psl\Filesystem\read_symbolic_link function
  • added Psl\Filesystem\append_file function
  • added Psl\Filesystem\write_file function
  • added Psl\Filesystem\create_temporary_file function
  • added Psl\Filesystem\create_hard_link function
  • added Psl\Filesystem\create_symbolic_link function
  • added Psl\Filesystem\get_access_time function
  • added Psl\Filesystem\get_change_time function
  • added Psl\Filesystem\get_modification_time function
  • added Psl\Filesystem\get_inode function
  • added a new Psl\Regex\replace_by function.
  • added an optional ?int $limit = null parameter to Psl\Regex\replace
  • added an optional ?int $limit = null parameter to Psl\Regex\replace_every
  • added Psl\Html\encode function
  • added Psl\Html\encode_special_characters function
  • added Psl\Html\decode function
  • added Psl\Html\decode_special_characters function
  • added Psl\Html\strip_tags function
  • added Psl\Type\literal_scalar function
  • added Psl\Type\optional function
  • added Psl\Type\TypeInterface::isOptional method
  • added Psl\IO\input_handle function
  • added Psl\IO\output_handle function
  • added Psl\IO\error_handle function
  • added Psl\IO\CloseHandleInterface interface
  • added Psl\IO\CloseReadHandleInterface interface
  • added Psl\IO\CloseReadWriteHandleInterface interface
  • added Psl\IO\CloseSeekHandleInterface interface
  • added Psl\IO\CloseSeekReadHandleInterface interface
  • added Psl\IO\CloseSeekReadWriteHandleInterface interface
  • added Psl\IO\CloseSeekWriteHandleInterface interface
  • added Psl\IO\CloseWriteHandleInterface interface
  • added Psl\IO\HandleInterface interface
  • added Psl\IO\ReadHandleInterface interface
  • added Psl\IO\ReadWriteHandleInterface interface
  • added Psl\IO\SeekHandleInterface interface
  • added Psl\IO\SeekReadHandleInterface interface
  • added Psl\IO\SeekReadWriteHandleInterface interface
  • added Psl\IO\SeekWriteHandleInterface interface
  • added Psl\IO\WriteHandleInterface interface
  • added Psl\IO\Writer class
  • added Psl\IO\Reader class
  • added Psl\IO\MemoryHandle class

Lavi - 1.4.1

21 Feb 04:05
Compare
Choose a tag to compare

Fixes:

  • Psl\Json\typed now accepts any implementation of Type\TypeInterface ( previously, only implementation of Type\Type were allowed )

Lavi - 1.3.1

21 Feb 04:03
Compare
Choose a tag to compare

Fixes:

  • Psl\Json\typed now accepts any implementation of Type\TypeInterface ( previously, only implementation of Type\Type were allowed )

Lavi - 1.4.0

20 Feb 19:53
2af0f62
Compare
Choose a tag to compare

Features:

  • added Psl\Regex\matches function
  • added Psl\Regex\replace function
  • added Psl\Regex\replace_every function
  • added Psl\Regex\split function
  • added Psl\Vec\filter function
  • added Psl\Vec\filter_keys function
  • added Psl\Vec\filter_with_key function
  • added Psl\Vec\map function
  • added Psl\Vec\map_with_key function
  • added Psl\Dict\filter_nulls
  • added Psl\Dict\diff function
  • added Psl\Dict\diff_by_key function
  • added Psl\Dict\intersect function
  • added Psl\Dict\intersect_by_key function

Deprecation:

  • deprecated Psl\Iter\diff_by_key ( use Psl\Dict\diff_by_key instead )
  • deprecated Psl\Iter\chain ( use Psl\Vec\concat instead )

Lavi - 1.3.0

17 Feb 20:06
Compare
Choose a tag to compare

Features:

  • added Type\vec functions that returns a Type of vec<T> ( aka list<T>, T[] )
  • added Type\dict function that returns a Type of dict<Tk, Tv> ( aka array<Tk, Tv> )
  • added a new Type\TypeInterface interface that is implemented by all types.
  • added Type::matches($value): bool method to check if the given value is of that type.

Deprecation:

  • all Type\is_* functions have been deprecated, use Type\string()->matches($value) instead of Type\is_string($value)

Breaking changes:

  • a new method matches has been added to Type\Type, if you have a type that extends this base class, you probably won't be effected, unless you have a method in your class named matches.

Lavi - 1.2.0

16 Feb 02:22
4caeb0a
Compare
Choose a tag to compare

This release brings 3 new components to PSL, Vec, Dict, and Encoding.

Arr component has been deprecated in favor of Iter, Vec, and Dict.

We also introduced a new type function Type\shape() to support object-like-arrays.

Example:

try {
  $input = Type\shape([
    'name' => Type\string(),
    'email' => Type\string(),
    'address' => Type\shape([
      'country' => Type\string(),
      'state' => Type\string(),
      'city' => Type\string(),
    ]),
  ])->assert($_POST);

} catch (Type\Exception\AssertException) {
  // bad request!
}

However, it is not possible to explain the return type for this function to static analysis tools such as psalm, so we have added a psalm plugin that would make your experience using PSL better.

To enable the new Psalm Plugin, follow the instructions in the README.

what difference does the plugin make?

In the example above, if you don't have the plugin enabled, the return type inferred by psalm for assert($_POST) would be array<string, array<string, string>|string>, which is correct, but can be more specific, with the help of the newly added plugin, psalm will understand that the return type is actually array{name: string, email: string, address: array{country: string, state: string, city: string}}, which helps you avoid issues such as accessing an out-of-bound index.


Features:

  • added Psl\Integration\Psalm\Plugin ( psalm-plugin )
  • added Psl\Type\shape
  • added Psl\Vec\chunk
  • added Psl\Vec\chunk_with_keys
  • added Psl\Vec\concat
  • added Psl\Vec\enumerate
  • added Psl\Vec\fill
  • added Psl\Vec\filter_nulls
  • added Psl\Vec\flat_map
  • added Psl\Vec\keys
  • added Psl\Vec\values
  • added Psl\Vec\partition
  • added Psl\Vec\range
  • added Psl\Vec\reductions
  • added Psl\Vec\reproduce
  • added Psl\Vec\reverse
  • added Psl\Vec\shuffle
  • added Psl\Vec\sort
  • added Psl\Vec\sort_by
  • added Psl\Vec\values
  • added Psl\Vec\zip
  • added Psl\Dict\associate
  • added Psl\Dict\drop
  • added Psl\Dict\drop_while
  • added Psl\Dict\equal
  • added Psl\Dict\filter
  • added Psl\Dict\filter_keys
  • added Psl\Dict\filter_with_key
  • added Psl\Dict\flatten
  • added Psl\Dict\flip
  • added Psl\Dict\from_entries
  • added Psl\Dict\from_iterable
  • added Psl\Dict\from_keys
  • added Psl\Dict\group_by
  • added Psl\Dict\map
  • added Psl\Dict\map_keys
  • added Psl\Dict\map_with_key
  • added Psl\Dict\merge
  • added Psl\Dict\partition
  • added Psl\Dict\partition_with_key
  • added Psl\Dict\pull
  • added Psl\Dict\pull_with_key
  • added Psl\Dict\reindex
  • added Psl\Dict\select_keys
  • added Psl\Dict\slice
  • added Psl\Dict\sort
  • added Psl\Dict\sort_by
  • added Psl\Dict\sort_by_key
  • added Psl\Dict\take
  • added Psl\Dict\take_while
  • added Psl\Dict\unique
  • added Psl\Dict\unique_by
  • added Psl\Encoding\Base64\encode
  • added Psl\Encoding\Base64\decode
  • added Psl\Encoding\Hex\encode
  • added Psl\Encoding\Hex\decode

Deprecation:

  • deprecated Psl\Iter\to_array ( use Psl\Vec\values instead )
  • deprecated Psl\Iter\values ( use Psl\Vec\values instead )
  • deprecated Psl\Arr\concat ( use Psl\Vec\concat instead )
  • deprecated Psl\Arr\count ( use Psl\Iter\count instead )
  • deprecated Psl\Arr\filter_nulls ( use Psl\Vec\filter_nulls instead )
  • deprecated Psl\Arr\flat_map ( use Psl\Vec\flat_map instead )
  • deprecated Psl\Arr\keys ( use Psl\Vec\keys instead )
  • deprecated Psl\Arr\shuffle ( use Psl\Vec\shuffle instead )
  • deprecated Psl\Arr\sort ( use Psl\Vec\sort instead )
  • deprecated Psl\Arr\sort_by ( use Psl\Vec\sort_by instead )
  • deprecated Psl\Arr\values ( use Psl\Vec\values instead )
  • deprecated Psl\Iter\chunk ( use Psl\Vec\chunk instead )
  • deprecated Psl\Iter\chunk_with_keys ( use Psl\Vec\chunk_with_keys instead )
  • deprecated Psl\Iter\filter_nulls ( use Psl\Vec\filter_nulls instead )
  • deprecated Psl\Iter\flat_map ( use Psl\Vec\flat_map instead )
  • deprecated Psl\Iter\keys ( use Psl\Vec\keys instead )
  • deprecated Psl\Iter\range ( use Psl\Vec\range instead )
  • deprecated Psl\Iter\reductions ( use Psl\Vec\reductions instead )
  • deprecated Psl\Iter\repeat ( use Psl\Vec\fill instead )
  • deprecated Psl\Iter\reproduce ( use Psl\Vec\reproduce instead )
  • deprecated Psl\Iter\reverse ( use Psl\Vec\reverse instead )
  • deprecated Psl\Iter\zip ( use Psl\Vec\zip instead )
  • deprecated Psl\Arr\drop ( use Psl\Dict\drop instead )
  • deprecated Psl\Arr\drop_while ( use Psl\Dict\drop_while instead )
  • deprecated Psl\Arr\equal ( use Psl\Dict\equal instead )
  • deprecated Psl\Arr\filter ( use Psl\Dict\filter instead )
  • deprecated Psl\Arr\filter_with_key ( use Psl\Dict\filter_with_key instead )
  • deprecated Psl\Arr\filter_keys ( use Psl\Dict\filter_keys instead )
  • deprecated Psl\Arr\flatten ( use Psl\Dict\flatten instead )
  • deprecated Psl\Arr\flip ( use Psl\Dict\flip instead )
  • deprecated Psl\Arr\group_by ( use Psl\Dict\group_by instead )
  • deprecated Psl\Arr\map ( use Psl\Dict\map instead )
  • deprecated Psl\Arr\map_with_key ( use Psl\Dict\map_with_key instead )
  • deprecated Psl\Arr\map_keys ( use Psl\Dict\map_keys instead )
  • deprecated Psl\Arr\merge ( use Psl\Dict\merge instead )
  • deprecated Psl\Arr\partition ( use Psl\Dict\partition instead )
  • deprecated Psl\Arr\select_keys ( use Psl\Dict\select_keys instead )
  • deprecated Psl\Arr\slice ( use Psl\Dict\slice instead )
  • deprecated Psl\Arr\sort_by_key ( use Psl\Dict\sort_by_key instead )
  • deprecated Psl\Arr\sort_with_keys ( use Psl\Dict\sort_with_keys instead )
  • deprecated Psl\Arr\sort_with_keys_by ( use Psl\Dict\sort_with_keys_by instead )
  • deprecated Psl\Arr\take ( use Psl\Dict\take instead )
  • deprecated Psl\Arr\take_while ( use Psl\Dict\take_while instead )
  • deprecated Psl\Arr\unique ( use Psl\Dict\unique instead )
  • deprecated Psl\Arr\unique_by ( use Psl\Dict\unique_by instead )
  • deprecated Psl\Iter\drop ( use Psl\Dict\drop instead )
  • deprecated Psl\Iter\drop_while ( use Psl\Dict\drop_while instead )
  • deprecated Psl\Iter\slice ( use Psl\Dict\slice instead )
  • deprecated Psl\Iter\take ( use Psl\Dict\take instead )
  • deprecated Psl\Iter\take_while ( use Psl\Dict\take_while instead )
  • deprecated Psl\Iter\reindex ( use Psl\Dict\reindex instead )
  • deprecated Psl\Iter\pull ( use Psl\Dict\pull instead )
  • deprecated Psl\Iter\pull_with_key ( use Psl\Dict\pull_with_key instead )
  • deprecated Psl\Iter\to_array_with_keys ( use Psl\Dict\from_iterable instead )
  • deprecated Psl\Iter\map ( use Psl\Dict\map instead )
  • deprecated Psl\Iter\map_with_key ( use Psl\Dict\map_with_key instead )
  • deprecated Psl\Iter\map_keys ( use Psl\Dict\map_keys instead )
  • deprecated Psl\Iter\from_entries ( use Psl\Dict\from_entries instead )
  • deprecated Psl\Iter\from_keys ( use Psl\Dict\from_keys instead )
  • deprecated Psl\Iter\product ( no replacement provided )
  • deprecated Psl\Iter\filter ( use Psl\Dict\filter instead )
  • deprecated Psl\Iter\filter_with_key ( use Psl\Dict\filter_with_key instead )
  • deprecated Psl\Iter\filter_keys ( use Psl\Dict\filter_keys instead )
  • deprecated Psl\Iter\flip ( use Psl\Dict\flip instead )
  • deprecated Psl\Iter\flatten ( use Psl\Dict\flatten instead )
  • deprecated Psl\Iter\merge ( use Psl\Dict\merge instead )
  • deprecated Psl\Arr\contains ( use Psl\Iter\contains instead )
  • deprecated Psl\Arr\contains_key ( use Psl\Iter\contains_key instead )
  • deprecated Psl\Arr\count ( use Psl\Iter\count instead )
  • deprecated Psl\Arr\count_values ( use Psl\Dict\count_values instead )
  • deprecated Psl\Arr\first ( use Psl\Iter\first instead )
  • deprecated Psl\Arr\firstx ( use Psl\Iter\first instead )
  • deprecated Psl\Arr\first_key ( use Psl\Iter\first_key instead )
  • deprecated Psl\Arr\last ( use Psl\Iter\last instead )
  • deprecated Psl\Arr\lastx ( use Psl\Iter\last instead )
  • deprecated Psl\Arr\last_key ( use Psl\Iter\last_key instead )
  • deprecated Psl\Arr\idx ( use $array|$key] ?? $default instead )
  • deprecated Psl\Arr\at ( use $array[$key] instead )
  • deprecated Psl\Iter\enumerate ( use Psl\Vec\enumerate instead )

Lavi - 1.1.1

02 Feb 15:35
ff71e98
Compare
Choose a tag to compare

Bug fixes:

  • [Type] fix parameters name in union function #117

Lavi - 1.1.0

01 Feb 20:16
b6af6c0
Compare
Choose a tag to compare

Features:

  • [Type]: added new Type\non_empty_string function - #116
  • [Iter]: added new Iter\flat_map function - #112 ( thanks to @veewee )
  • [Arr]: added new Arr\flat_map function - #112 ( thanks to @veewee )
  • [Math]: added new Math\clamp function - #111 ( thanks to @veewee )

Bug Fixes:

  • [Result]: don't wrap results on success - #114 ( thanks to @veewee )

Lavi - 1.0.0

17 Jan 17:23
Compare
Choose a tag to compare
[Type] improve typing

Yu - 0.1.2

17 Jan 16:11
5982b22
Compare
Choose a tag to compare

Fixes:

  • add .github folder to export-ignore